fix (by Sevenfm): some functions ignored the last member of a team

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8629 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
silversurfer
2018-10-16 11:59:54 +00:00
parent 0447130826
commit 54d5bb0317
12 changed files with 22 additions and 22 deletions
+2 -2
View File
@@ -55,8 +55,8 @@
#endif #endif
CHAR8 czVersionNumber[16] = { "Build 18.29.09" }; //YY.MM.DD CHAR8 czVersionNumber[16] = { "Build 18.16.10" }; //YY.MM.DD
CHAR16 zTrackingNumber[16] = { L"Z" }; CHAR16 zTrackingNumber[16] = { L"Z" };
CHAR16 zRevisionNumber[16] = { L"Revision 8625" }; CHAR16 zRevisionNumber[16] = { L"Revision 8629" };
// SAVE_GAME_VERSION is defined in header, change it there // SAVE_GAME_VERSION is defined in header, change it there
+6 -6
View File
@@ -1148,7 +1148,7 @@ BOOLEAN IsAnythingAroundForSoldierToClean( SOLDIERTYPE * pSoldier )
} }
// now the other merc's stuff // now the other merc's stuff
for(UINT8 teamIndex = gTacticalStatus.Team[gbPlayerNum].bFirstID; teamIndex < gTacticalStatus.Team[gbPlayerNum].bLastID; ++teamIndex) for(UINT8 teamIndex = gTacticalStatus.Team[gbPlayerNum].bFirstID; teamIndex <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++teamIndex)
{ {
// Ignore self, mercs in other sectors, etc. // Ignore self, mercs in other sectors, etc.
if (CanCharacterRepairAnotherSoldiersStuff(pSoldier, MercPtrs[teamIndex])) if (CanCharacterRepairAnotherSoldiersStuff(pSoldier, MercPtrs[teamIndex]))
@@ -1263,7 +1263,7 @@ BOOLEAN DoesCharacterHaveAnyItemsToRepair( SOLDIERTYPE *pSoldier, INT8 bHighestP
if ( bHighestPass != - 1 ) if ( bHighestPass != - 1 )
{ {
// now look for items to repair on other mercs // now look for items to repair on other mercs
for( bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop < gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++bLoop ) for( bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++bLoop )
{ {
SOLDIERTYPE* pOtherSoldier = MercPtrs[ bLoop ]; SOLDIERTYPE* pOtherSoldier = MercPtrs[ bLoop ];
@@ -5307,7 +5307,7 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier )
// first our own stuff // first our own stuff
CollectCleanableItems(pSoldier, pSoldier, itemsToClean); CollectCleanableItems(pSoldier, pSoldier, itemsToClean);
// then other mercs' stuff // then other mercs' stuff
for(UINT8 teamIndex = gTacticalStatus.Team[gbPlayerNum].bFirstID; teamIndex < gTacticalStatus.Team[gbPlayerNum].bLastID; ++teamIndex) for(UINT8 teamIndex = gTacticalStatus.Team[gbPlayerNum].bFirstID; teamIndex <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++teamIndex)
{ {
// Ignore self, mercs in other sectors, etc. // Ignore self, mercs in other sectors, etc.
if (CanCharacterRepairAnotherSoldiersStuff(pSoldier, MercPtrs[teamIndex])) if (CanCharacterRepairAnotherSoldiersStuff(pSoldier, MercPtrs[teamIndex]))
@@ -5352,7 +5352,7 @@ void HandleRepairBySoldier( SOLDIERTYPE *pSoldier )
// silversurfer: Looks strange? It's not. This function now needs the guy that does the repairs and the one that owns the stuff. // silversurfer: Looks strange? It's not. This function now needs the guy that does the repairs and the one that owns the stuff.
CollectRepairableItems(pSoldier, pSoldier, itemsToFix); CollectRepairableItems(pSoldier, pSoldier, itemsToFix);
for(UINT8 teamIndex = gTacticalStatus.Team[gbPlayerNum].bFirstID; teamIndex < gTacticalStatus.Team[gbPlayerNum].bLastID; ++teamIndex) for(UINT8 teamIndex = gTacticalStatus.Team[gbPlayerNum].bFirstID; teamIndex <= gTacticalStatus.Team[gbPlayerNum].bLastID; ++teamIndex)
{ {
// Ignore self, mercs in other sectors, etc. // Ignore self, mercs in other sectors, etc.
if (CanCharacterRepairAnotherSoldiersStuff(pSoldier, MercPtrs[teamIndex])) if (CanCharacterRepairAnotherSoldiersStuff(pSoldier, MercPtrs[teamIndex]))
@@ -18708,7 +18708,7 @@ void RepairItemsOnOthers( SOLDIERTYPE *pSoldier, UINT8 *pubRepairPtsLeft )
fSomethingWasRepairedThisPass = FALSE; fSomethingWasRepairedThisPass = FALSE;
// look for jammed guns on other soldiers in sector and unjam them // look for jammed guns on other soldiers in sector and unjam them
for( bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop < gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++bLoop ) for( bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++bLoop )
{ {
pOtherSoldier = MercPtrs[ bLoop ]; pOtherSoldier = MercPtrs[ bLoop ];
@@ -18728,7 +18728,7 @@ void RepairItemsOnOthers( SOLDIERTYPE *pSoldier, UINT8 *pubRepairPtsLeft )
pBestOtherSoldier = NULL; pBestOtherSoldier = NULL;
// now look for items to repair on other mercs // now look for items to repair on other mercs
for( bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop < gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++bLoop ) for( bLoop = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; bLoop <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++bLoop )
{ {
pOtherSoldier = MercPtrs[ bLoop ]; pOtherSoldier = MercPtrs[ bLoop ];
+1 -1
View File
@@ -281,7 +281,7 @@ void UpdateMilitia( MILITIA aMilitia )
SOLDIERTYPE* GetUsedSoldierToIndividualMilitia( UINT32 aMilitiaId ) SOLDIERTYPE* GetUsedSoldierToIndividualMilitia( UINT32 aMilitiaId )
{ {
for ( UINT32 cnt = gTacticalStatus.Team[MILITIA_TEAM].bFirstID; cnt < gTacticalStatus.Team[MILITIA_TEAM].bLastID; ++cnt ) for ( UINT32 cnt = gTacticalStatus.Team[MILITIA_TEAM].bFirstID; cnt <= gTacticalStatus.Team[MILITIA_TEAM].bLastID; ++cnt )
{ {
if ( MercPtrs[cnt] && MercPtrs[cnt]->bActive && MercPtrs[cnt]->usIndividualMilitiaID == aMilitiaId ) if ( MercPtrs[cnt] && MercPtrs[cnt]->bActive && MercPtrs[cnt]->usIndividualMilitiaID == aMilitiaId )
{ {
+2 -2
View File
@@ -221,7 +221,7 @@ BOOLEAN BeginAirRaid( )
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("BeginAirRaid: check for mercs: first id = %d, last id = %d ",gTacticalStatus.Team[ gbPlayerNum ].bFirstID, gTacticalStatus.Team[ gbPlayerNum ].bLastID)); DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("BeginAirRaid: check for mercs: first id = %d, last id = %d ",gTacticalStatus.Team[ gbPlayerNum ].bFirstID, gTacticalStatus.Team[ gbPlayerNum ].bLastID));
cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
for ( cnt = 0, pSoldier = MercPtrs[ cnt ]; cnt < gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++) for ( cnt = 0, pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++)
{ {
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("BeginAirRaid: soldier id = %d, active = %d",pSoldier->ubID,pSoldier->bActive)); DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("BeginAirRaid: soldier id = %d, active = %d",pSoldier->ubID,pSoldier->bActive));
if ( pSoldier->bActive ) if ( pSoldier->bActive )
@@ -1067,7 +1067,7 @@ void HandleAirRaid( )
SOLDIERTYPE * pSoldier; SOLDIERTYPE * pSoldier;
BOOLEAN fOK = FALSE; BOOLEAN fOK = FALSE;
int cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; int cnt = gTacticalStatus.Team[ gbPlayerNum ].bFirstID;
for ( cnt = 0, pSoldier = MercPtrs[ cnt ]; cnt < gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++) for ( cnt = 0, pSoldier = MercPtrs[ cnt ]; cnt <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; cnt++, pSoldier++)
{ {
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleAirRaid: soldier id = %d, active = %d",pSoldier->ubID,pSoldier->bActive)); DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleAirRaid: soldier id = %d, active = %d",pSoldier->ubID,pSoldier->bActive));
if ( pSoldier->bActive ) if ( pSoldier->bActive )
+1 -1
View File
@@ -53,7 +53,7 @@ void ExitBoxing( void )
for( ubPass = 0; ubPass < 2; ++ubPass ) for( ubPass = 0; ubPass < 2; ++ubPass )
{ {
// because boxer could die, loop through all soldier ptrs // because boxer could die, loop through all soldier ptrs
for ( uiLoop = 0; uiLoop < gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++uiLoop ) for ( uiLoop = 0; uiLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++uiLoop )
{ {
pSoldier = MercPtrs[ uiLoop ]; pSoldier = MercPtrs[ uiLoop ];
+1 -1
View File
@@ -3117,7 +3117,7 @@ void HandleDialogueEnd( FACETYPE *pFace )
break; break;
default: default:
// select random enemy, who we see, who sees us and isn't deaf // select random enemy, who we see, who sees us and isn't deaf
for(UINT8 cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; cnt < gTacticalStatus.Team[ ENEMY_TEAM ].bLastID ; cnt++ ) for(UINT8 cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID ; cnt++ )
{ {
if( MercPtrs[cnt] != NULL && MercPtrs[cnt]->aiData.bOppList[pSoldier->ubID] == SEEN_CURRENTLY if( MercPtrs[cnt] != NULL && MercPtrs[cnt]->aiData.bOppList[pSoldier->ubID] == SEEN_CURRENTLY
&& MercPtrs[pSoldier->ubID]->aiData.bOppList[cnt] == SEEN_CURRENTLY && !( MercPtrs[cnt]->bDeafenedCounter > 0 ) ) && MercPtrs[pSoldier->ubID]->aiData.bOppList[cnt] == SEEN_CURRENTLY && !( MercPtrs[cnt]->bDeafenedCounter > 0 ) )
+1 -1
View File
@@ -1685,7 +1685,7 @@ BOOLEAN IsShowOffNearBy( SOLDIERTYPE * pSoldier )
return( FALSE ); return( FALSE );
} }
for ( uiLoop = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; uiLoop < gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; uiLoop++) for ( uiLoop = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; uiLoop <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; uiLoop++)
{ {
pTeammate = MercPtrs[ uiLoop ]; pTeammate = MercPtrs[ uiLoop ];
if ( pTeammate == NULL ) if ( pTeammate == NULL )
+2 -2
View File
@@ -11025,7 +11025,7 @@ UINT8 HighestEnemyOfficersInSector( UINT8& aType )
UINT8 num = 0; UINT8 num = 0;
UINT8 type = OFFICER_NONE; UINT8 type = OFFICER_NONE;
for ( cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID, pSoldier = MercPtrs[cnt]; cnt < gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; pSoldier++, ++cnt ) for ( cnt = gTacticalStatus.Team[ ENEMY_TEAM ].bFirstID, pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[ ENEMY_TEAM ].bLastID; pSoldier++, ++cnt )
{ {
if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 ) if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 )
{ {
@@ -11050,7 +11050,7 @@ UINT16 NumSoldiersWithFlagInSector( UINT8 aTeam, UINT32 aFlag )
INT32 cnt = 0; INT32 cnt = 0;
UINT8 num = 0; UINT8 num = 0;
for ( cnt = gTacticalStatus.Team[aTeam].bFirstID, pSoldier = MercPtrs[cnt]; cnt < gTacticalStatus.Team[aTeam].bLastID; pSoldier++, ++cnt ) for ( cnt = gTacticalStatus.Team[aTeam].bFirstID, pSoldier = MercPtrs[cnt]; cnt <= gTacticalStatus.Team[aTeam].bLastID; pSoldier++, ++cnt )
{ {
if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 ) if ( pSoldier->bActive && pSoldier->bInSector && pSoldier->stats.bLife > 0 )
{ {
+1 -1
View File
@@ -2681,7 +2681,7 @@ INT8 CheckMercsNearForCharTraits( UINT8 ubProfileID, INT8 bCharTraitID )
return( -1 ); return( -1 );
} }
for ( uiLoop = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; uiLoop < gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; uiLoop++) for ( uiLoop = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID; uiLoop <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID; uiLoop++)
{ {
pTeammate = MercPtrs[ uiLoop ]; pTeammate = MercPtrs[ uiLoop ];
if ( pTeammate == NULL ) if ( pTeammate == NULL )
+1 -1
View File
@@ -1171,7 +1171,7 @@ void HandleAllReachAbleItemsInTheSector( INT16 sSectorX, INT16 sSectorY, INT8 bS
{ {
sGridNo2 = gMapInformation.sIsolatedGridNo; sGridNo2 = gMapInformation.sIsolatedGridNo;
for( uiCounter = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; uiCounter < gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++uiCounter ) for( uiCounter = gTacticalStatus.Team[ gbPlayerNum ].bFirstID; uiCounter <= gTacticalStatus.Team[ gbPlayerNum ].bLastID; ++uiCounter )
{ {
pSoldier = MercPtrs[ uiCounter ]; pSoldier = MercPtrs[ uiCounter ];
if ( pSoldier && pSoldier->bActive && pSoldier->stats.bLife > 0 && pSoldier->sSectorX == sSectorX && pSoldier->sSectorY == sSectorY && pSoldier->bSectorZ == bSectorZ ) if ( pSoldier && pSoldier->bActive && pSoldier->stats.bLife > 0 && pSoldier->sSectorX == sSectorX && pSoldier->sSectorY == sSectorY && pSoldier->bSectorZ == bSectorZ )
+1 -1
View File
@@ -7630,7 +7630,7 @@ void CommunicateWatchedLoc( UINT8 ubID, INT32 sGridNo, INT8 bLevel, UINT8 ubPoin
bTeam = MercPtrs[ ubID ]->bTeam; bTeam = MercPtrs[ ubID ]->bTeam;
for ( ubLoop = gTacticalStatus.Team[ bTeam ].bFirstID; ubLoop < gTacticalStatus.Team[ bTeam ].bLastID; ubLoop++ ) for ( ubLoop = gTacticalStatus.Team[ bTeam ].bFirstID; ubLoop <= gTacticalStatus.Team[ bTeam ].bLastID; ubLoop++ )
{ {
if ( ubLoop == ubID || MercPtrs[ ubLoop ]->bActive == FALSE || MercPtrs[ ubLoop ]->bInSector == FALSE || MercPtrs[ ubLoop ]->stats.bLife < OKLIFE ) if ( ubLoop == ubID || MercPtrs[ ubLoop ]->bActive == FALSE || MercPtrs[ ubLoop ]->bInSector == FALSE || MercPtrs[ ubLoop ]->stats.bLife < OKLIFE )
{ {
+3 -3
View File
@@ -3148,7 +3148,7 @@ UINT8 GetClosestFlaggedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 au
INT16 range = aRange; INT16 range = aRange;
// go through each soldier, looking for "friends" (soldiers on same team) // go through each soldier, looking for "friends" (soldiers on same team)
for (uiLoop = gTacticalStatus.Team[ auTeam ].bFirstID; uiLoop < gTacticalStatus.Team[ auTeam ].bLastID; ++uiLoop) for (uiLoop = gTacticalStatus.Team[ auTeam ].bFirstID; uiLoop <= gTacticalStatus.Team[ auTeam ].bLastID; ++uiLoop)
{ {
pFriend = MercPtrs[ uiLoop ]; pFriend = MercPtrs[ uiLoop ];
@@ -3201,7 +3201,7 @@ UINT8 GetClosestWoundedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 au
INT16 range = aRange; INT16 range = aRange;
// go through each soldier, looking for "friends" (soldiers on same team) // go through each soldier, looking for "friends" (soldiers on same team)
for (uiLoop = gTacticalStatus.Team[ auTeam ].bFirstID; uiLoop < gTacticalStatus.Team[ auTeam ].bLastID; ++uiLoop) for (uiLoop = gTacticalStatus.Team[ auTeam ].bFirstID; uiLoop <= gTacticalStatus.Team[ auTeam ].bLastID; ++uiLoop)
{ {
pFriend = MercPtrs[ uiLoop ]; pFriend = MercPtrs[ uiLoop ];
@@ -3250,7 +3250,7 @@ UINT8 GetClosestMedicSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTe
INT16 range = aRange; INT16 range = aRange;
// go through each soldier, looking for "friends" (soldiers on same team) // go through each soldier, looking for "friends" (soldiers on same team)
for (uiLoop = gTacticalStatus.Team[ auTeam ].bFirstID; uiLoop < gTacticalStatus.Team[ auTeam ].bLastID; ++uiLoop) for (uiLoop = gTacticalStatus.Team[ auTeam ].bFirstID; uiLoop <= gTacticalStatus.Team[ auTeam ].bLastID; ++uiLoop)
{ {
pFriend = MercPtrs[ uiLoop ]; pFriend = MercPtrs[ uiLoop ];