general update & prefix replacements

This commit is contained in:
James Turk 2003-04-08 03:30:50 +00:00
parent 048410bb98
commit 132ff322c1
6 changed files with 35 additions and 29 deletions

View File

@ -13,7 +13,7 @@
File: ZE_ZClient.cpp <br>
Description: Implementation source file for core ZEngine TCP Client Object. <br>
Author(s): James Turk <br>
$Id: ZE_ZClient.cpp,v 1.3 2003/03/15 03:27:19 cozman Exp $<br>
$Id: ZE_ZClient.cpp,v 1.4 2003/04/08 03:30:50 cozman Exp $<br>
\file ZE_ZClient.cpp
\brief Source file for ZClient.
@ -31,7 +31,7 @@ namespace ZE
string num2dotted4(unsigned int num)
{
vector<int> ip;
int d=256*256*256;
int d=16777216; //256*256*256
int m;
while(d > 0)

View File

@ -13,7 +13,7 @@
File: ZE_ZConfigFile.cpp <br>
Description: Implementation source file for ZConfigFile, the ZEngine INI-Style Config File. <br>
Author(s): James Turk <br>
$Id: ZE_ZConfigFile.cpp,v 1.6 2003/02/10 04:02:38 cozman Exp $<br>
$Id: ZE_ZConfigFile.cpp,v 1.7 2003/04/08 03:30:50 cozman Exp $<br>
\file ZE_ZConfigFile.cpp
\brief Source file for ZConfigFile.
@ -32,7 +32,7 @@ string ZConfigFile::CleanString(string str) const
bool inQuotes = false;
//cycle through, only copy spaces and if a character is uppercase, convert it to lowercase
for(string::size_type i = 0; i < str.length(); i++)
for(string::size_type i = 0; i < str.length(); ++i)
{
if(!isspace(str[i]) || inQuotes)
{
@ -52,7 +52,7 @@ bool ZConfigFile::Exists(string sec) const
sec = CleanString(sec);
for(secIter = rFileLayout.begin(); secIter != rFileLayout.end(); secIter++)
for(secIter = rFileLayout.begin(); secIter != rFileLayout.end(); ++secIter)
{
if(CleanString((*secIter).section) == sec)
return true;
@ -68,11 +68,11 @@ bool ZConfigFile::Exists(string sec, string var) const
sec = CleanString(sec);
var = CleanString(var);
for(secIter = rFileLayout.begin(); secIter != rFileLayout.end(); secIter++)
for(secIter = rFileLayout.begin(); secIter != rFileLayout.end(); ++secIter)
{
if(CleanString((*secIter).section) == sec)
{
for(varIter = (*secIter).varList.begin(); varIter != (*secIter).varList.end(); varIter++)
for(varIter = (*secIter).varList.begin(); varIter != (*secIter).varList.end(); ++varIter)
{
if(CleanString((*varIter).var) == var)
return true;
@ -90,14 +90,14 @@ void ZConfigFile::SetVariable(string sec, string var, string val)
if(Exists(CleanString(sec)))
{
sec = CleanString(sec);
for(secIter = rFileLayout.begin(); secIter != rFileLayout.end(); secIter++)
for(secIter = rFileLayout.begin(); secIter != rFileLayout.end(); ++secIter)
{
if(CleanString((*secIter).section) == sec) //if this is the section
{
if(Exists(sec,var))
{
var = CleanString(var);
for(varIter = (*secIter).varList.begin(); varIter != (*secIter).varList.end(); varIter++)
for(varIter = (*secIter).varList.begin(); varIter != (*secIter).varList.end(); ++varIter)
{
if(CleanString((*varIter).var) == var) //if this is the variable
{
@ -136,13 +136,13 @@ string ZConfigFile::GetVariable(string sec, string var, string defVal) const
if(Exists(sec))
{
for(secIter = rFileLayout.begin(); secIter != rFileLayout.end(); secIter++)
for(secIter = rFileLayout.begin(); secIter != rFileLayout.end(); ++secIter)
{
if(CleanString((*secIter).section) == sec) //if this is the section
{
if(Exists(sec,var))
{
for(varIter = (*secIter).varList.begin(); varIter != (*secIter).varList.end(); varIter++)
for(varIter = (*secIter).varList.begin(); varIter != (*secIter).varList.end(); ++varIter)
{
if(CleanString((*varIter).var) == var) //if this is the variable
return (*varIter).val; //return now
@ -324,7 +324,7 @@ void ZConfigFile::Flush()
if(cfile)
{
//iteration through sections
for(secIter = rFileLayout.begin(); secIter != rFileLayout.end(); secIter++)
for(secIter = rFileLayout.begin(); secIter != rFileLayout.end(); ++secIter)
{
//ensure that section is valid
secName = CleanString((*secIter).section);
@ -333,7 +333,7 @@ void ZConfigFile::Flush()
cfile << (*secIter).section << endl; //write out raw section title
//for each variable in section, write out variable=value
for(varIter = (*secIter).varList.begin(); varIter != (*secIter).varList.end(); varIter++)
for(varIter = (*secIter).varList.begin(); varIter != (*secIter).varList.end(); ++varIter)
{
if(CleanString((*varIter).var).length()) //ensures that variable is valid
cfile << (*varIter).var << '=' << (*varIter).val << endl;

View File

@ -13,7 +13,7 @@
File: ZE_ZEngine.cpp <br>
Description: Implementation source file for ZEngine library main singleton class. <br>
Author(s): James Turk <br>
$Id: ZE_ZEngine.cpp,v 1.33 2003/03/17 19:04:47 cozman Exp $<br>
$Id: ZE_ZEngine.cpp,v 1.34 2003/04/08 03:30:50 cozman Exp $<br>
\file ZE_ZEngine.cpp
\brief Central source file for ZEngine.
@ -49,7 +49,7 @@ ZEngine::ZEngine()
mMouseX = mMouseY = 0;
mMouseB = 0;
for(int k = 0; k < SDLK_LAST; k++)
for(int k = 0; k < SDLK_LAST; ++k)
mKeyPress[k] = false;
mUnpauseOnActive = mPaused = false;

View File

@ -13,7 +13,7 @@
File: ZE_ZImage.cpp <br>
Description: Implementation source file for core ZEngine Image or Texture Object. <br>
Author(s): James Turk, Gamer Tazar <br>
$Id: ZE_ZImage.cpp,v 1.28 2003/03/17 03:56:19 cozman Exp $<br>
$Id: ZE_ZImage.cpp,v 1.29 2003/04/08 03:30:50 cozman Exp $<br>
\file ZE_ZImage.cpp
\brief Source file for ZImage.
@ -149,6 +149,7 @@ void ZImage::Attach(SDL_Surface *surface)
rTexMaxX = coord[2];
rTexMaxY = coord[3];
rImage = surface;
rEngine->WriteLog(FormatStr("Attached %d with ID %d",this,rTexID));
}
else
rEngine->ReportError(ZERR_NOIMAGE,"Attach");
@ -164,7 +165,10 @@ void ZImage::Reload()
void ZImage::Release()
{
if(glIsTexture(rTexID))
{
rEngine->WriteLog(FormatStr("Releasing %d with ID %d",this,rTexID));
glDeleteTextures(1,&rTexID);
}
rTexMinX = rTexMinY = rTexMaxX = rTexMaxY = 0.0f;
rTexID = rWidth = rHeight = 0;
FreeImage(rImage);
@ -226,10 +230,11 @@ void ZImage::Resize(unsigned int width, unsigned int height)
void ZImage::Bind() const
{
if(!rTexID)
rEngine->ReportError(ZERR_NOIMAGE,"Bind");
else
if(rTexID)
glBindTexture(GL_TEXTURE_2D, rTexID);
else
rEngine->ReportError(ZERR_NOIMAGE,"Bind");
}
void ZImage::Draw(int x, int y) const

View File

@ -13,7 +13,7 @@
File: ZE_ZServer.cpp <br>
Description: Implementation source file for core ZEngine TCP Server Object. <br>
Author(s): James Turk <br>
$Id: ZE_ZServer.cpp,v 1.3 2003/03/15 03:27:19 cozman Exp $<br>
$Id: ZE_ZServer.cpp,v 1.4 2003/04/08 03:30:50 cozman Exp $<br>
\file ZE_ZServer.cpp
\brief Source file for ZServer.
@ -70,7 +70,7 @@ bool ZServer::Start(int maxClients, Uint16 port)
else if(rVerbose)
rEngine->WriteLog(FormatStr("ZServer: Created server with %d available sockets.",rMaxClients));
for(int i=0; i < rMaxClients; i++)
for(int i=0; i < rMaxClients; ++i)
rClientSockets[i] = NULL;
if(SDLNet_ResolveHost(&ip,NULL,port) < 0) //try to resolve the host
@ -103,7 +103,7 @@ void ZServer::Stop()
}
if(rClientSockets)
{
for(int i=0; i < rMaxClients; i++)
for(int i=0; i < rMaxClients; ++i)
{
if(rClientSockets[i])
{
@ -130,7 +130,7 @@ void ZServer::CheckSockets()
if(SDLNet_SocketReady(rSocket)) //new client
{
for(count=0; count < rMaxClients; count++) //find first open socket
for(count=0; count < rMaxClients; ++count) //find first open socket
{
if(!rClientSockets[count])
break;
@ -150,7 +150,7 @@ void ZServer::CheckSockets()
}
//check all sockets for activity//
for(int i=0; i < rMaxClients; i++)
for(int i=0; i < rMaxClients; ++i)
{
if(SDLNet_SocketReady(rClientSockets[i])) //incoming message
{
@ -164,7 +164,7 @@ void ZServer::CheckSockets()
size = result;
if(rVerbose)
rEngine->WriteLog("ZServer: Mirroring data: ");
for(int j=0; j < rMaxClients; j++)
for(int j=0; j < rMaxClients; ++j)
{
if(rClientSockets[j] && i != j) //send to open sockets that aren't the same
{
@ -181,10 +181,10 @@ int ZServer::Clients()
{
int numClients=0;
for(int i=0; i < rMaxClients; i++)
for(int i=0; i < rMaxClients; ++i)
{
if(rClientSockets[i])
numClients++;
++numClients;
}
return numClients;

View File

@ -8,8 +8,9 @@ int power_of_two(int input)
{
int value = 1;
while ( value < input ) {
value <<= 1;
while(value < input)
{
value <<= 1;
}
return value;
}