changed hardcoded numbers to enums in preparation for total merc number increase

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6042 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2013-04-30 21:31:04 +00:00
parent 82dec9404c
commit 2455c2c467
11 changed files with 35 additions and 34 deletions
+4 -4
View File
@@ -699,10 +699,10 @@ void ResetAllMercPositions()
//} //}
curr = curr->next; curr = curr->next;
} }
AddSoldierInitListTeamToWorld( ENEMY_TEAM, 255 ); AddSoldierInitListTeamToWorld( ENEMY_TEAM, TOTAL_SOLDIERS + 1 );
AddSoldierInitListTeamToWorld( CREATURE_TEAM, 255 ); AddSoldierInitListTeamToWorld( CREATURE_TEAM, TOTAL_SOLDIERS + 1 );
AddSoldierInitListTeamToWorld( MILITIA_TEAM, 255 ); AddSoldierInitListTeamToWorld( MILITIA_TEAM, TOTAL_SOLDIERS + 1 );
AddSoldierInitListTeamToWorld( CIV_TEAM, 255 ); AddSoldierInitListTeamToWorld( CIV_TEAM, TOTAL_SOLDIERS + 1 );
gpSelected = NULL; gpSelected = NULL;
gsSelectedMercID = -1; gsSelectedMercID = -1;
} }
+4 -4
View File
@@ -1073,10 +1073,10 @@ UINT32 ProcessFileIO()
//ATE: Any current mercs are transfered here... //ATE: Any current mercs are transfered here...
//UpdateMercsInSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ ); //UpdateMercsInSector( gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
AddSoldierInitListTeamToWorld( ENEMY_TEAM, 255 ); AddSoldierInitListTeamToWorld( ENEMY_TEAM, TOTAL_SOLDIERS + 1 );
AddSoldierInitListTeamToWorld( CREATURE_TEAM, 255 ); AddSoldierInitListTeamToWorld( CREATURE_TEAM, TOTAL_SOLDIERS + 1 );
AddSoldierInitListTeamToWorld( MILITIA_TEAM, 255 ); AddSoldierInitListTeamToWorld( MILITIA_TEAM, TOTAL_SOLDIERS + 1 );
AddSoldierInitListTeamToWorld( CIV_TEAM, 255 ); AddSoldierInitListTeamToWorld( CIV_TEAM, TOTAL_SOLDIERS + 1 );
iCurrentAction = ACTION_NULL; iCurrentAction = ACTION_NULL;
gbCurrentFileIOStatus = IOSTATUS_NONE; gbCurrentFileIOStatus = IOSTATUS_NONE;
if( !gfCaves && !gfBasement ) if( !gfCaves && !gfBasement )
+6 -6
View File
@@ -3076,14 +3076,14 @@ INT32 GetIdOfDepartedMercWithHighestStat( INT32 iStat )
for( uiLoopCounter=0; fNotDone ; uiLoopCounter++ ) for( uiLoopCounter=0; fNotDone ; uiLoopCounter++ )
{ {
//if we are at the end of //if we are at the end of
if( uiLoopCounter == 255 && bCurrentList == 2 ) if( uiLoopCounter == NUM_PROFILES && bCurrentList == 2 )
{ {
fNotDone = FALSE; fNotDone = FALSE;
continue; continue;
} }
// check if we need to move to the next list // check if we need to move to the next list
if( uiLoopCounter == 255 ) if( uiLoopCounter == NUM_PROFILES )
{ {
if( bCurrentList == 0 ) if( bCurrentList == 0 )
{ {
@@ -3249,7 +3249,7 @@ INT32 GetIdOfDepartedMercWithLowestStat( INT32 iStat )
} }
*/ */
//if we are at the end of //if we are at the end of
if( uiLoopCounter == 255 && bCurrentList == 2 ) if( uiLoopCounter == NUM_PROFILES && bCurrentList == 2 )
{ {
fNotDone = FALSE; fNotDone = FALSE;
continue; continue;
@@ -3257,7 +3257,7 @@ INT32 GetIdOfDepartedMercWithLowestStat( INT32 iStat )
// check if we need to move to the next list // check if we need to move to the next list
// if( *bCurrentListValue == -1 ) // if( *bCurrentListValue == -1 )
if( uiLoopCounter == 255 ) if( uiLoopCounter == NUM_PROFILES )
{ {
if( bCurrentList == 0 ) if( bCurrentList == 0 )
{ {
@@ -3786,7 +3786,7 @@ INT32 GetAvgStatOfPastTeamStat( INT32 iStat )
*/ */
//if we are at the end of //if we are at the end of
if( uiLoopCounter == 255 && bCurrentList == 2 ) if( uiLoopCounter == NUM_PROFILES && bCurrentList == 2 )
{ {
fNotDone = FALSE; fNotDone = FALSE;
continue; continue;
@@ -3794,7 +3794,7 @@ INT32 GetAvgStatOfPastTeamStat( INT32 iStat )
// check if we need to move to the next list // check if we need to move to the next list
// if( *bCurrentListValue == -1 ) // if( *bCurrentListValue == -1 )
if( uiLoopCounter == 255 ) if( uiLoopCounter == NUM_PROFILES )
{ {
if( bCurrentList == 0 ) if( bCurrentList == 0 )
{ {
+1 -1
View File
@@ -8367,7 +8367,7 @@ BOOLEAN LoadGeneralInfo( HWFILE hFile )
{ {
//Camo Face by Jazz //Camo Face by Jazz
for (int i=0;i<255;i++) for (int i=0;i<NUM_PROFILES;++i)
{ {
gCamoFace[i].gCamoface = FALSE; gCamoFace[i].gCamoface = FALSE;
gCamoFace[i].gUrbanCamoface = FALSE; gCamoFace[i].gUrbanCamoface = FALSE;
+1 -1
View File
@@ -2713,7 +2713,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Autoresolve2");
{ {
if( gpCivs[ i ].pSoldier ) if( gpCivs[ i ].pSoldier )
{ {
ubCurrentRank = 255; ubCurrentRank = MAX_AR_TEAM_SIZE;
switch( gpCivs[ i ].pSoldier->ubSoldierClass ) switch( gpCivs[ i ].pSoldier->ubSoldierClass )
{ {
case SOLDIER_CLASS_GREEN_MILITIA: ubCurrentRank = GREEN_MILITIA; break; case SOLDIER_CLASS_GREEN_MILITIA: ubCurrentRank = GREEN_MILITIA; break;
+2 -2
View File
@@ -645,7 +645,7 @@ fFirstTimeInMapScreen = TRUE;
// ------------------------ // ------------------------
if (gGameExternalOptions.fShowCamouflageFaces == TRUE ) if (gGameExternalOptions.fShowCamouflageFaces == TRUE )
{ {
for (int i=0;i<255;i++) for (int i=0;i<NUM_PROFILES;++i)
{ {
gCamoFace[i].gCamoface = FALSE; gCamoFace[i].gCamoface = FALSE;
gCamoFace[i].gUrbanCamoface = FALSE; gCamoFace[i].gUrbanCamoface = FALSE;
@@ -1117,7 +1117,7 @@ void ReStartingGame()
if (gGameExternalOptions.fShowCamouflageFaces == TRUE ) if (gGameExternalOptions.fShowCamouflageFaces == TRUE )
{ {
//Camo Face //Camo Face
for (int i=0;i<255;i++) for (int i=0;i<NUM_PROFILES;++i)
{ {
gCamoFace[i].gCamoface = FALSE; gCamoFace[i].gCamoface = FALSE;
gCamoFace[i].gUrbanCamoface = FALSE; gCamoFace[i].gUrbanCamoface = FALSE;
+9 -9
View File
@@ -5353,9 +5353,9 @@ return 1;
static int l_usStrategicInsertionDataProfileID(lua_State *L) static int l_usStrategicInsertionDataProfileID(lua_State *L)
{ {
BOOLEAN Bool; //BOOLEAN Bool;
SOLDIERTYPE * pSoldier; SOLDIERTYPE * pSoldier;
UINT32 sGridNo = 0; UINT32 sGridNo = 0;
if ( lua_gettop(L) >= 1 ) if ( lua_gettop(L) >= 1 )
{ {
@@ -5363,14 +5363,14 @@ UINT32 sGridNo = 0;
pSoldier = FindSoldierByProfileID( ID, FALSE ); pSoldier = FindSoldierByProfileID( ID, FALSE );
if (pSoldier) if (pSoldier)
{ {
sGridNo = pSoldier->usStrategicInsertionData; sGridNo = pSoldier->usStrategicInsertionData;
} }
lua_pushinteger(L, sGridNo); lua_pushinteger(L, sGridNo);
} }
return 1; return 1;
} }
static int l_bNeutral(lua_State *L) static int l_bNeutral(lua_State *L)
@@ -6719,7 +6719,7 @@ static int l_Action_door_close (lua_State *L)
//action //action
static int l_SetOffBombsByFrequency (lua_State *L) static int l_SetOffBombsByFrequency (lua_State *L)
{ {
SOLDIERTYPE * pSoldier; //SOLDIERTYPE * pSoldier;
if ( lua_gettop(L) >= 2 ) if ( lua_gettop(L) >= 2 )
{ {
@@ -10625,7 +10625,7 @@ static int l_CheckFact (lua_State *L)
ubProfileID = lua_tointeger(L,i); ubProfileID = lua_tointeger(L,i);
} }
if ( ubProfileID != 255 && CheckFact( fact, ubProfileID ) ) if ( ubProfileID != NUM_PROFILES && CheckFact( fact, ubProfileID ) )
{ {
checkfact= TRUE; checkfact= TRUE;
} }
+1 -1
View File
@@ -65,7 +65,7 @@ extern BOOLEAN gfInItemPickupMenu;
RPC_SMALL_FACE_VALUES gRPCSmallFaceValues[200]; RPC_SMALL_FACE_VALUES gRPCSmallFaceValues[200];
UINT8 ubRPCNumSmallFaceValues = 200; UINT8 ubRPCNumSmallFaceValues = 200;
CAMO_FACE gCamoFace[255]; CAMO_FACE gCamoFace[NUM_PROFILES];
FACE_GEAR_VALUES zNewFaceGear[MAXITEMS]; FACE_GEAR_VALUES zNewFaceGear[MAXITEMS];
FACE_GEAR_VALUES zNewFaceGearIMP[MAXITEMS]; FACE_GEAR_VALUES zNewFaceGearIMP[MAXITEMS];
+4 -4
View File
@@ -1151,11 +1151,11 @@ SOLDIERTYPE* TacticalCreateSoldier( SOLDIERCREATE_STRUCT *pCreateStruct, UINT8 *
pSoldier = new SOLDIERTYPE(Soldier); //(SOLDIERTYPE*)MemAlloc( SIZEOF_SOLDIERTYPE ); pSoldier = new SOLDIERTYPE(Soldier); //(SOLDIERTYPE*)MemAlloc( SIZEOF_SOLDIERTYPE );
if( !pSoldier ) if( !pSoldier )
return NULL; return NULL;
pSoldier->ubID = 255; pSoldier->ubID = NUM_PROFILES;
pSoldier->sSectorX = (INT16)SECTORX( ubSectorID ); pSoldier->sSectorX = (INT16)SECTORX( ubSectorID );
pSoldier->sSectorY = (INT16)SECTORY( ubSectorID ); pSoldier->sSectorY = (INT16)SECTORY( ubSectorID );
pSoldier->bSectorZ = 0; pSoldier->bSectorZ = 0;
*pubID = 255; *pubID = NUM_PROFILES;
return pSoldier; return pSoldier;
} }
} }
@@ -2790,7 +2790,7 @@ SOLDIERTYPE* ReserveTacticalSoldierForAutoresolve( UINT8 ubSoldierClass )
return NULL; return NULL;
//Assign a bogus ID, then return it //Assign a bogus ID, then return it
pSoldier->ubID = 255; pSoldier->ubID = NUM_PROFILES;
return pSoldier; return pSoldier;
} }
} }
@@ -2971,7 +2971,7 @@ SOLDIERTYPE* ReserveTacticalMilitiaSoldierForAutoresolve( UINT8 ubSoldierClass )
MercPtrs[i]->bSoldierFlagMask |= SOLDIER_EQUIPMENT_DROPPED; MercPtrs[i]->bSoldierFlagMask |= SOLDIER_EQUIPMENT_DROPPED;
//Assign a bogus ID, then return it //Assign a bogus ID, then return it
pSoldier->ubID = 255; pSoldier->ubID = NUM_PROFILES;
return pSoldier; return pSoldier;
} }
} }
+2 -1
View File
@@ -6,6 +6,7 @@
#define SURPRISED 3 #define SURPRISED 3
#include "soldier control.h" #include "soldier control.h"
#include "soldier profile type.h"
// Defines // Defines
#define NUM_FACE_SLOTS 50 #define NUM_FACE_SLOTS 50
@@ -25,7 +26,7 @@ typedef struct
BOOLEAN gSnowCamoface; BOOLEAN gSnowCamoface;
} CAMO_FACE; } CAMO_FACE;
extern CAMO_FACE gCamoFace[255]; extern CAMO_FACE gCamoFace[NUM_PROFILES];
typedef struct typedef struct
+1 -1
View File
@@ -366,7 +366,7 @@ void InternalIgniteExplosion( UINT8 ubOwner, INT16 sX, INT16 sY, INT16 sZ, INT32
// Flugente: if the explosion occured in a building, this might lower loyalty in town // Flugente: if the explosion occured in a building, this might lower loyalty in town
UINT16 tmp; UINT16 tmp;
if ( Item[ usItem ].usItemClass & IC_EXPLOSV && ubOwner != NOBODY && ubOwner < 255 && InARoom( sGridNo, &tmp ) ) if ( Item[ usItem ].usItemClass & IC_EXPLOSV && ubOwner != NOBODY && ubOwner < NUM_PROFILES && InARoom( sGridNo, &tmp ) )
{ {
HandleLoyaltyForDemolitionOfBuilding( MercPtrs[ubOwner], Explosive[ Item[ usItem ].ubClassIndex ].ubDamage ); HandleLoyaltyForDemolitionOfBuilding( MercPtrs[ubOwner], Explosive[ Item[ usItem ].ubClassIndex ].ubDamage );
} }