- Fixed a few Visual Studio compiler warnings

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@3129 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2009-07-22 21:35:50 +00:00
parent 3a2db52065
commit 5c9f9e71f9
9 changed files with 51 additions and 47 deletions
+3 -2
View File
@@ -1914,12 +1914,13 @@ void RefreshScreen(void *DummyVariable)
#endif #endif
CHAR8 FileName[64]; CHAR8 FileName[64];
INT32 iIndex; INT32 iIndex;
STRING512 DataDir;
STRING512 ExecDir;
UINT16 *p16BPPData; UINT16 *p16BPPData;
// Snap: save current directory // Snap: save current directory
#ifndef USE_VFS #ifndef USE_VFS
STRING512 DataDir;
STRING512 ExecDir;
GetFileManCurrentDirectory( DataDir ); GetFileManCurrentDirectory( DataDir );
GetExecutableDirectory( ExecDir ); GetExecutableDirectory( ExecDir );
SetFileManCurrentDirectory( ExecDir ); SetFileManCurrentDirectory( ExecDir );
+5 -5
View File
@@ -564,11 +564,11 @@ BOOLEAN PrepareEnemyForSectorBattle()
// OJW - 20090403 - override max ai in co-op // OJW - 20090403 - override max ai in co-op
if (is_networked && is_server && OVERRIDE_MAX_AI == 1) if (is_networked && is_server && OVERRIDE_MAX_AI == 1)
{ {
float totalEnemies = pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites; float totalEnemies = (float)(pSector->ubNumAdmins + pSector->ubNumTroops + pSector->ubNumElites);
ubTotalAdmins = ((float)pSector->ubNumAdmins / totalEnemies) * mapMaximumNumberOfEnemies; ubTotalAdmins = (unsigned int)(((float)pSector->ubNumAdmins / totalEnemies) * mapMaximumNumberOfEnemies);
ubTotalTroops = ((float)pSector->ubNumTroops / totalEnemies) * mapMaximumNumberOfEnemies; ubTotalTroops = (unsigned int)(((float)pSector->ubNumTroops / totalEnemies) * mapMaximumNumberOfEnemies);
ubTotalElites = ((float)pSector->ubNumElites / totalEnemies) * mapMaximumNumberOfEnemies; ubTotalElites = (unsigned int)(((float)pSector->ubNumElites / totalEnemies) * mapMaximumNumberOfEnemies);
totalEnemies = ubTotalAdmins + ubTotalTroops + ubTotalElites; totalEnemies = (float)(ubTotalAdmins + ubTotalTroops + ubTotalElites);
// take care of any rounding losses // take care of any rounding losses
while (totalEnemies < mapMaximumNumberOfEnemies) while (totalEnemies < mapMaximumNumberOfEnemies)
+2 -1
View File
@@ -1358,7 +1358,6 @@ void EndLoadScreen( )
//Report the time it took to load the map. This is temporary until we are satisfied with the time //Report the time it took to load the map. This is temporary until we are satisfied with the time
//it takes to load the map. //it takes to load the map.
CHAR16 str[60]; CHAR16 str[60];
FILE *fp;
UINT32 uiSeconds; UINT32 uiSeconds;
UINT32 uiHundreths; UINT32 uiHundreths;
UINT32 uiUnaccounted; UINT32 uiUnaccounted;
@@ -1381,6 +1380,8 @@ void EndLoadScreen( )
} }
ScreenMsg( FONT_YELLOW, MSG_TESTVERSION, str ); ScreenMsg( FONT_YELLOW, MSG_TESTVERSION, str );
#ifndef USE_VFS #ifndef USE_VFS
FILE *fp;
if( fStartNewFile ) if( fStartNewFile )
{ //start new file { //start new file
fp = fopen( "TimeResults.txt", "w" ); fp = fopen( "TimeResults.txt", "w" );
+2 -2
View File
@@ -68,7 +68,7 @@ ammotypeStartElementHandle(void *userData, const XML_Char *name, const XML_Char
strcmp(name, "standardIssue") == 0 || strcmp(name, "standardIssue") == 0 ||
strcmp(name, "numberOfBullets") == 0 || strcmp(name, "numberOfBullets") == 0 ||
//zilpin: pellet spread patterns externalized in XML //zilpin: pellet spread patterns externalized in XML
stricmp(name, "spreadPattern") == 0 || strcmp(name, "spreadPattern") == 0 ||
strcmp(name, "highExplosive") == 0 || strcmp(name, "highExplosive") == 0 ||
strcmp(name, "explosionSize") == 0 || strcmp(name, "explosionSize") == 0 ||
strcmp(name, "antiTank") == 0 || strcmp(name, "antiTank") == 0 ||
@@ -226,7 +226,7 @@ ammotypeEndElementHandle(void *userData, const XML_Char *name)
pData->curAmmoType.numberOfBullets = (UINT8) atol(pData->szCharData); pData->curAmmoType.numberOfBullets = (UINT8) atol(pData->szCharData);
} }
//zilpin: pellet spread patterns externalized in XML //zilpin: pellet spread patterns externalized in XML
else if(stricmp(name, "spreadPattern") == 0) else if(strcmp(name, "spreadPattern") == 0)
{ {
pData->curElement = ELEMENT; pData->curElement = ELEMENT;
pData->curAmmoType.spreadPattern = FindSpreadPatternIndex( pData->szCharData ); pData->curAmmoType.spreadPattern = FindSpreadPatternIndex( pData->szCharData );
+30 -31
View File
@@ -69,12 +69,11 @@ typedef spreadpatternParseData;
static void XMLCALL static void XMLCALL
spreadpatternStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts) spreadpatternStartElementHandle(void *userData, const XML_Char *name, const XML_Char **atts)
{ {
int i;
spreadpatternParseData * pData = (spreadpatternParseData *)userData; spreadpatternParseData * pData = (spreadpatternParseData *)userData;
if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element? if(pData->currentDepth <= pData->maxReadDepth) //are we reading this element?
{ {
if(stricmp(name, "SPREADPATTERNLIST") == 0 && pData->curElement == ELEMENT_NONE) if(strcmp(name, "SPREADPATTERNLIST") == 0 && pData->curElement == ELEMENT_NONE)
{ {
pData->curElement = ELEMENT_LIST; pData->curElement = ELEMENT_LIST;
@@ -86,7 +85,7 @@ spreadpatternStartElementHandle(void *userData, const XML_Char *name, const XML_
pData->maxReadDepth++; //we are not skipping this element pData->maxReadDepth++; //we are not skipping this element
} }
else if(stricmp(name, "SPREADPATTERN") == 0 && pData->curElement == ELEMENT_LIST) else if(strcmp(name, "SPREADPATTERN") == 0 && pData->curElement == ELEMENT_LIST)
{ {
pData->curElement = ELEMENT_LIST; pData->curElement = ELEMENT_LIST;
@@ -111,7 +110,7 @@ spreadpatternStartElementHandle(void *userData, const XML_Char *name, const XML_
pData->maxReadDepth++; //we are not skipping this element pData->maxReadDepth++; //we are not skipping this element
} }
else if(stricmp(name, "p") == 0 )//&& pData->curElement == ELEMENT_LIST) else if(strcmp(name, "p") == 0 )//&& pData->curElement == ELEMENT_LIST)
{ {
pData->curElement = ELEMENT; pData->curElement = ELEMENT;
gpSpreadPattern[giSpreadPatternCount-1].iCount++; gpSpreadPattern[giSpreadPatternCount-1].iCount++;
@@ -128,12 +127,12 @@ spreadpatternStartElementHandle(void *userData, const XML_Char *name, const XML_
pData->maxReadDepth++; //we are not skipping this element pData->maxReadDepth++; //we are not skipping this element
} }
else if( //pData->curElement == ELEMENT && else if( //pData->curElement == ELEMENT &&
( stricmp(name, "x") == 0 ( strcmp(name, "x") == 0
|| stricmp(name, "y") == 0 || strcmp(name, "y") == 0
|| stricmp(name, "xspread") == 0 || strcmp(name, "xspread") == 0
|| stricmp(name, "yspread") == 0 || strcmp(name, "yspread") == 0
|| stricmp(name, "Name") == 0 || strcmp(name, "Name") == 0
|| stricmp(name, "method") == 0 || strcmp(name, "method") == 0
)) ))
{ {
@@ -167,21 +166,20 @@ static void XMLCALL
spreadpatternEndElementHandle(void *userData, const XML_Char *name) spreadpatternEndElementHandle(void *userData, const XML_Char *name)
{ {
DOUBLE d; DOUBLE d;
int i;
spreadpatternParseData * pData = (spreadpatternParseData *)userData; spreadpatternParseData * pData = (spreadpatternParseData *)userData;
if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading if(pData->currentDepth <= pData->maxReadDepth) //we're at the end of an element that we've been reading
{ {
if(stricmp(name, "SPREADPATTERNLIST") == 0) if(strcmp(name, "SPREADPATTERNLIST") == 0)
{ {
pData->curElement = ELEMENT_NONE; pData->curElement = ELEMENT_NONE;
} }
else if(stricmp(name, "SPREADPATTERN") == 0) else if(strcmp(name, "SPREADPATTERN") == 0)
{ {
pData->curElement = ELEMENT_LIST; pData->curElement = ELEMENT_LIST;
} }
else if(stricmp(name, "p") == 0) else if(strcmp(name, "p") == 0)
{ {
//I would prefer the format to be: //I would prefer the format to be:
// <SPREADPATTERN><p x="0.1" y="0.1"/><p x="0.2" y="0.2"/></SPREADPATTERN> // <SPREADPATTERN><p x="0.1" y="0.1"/><p x="0.2" y="0.2"/></SPREADPATTERN>
@@ -190,31 +188,31 @@ spreadpatternEndElementHandle(void *userData, const XML_Char *name)
//because the XML editor will probably have problems with using attributes instead of tags. //because the XML editor will probably have problems with using attributes instead of tags.
pData->curElement = ELEMENT_LIST; pData->curElement = ELEMENT_LIST;
} }
else if(stricmp(name, "x") == 0) else if(strcmp(name, "x") == 0)
{ {
pData->curElement = ELEMENT; pData->curElement = ELEMENT;
d = atof(pData->szCharData); d = atof(pData->szCharData);
gpSpreadPattern[giSpreadPatternCount-1].x[ gpSpreadPattern[giSpreadPatternCount-1].iCount-1 ] = d; gpSpreadPattern[giSpreadPatternCount-1].x[ gpSpreadPattern[giSpreadPatternCount-1].iCount-1 ] = d;
} }
else if(stricmp(name, "y") == 0) else if(strcmp(name, "y") == 0)
{ {
pData->curElement = ELEMENT; pData->curElement = ELEMENT;
d = atof(pData->szCharData); d = atof(pData->szCharData);
gpSpreadPattern[giSpreadPatternCount-1].y[ gpSpreadPattern[giSpreadPatternCount-1].iCount-1 ] = d; gpSpreadPattern[giSpreadPatternCount-1].y[ gpSpreadPattern[giSpreadPatternCount-1].iCount-1 ] = d;
} }
else if(stricmp(name, "xspread") == 0) else if(strcmp(name, "xspread") == 0)
{ {
pData->curElement = ELEMENT; pData->curElement = ELEMENT;
d = fabs( atof(pData->szCharData) ); d = fabs( atof(pData->szCharData) );
gpSpreadPattern[giSpreadPatternCount-1].xspread = d; gpSpreadPattern[giSpreadPatternCount-1].xspread = d;
} }
else if(stricmp(name, "yspread") == 0) else if(strcmp(name, "yspread") == 0)
{ {
pData->curElement = ELEMENT; pData->curElement = ELEMENT;
d = fabs( atof(pData->szCharData) ); d = fabs( atof(pData->szCharData) );
gpSpreadPattern[giSpreadPatternCount-1].yspread = d; gpSpreadPattern[giSpreadPatternCount-1].yspread = d;
} }
else if(stricmp(name, "Name") == 0) else if(strcmp(name, "Name") == 0)
{ {
pData->curElement = ELEMENT; pData->curElement = ELEMENT;
//Trim whitespace. //Trim whitespace.
@@ -224,15 +222,15 @@ spreadpatternEndElementHandle(void *userData, const XML_Char *name)
memset(gpSpreadPattern[giSpreadPatternCount-1].Name,0,SPREADPATTERN_NAME_SIZE); memset(gpSpreadPattern[giSpreadPatternCount-1].Name,0,SPREADPATTERN_NAME_SIZE);
strncpy(gpSpreadPattern[giSpreadPatternCount-1].Name,pData->szCharData,SPREADPATTERN_NAME_SIZE-1); strncpy(gpSpreadPattern[giSpreadPatternCount-1].Name,pData->szCharData,SPREADPATTERN_NAME_SIZE-1);
} }
else if(stricmp(name, "method") == 0) else if(strcmp(name, "method") == 0)
{ {
pData->curElement = ELEMENT; pData->curElement = ELEMENT;
//Trim whitespace. //Trim whitespace.
while( pData->szCharData[0] == ' ' ) memmove( pData->szCharData , &pData->szCharData[1] , strlen(&pData->szCharData[1]) ); while( pData->szCharData[0] == ' ' ) memmove( pData->szCharData , &pData->szCharData[1] , strlen(&pData->szCharData[1]) );
while( strlen(pData->szCharData)>0 && pData->szCharData[ strlen(pData->szCharData)-1 ] == ' ' ) pData->szCharData[ strlen(pData->szCharData)-1 ]=0; while( strlen(pData->szCharData)>0 && pData->szCharData[ strlen(pData->szCharData)-1 ] == ' ' ) pData->szCharData[ strlen(pData->szCharData)-1 ]=0;
//Find it. //Find it.
for(i=0;i<SPREADPATTERNMETHOD_COUNT;++i){ for(unsigned int i=0;i<SPREADPATTERNMETHOD_COUNT;++i){
if(stricmp(pData->szCharData, gSpreadPatternMethodNames[i] ) == 0){ if(strcmp(pData->szCharData, gSpreadPatternMethodNames[i] ) == 0){
gpSpreadPattern[giSpreadPatternCount-1].method = i; gpSpreadPattern[giSpreadPatternCount-1].method = i;
break; break;
} }
@@ -326,11 +324,9 @@ BOOLEAN WriteSpreadPatterns()
{ {
UINT32 i,j;
FilePrintf(hFile,"<SPREADPATTERNLIST>\r\n"); FilePrintf(hFile,"<SPREADPATTERNLIST>\r\n");
FilePrintf(hFile,"<!-- giSpreadPatternCount = %d -->\r\n", giSpreadPatternCount ); FilePrintf(hFile,"<!-- giSpreadPatternCount = %d -->\r\n", giSpreadPatternCount );
for(i = 0 ; i < giSpreadPatternCount; i++) for(INT32 i = 0 ; i < giSpreadPatternCount; i++)
{ {
FilePrintf(hFile,"\t<SPREADPATTERN>\r\n"); FilePrintf(hFile,"\t<SPREADPATTERN>\r\n");
FilePrintf(hFile,"\t<!-- index = %d -->\r\n",i); FilePrintf(hFile,"\t<!-- index = %d -->\r\n",i);
@@ -339,7 +335,7 @@ BOOLEAN WriteSpreadPatterns()
FilePrintf(hFile,"\t<xspread>%2.4f</xspread>",gpSpreadPattern[i].xspread); FilePrintf(hFile,"\t<xspread>%2.4f</xspread>",gpSpreadPattern[i].xspread);
FilePrintf(hFile," <yspread>%2.4f</yspread>\r\n",gpSpreadPattern[i].yspread); FilePrintf(hFile," <yspread>%2.4f</yspread>\r\n",gpSpreadPattern[i].yspread);
FilePrintf(hFile,"\t<!-- p iCount = %d -->\r\n",gpSpreadPattern[i].iCount); FilePrintf(hFile,"\t<!-- p iCount = %d -->\r\n",gpSpreadPattern[i].iCount);
for(j=0;j<gpSpreadPattern[i].iCount;j++) for(INT32 j=0;j<gpSpreadPattern[i].iCount;j++)
{ {
FilePrintf(hFile,"\t\t<p>"); FilePrintf(hFile,"\t\t<p>");
FilePrintf(hFile,"<x>%2.4f</x>",gpSpreadPattern[i].x[j]); FilePrintf(hFile,"<x>%2.4f</x>",gpSpreadPattern[i].x[j]);
@@ -364,7 +360,8 @@ BOOLEAN WriteSpreadPatterns()
//If the name is not found, or the index was out of range, then return 0. //If the name is not found, or the index was out of range, then return 0.
int FindSpreadPatternIndex( const STR strName ) int FindSpreadPatternIndex( const STR strName )
{ {
int i=0,n=0; UINT32 ui = 0;
INT32 i,n=0;
char str[SPREADPATTERN_NAME_SIZE]={}; char str[SPREADPATTERN_NAME_SIZE]={};
//Copy search name sans leading and trailing space. //Copy search name sans leading and trailing space.
@@ -374,14 +371,16 @@ int FindSpreadPatternIndex( const STR strName )
while( strlen(str)>0 && str[ strlen(str)-1 ] == ' ' ) str[ strlen(str)-1 ]=0; while( strlen(str)>0 && str[ strlen(str)-1 ] == ' ' ) str[ strlen(str)-1 ]=0;
//Named pattern or raw index? //Named pattern or raw index?
for(i=0;i<strlen(str);i++) if( !isdigit(str[i]) ) break; for(ui=0;ui<strlen(str);ui++)
if( !isdigit(str[ui]) )
break;
if(i<strlen(str)) if(ui<strlen(str))
{ {
//Holds named SpreadPattern. Search. //Holds named SpreadPattern. Search.
for(i=0;i<giSpreadPatternCount;i++) for(i=0;i<giSpreadPatternCount;i++)
{ {
if( !stricmp(str, gpSpreadPattern[i].Name) ) if( !strcmp(str, gpSpreadPattern[i].Name) )
{ {
//Match! Assign and return. //Match! Assign and return.
n=i; n=i;
-1
View File
@@ -521,7 +521,6 @@ extern BOOLEAN gfLoadShadeTablesFromTextFile;
void BuildTileShadeTables( ) void BuildTileShadeTables( )
{ {
HWFILE hfile;
// BF // BF
//STRING512 DataDir; //STRING512 DataDir;
//STRING512 ShadeTableDir; //STRING512 ShadeTableDir;
+3 -1
View File
@@ -193,7 +193,7 @@ SMKFLIC *pSmack;
SMKFLIC *SmkOpenFlic(CHAR8 *cFilename) SMKFLIC *SmkOpenFlic(CHAR8 *cFilename)
{ {
SMKFLIC *pSmack; SMKFLIC *pSmack;
HANDLE hFile;
// Get an available flic slot from the list // Get an available flic slot from the list
if(!(pSmack=SmkGetFreeFlic())) if(!(pSmack=SmkGetFreeFlic()))
@@ -210,6 +210,8 @@ SMKFLIC *SmkOpenFlic(CHAR8 *cFilename)
return(NULL); return(NULL);
} }
HANDLE hFile;
//Get the real file handle for the file man handle for the smacker file //Get the real file handle for the file man handle for the smacker file
hFile = GetRealFileHandleFromFileManFileHandle( pSmack->hFileHandle ); hFile = GetRealFileHandleFromFileManFileHandle( pSmack->hFileHandle );
#else #else
+3 -1
View File
@@ -105,7 +105,7 @@ void ConvertRGBDistribution555To565( UINT16 * p16BPPData, UINT32 uiNumberOfPixel
void WriteSTIFile( INT8 *pData, SGPPaletteEntry *pPalette, INT16 sWidth, INT16 sHeight, STR cOutputName, UINT32 fFlags, UINT32 uiAppDataSize ) void WriteSTIFile( INT8 *pData, SGPPaletteEntry *pPalette, INT16 sWidth, INT16 sHeight, STR cOutputName, UINT32 fFlags, UINT32 uiAppDataSize )
{ {
FILE * pOutput;
UINT32 uiOriginalSize; UINT32 uiOriginalSize;
UINT8 * pOutputBuffer = NULL; UINT8 * pOutputBuffer = NULL;
@@ -167,6 +167,8 @@ void WriteSTIFile( INT8 *pData, SGPPaletteEntry *pPalette, INT16 sWidth, INT16 s
// save file // save file
// //
#ifndef USE_VFS #ifndef USE_VFS
FILE * pOutput;
pOutput = fopen( cOutputName, "wb" ); pOutput = fopen( cOutputName, "wb" );
if (pOutput == NULL ) if (pOutput == NULL )
{ {
+3 -3
View File
@@ -214,8 +214,8 @@ itemStartElementHandle(void *userData, const XML_Char *name, const XML_Char **at
strcmp(name, "SciFi") == 0 || strcmp(name, "SciFi") == 0 ||
strcmp(name, "NewInv") == 0 || strcmp(name, "NewInv") == 0 ||
//zilpin: pellet spread patterns externalized in XML //zilpin: pellet spread patterns externalized in XML
stricmp(name, "spreadPattern") == 0 || strcmp(name, "spreadPattern") == 0 ||
strcmp(name, "fFlags") == 0 )) strcmp(name, "fFlags") == 0 ))
{ {
pData->curElement = ELEMENT_PROPERTY; pData->curElement = ELEMENT_PROPERTY;
//DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("itemStartElementHandle: going into element, name = %s",name) ); //DebugMsg(TOPIC_JA2, DBG_LEVEL_3, String("itemStartElementHandle: going into element, name = %s",name) );
@@ -1028,7 +1028,7 @@ itemEndElementHandle(void *userData, const XML_Char *name)
pData->curItem.bestlaserrange = (INT16) atol(pData->szCharData); pData->curItem.bestlaserrange = (INT16) atol(pData->szCharData);
} }
//zilpin: pellet spread patterns externalized in XML //zilpin: pellet spread patterns externalized in XML
else if(stricmp(name, "spreadPattern") == 0) else if(strcmp(name, "spreadPattern") == 0)
{ {
pData->curElement = ELEMENT; pData->curElement = ELEMENT;
pData->curItem.spreadPattern = FindSpreadPatternIndex( pData->szCharData ); pData->curItem.spreadPattern = FindSpreadPatternIndex( pData->szCharData );