From c656cffed5da62c6d83fee36f480f3ac44827949 Mon Sep 17 00:00:00 2001 From: lalien Date: Wed, 22 Aug 2007 18:29:35 +0000 Subject: [PATCH] - replaced NOBODY with TOTAL_SOLDIERS in range checks (NOBODY definition will be changed from 156 to -1 later) git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1255 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/PATHAI.cpp | 2 +- Tactical/TeamTurns.cpp | 8 ++++---- Tactical/Weapons.cpp | 2 +- Tactical/opplist.cpp | 26 +++++++++++++------------- TacticalAI/PanicButtons.cpp | 2 +- TileEngine/Explosion Control.cpp | 2 +- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Tactical/PATHAI.cpp b/Tactical/PATHAI.cpp index a130feae..1c01abdc 100644 --- a/Tactical/PATHAI.cpp +++ b/Tactical/PATHAI.cpp @@ -1352,7 +1352,7 @@ INT32 FindBestPath(SOLDIERTYPE *s , INT16 sDestination, INT8 ubLevel, INT16 usMo // ATE: ONLY cancel if they are moving..... ubMerc = WhoIsThere2( (UINT16) newLoc, s->bLevel); - if ( ubMerc < NOBODY && ubMerc != s->ubID ) + if ( ubMerc < TOTAL_SOLDIERS && ubMerc != s->ubID ) { // Check for movement.... //if ( fTurnBased || ( (Menptr[ ubMerc ].sFinalDestination == Menptr[ ubMerc ].sGridNo) || (Menptr[ ubMerc ].fDelayedMovement) ) ) diff --git a/Tactical/TeamTurns.cpp b/Tactical/TeamTurns.cpp index ca935958..70801afe 100644 --- a/Tactical/TeamTurns.cpp +++ b/Tactical/TeamTurns.cpp @@ -1155,7 +1155,7 @@ BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT8 ubOpponent return( FALSE ); } - if (ubOpponentID < NOBODY) + if (ubOpponentID < TOTAL_SOLDIERS) { /* // only the OPPONENT'S controller's decision matters @@ -1177,7 +1177,7 @@ BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT8 ubOpponent else // no opponent, so controller of 'ptr' makes the call instead { // ALEX - if (gsWhoThrewRock >= NOBODY) + if (gsWhoThrewRock >= TOTAL_SOLDIERS) { #ifdef BETAVERSION NumMessage("StandardInterruptConditions: ERROR - ubOpponentID is NOBODY, don't know who threw rock, guynum = ",pSoldier->guynum); @@ -1299,7 +1299,7 @@ BOOLEAN StandardInterruptConditionsMet( SOLDIERTYPE * pSoldier, UINT8 ubOpponent ubMinPtsNeeded = AP_CHANGE_FACING; // if the opponent is SOMEBODY - if (ubOpponentID < NOBODY) + if (ubOpponentID < TOTAL_SOLDIERS) { // if the soldiers are on the same side if (pSoldier->bSide == pOpponent->bSide) @@ -2029,7 +2029,7 @@ void ResolveInterruptsVs( SOLDIERTYPE * pSoldier, UINT8 ubInterruptType) } } - if (ubSmallestSlot < NOBODY) + if (ubSmallestSlot < TOTAL_SOLDIERS) { // add this guy to everyone's interrupt queue AddToIntList(ubIntList[ubSmallestSlot],TRUE,TRUE); diff --git a/Tactical/Weapons.cpp b/Tactical/Weapons.cpp index 7613f3a7..e1c486dc 100644 --- a/Tactical/Weapons.cpp +++ b/Tactical/Weapons.cpp @@ -4014,7 +4014,7 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, UINT16 sGridNo, UINT8 ubAimTime // add camo effects #if 0 - if ((victim = WhoIsThere(sGridNo)) < NOBODY) + if ((victim = WhoIsThere(sGridNo)) < TOTAL_SOLDIERS) { // if victim is 5 or more tiles away and camouflaged, reduce diff --git a/Tactical/opplist.cpp b/Tactical/opplist.cpp index 28a49ad7..ef497204 100644 --- a/Tactical/opplist.cpp +++ b/Tactical/opplist.cpp @@ -1690,7 +1690,7 @@ INT16 ManLooksForMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubCall /* - if (ptr->guynum >= NOBODY) + if (ptr->guynum >= TOTAL_SOLDIERS) { #ifdef BETAVERSION NumMessage("ManLooksForMan: ERROR - ptr->guynum = ",ptr->guynum); @@ -1698,7 +1698,7 @@ INT16 ManLooksForMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, UINT8 ubCall return(success); } - if (oppPtr->guynum >= NOBODY) + if (oppPtr->guynum >= TOTAL_SOLDIERS) { #ifdef BETAVERSION NumMessage("ManLooksForMan: ERROR - oppPtr->guynum = ",oppPtr->guynum); @@ -1949,7 +1949,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, INT8 bOldOppList = pSoldier->bOppList[pOpponent->ubID]; DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"ManSeesMan"); - if (pSoldier->ubID >= NOBODY) + if (pSoldier->ubID >= TOTAL_SOLDIERS) { /* #ifdef BETAVERSION @@ -1959,7 +1959,7 @@ void ManSeesMan(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pOpponent, INT16 sOppGridno, return; } - if (pOpponent->ubID >= NOBODY) + if (pOpponent->ubID >= TOTAL_SOLDIERS) { /* #ifdef BETAVERSION @@ -4906,7 +4906,7 @@ void MakeNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrType, } else // EXPECTED noise { - if (ubNoiseMaker < NOBODY) + if (ubNoiseMaker < TOTAL_SOLDIERS) { if (Menptr[ubNoiseMaker].controller == Net.pnum) { @@ -4993,7 +4993,7 @@ void OurNoise( UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrType, // see if anyone actually hears this noise, sees ubNoiseMaker, etc. ProcessNoise(ubNoiseMaker, sGridNo, bLevel, ubTerrType, ubVolume, ubNoiseType); - if ((gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) && (ubNoiseMaker < NOBODY) && !gfDelayResolvingBestSightingDueToDoor ) + if ((gTacticalStatus.uiFlags & TURNBASED) && (gTacticalStatus.uiFlags & INCOMBAT) && (ubNoiseMaker < TOTAL_SOLDIERS) && !gfDelayResolvingBestSightingDueToDoor ) { pSoldier = MercPtrs[ubNoiseMaker]; @@ -5034,7 +5034,7 @@ void TheirNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrType ProcessNoise(ubNoiseMaker,sGridNo,bLevel,ubTerrType,ubVolume,ubNoiseType); // if noiseMaker is SOMEBODY - if (ubNoiseMaker < NOBODY) + if (ubNoiseMaker < TOTAL_SOLDIERS) { /* pSoldier = MercPtrs[ubNoiseMaker]; @@ -5097,7 +5097,7 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrTy // dead noiseMaker is only used here to decide WHICH soldiers HearNoise(). // if noise is made by a person, AND it's not noise from an explosion - if ((ubNoiseMaker < NOBODY) && (ubNoiseType != NOISE_EXPLOSION)) + if ((ubNoiseMaker < TOTAL_SOLDIERS) && (ubNoiseType != NOISE_EXPLOSION)) { // inactive/not in sector/dead soldiers, shouldn't be making noise! if (!Menptr[ubNoiseMaker].bActive || !Menptr[ubNoiseMaker].bInSector || @@ -5175,7 +5175,7 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrTy } // if a the noise maker is a person, not just NOBODY - if (ubNoiseMaker < NOBODY) + if (ubNoiseMaker < TOTAL_SOLDIERS) { // if this team is the same TEAM as the noise maker's // (for now, assume we will report noises by unknown source on same SIDE) @@ -5242,7 +5242,7 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrTy } // if noise was made by a person - if (ubNoiseMaker < NOBODY) + if (ubNoiseMaker < TOTAL_SOLDIERS) { // if noisemaker has been *PUBLICLY* SEEN OR HEARD during THIS TURN if ((gbPublicOpplist[bTeam][ubNoiseMaker] == SEEN_CURRENTLY) || // seen now @@ -5296,7 +5296,7 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrTy } // if a the noise maker is a person, not just NOBODY - if (ubNoiseMaker < NOBODY) + if (ubNoiseMaker < TOTAL_SOLDIERS) { // if this listener can see this noise maker if (pSoldier->bOppList[ubNoiseMaker] == SEEN_CURRENTLY) @@ -5445,7 +5445,7 @@ void ProcessNoise(UINT8 ubNoiseMaker, INT16 sGridNo, INT8 bLevel, UINT8 ubTerrTy // if the listening team is human-controlled AND // the noise's source is another soldier // (computer-controlled teams don't radio or automatically report NOISE) - if (gTacticalStatus.Team[bTeam].bHuman && (ubSource < NOBODY)) + if (gTacticalStatus.Team[bTeam].bHuman && (ubSource < TOTAL_SOLDIERS)) { // if ubNoiseMaker was seen by at least one member of this team if (bSeen) @@ -5742,7 +5742,7 @@ void HearNoise(SOLDIERTYPE *pSoldier, UINT8 ubNoiseMaker, UINT16 sGridNo, INT8 b } // if noise is made by a person - if (ubNoiseMaker < NOBODY) + if (ubNoiseMaker < TOTAL_SOLDIERS) { bOldOpplist = pSoldier->bOppList[ubNoiseMaker]; diff --git a/TacticalAI/PanicButtons.cpp b/TacticalAI/PanicButtons.cpp index f35579ba..3a27277f 100644 --- a/TacticalAI/PanicButtons.cpp +++ b/TacticalAI/PanicButtons.cpp @@ -157,7 +157,7 @@ void MakeClosestEnemyChosenOne() } // if we found have an eligible enemy, make him our "chosen one" - if (ubClosestEnemy < NOBODY) + if (ubClosestEnemy < TOTAL_SOLDIERS) { gTacticalStatus.ubTheChosenOne = ubClosestEnemy; // flag him as the chosen one diff --git a/TileEngine/Explosion Control.cpp b/TileEngine/Explosion Control.cpp index ee54039b..bbee3744 100644 --- a/TileEngine/Explosion Control.cpp +++ b/TileEngine/Explosion Control.cpp @@ -1853,7 +1853,7 @@ BOOLEAN ExpAffect( INT16 sBombGridNo, INT16 sGridNo, UINT32 uiDist, UINT16 usIte } else { - if ( ( ubPerson = WhoIsThere2(sGridNo, bLevel ) ) >= NOBODY ) + if ( ( ubPerson = WhoIsThere2(sGridNo, bLevel ) ) >= TOTAL_SOLDIERS ) { return( fRecompileMovementCosts ); }