Convert gusSelectedSoldier to SoldierID

This commit is contained in:
Asdow
2024-11-15 19:06:34 +02:00
parent e9c8124dc2
commit b98732daa7
30 changed files with 270 additions and 289 deletions
+5 -5
View File
@@ -3993,7 +3993,7 @@ void JumpIntoAdjacentSector( UINT8 ubTacticalDirection, UINT8 ubJumpCode, INT32
// This guy should always be 1 ) selected and 2 ) close enough to exit sector to leave
if ( gusSelectedSoldier != NOBODY )
{
pValidSoldier = MercPtrs[gusSelectedSoldier];
pValidSoldier = gusSelectedSoldier;
ubDirection = GetInsertionDataFromAdjacentMoveDirection( ubTacticalDirection, sAdditionalData );
}
@@ -4839,13 +4839,13 @@ BOOLEAN OKForSectorExit( INT8 bExitDirection, INT32 usAdditionalData, UINT32 *pu
UINT8 ubNumMercs = 0, ubNumEPCs = 0;
UINT8 ubPlayerControllableMercsInSquad = 0;
if ( gusSelectedSoldier == NOBODY )
if ( gusSelectedSoldier >= NOBODY )
{ //must have a selected soldier to be allowed to tactically traverse.
return FALSE;
}
// anv: vehicles can't use inner exit grids
if ( bExitDirection == (-1) && MercPtrs[gusSelectedSoldier]->bAssignment == VEHICLE )
if ( bExitDirection == (-1) && gusSelectedSoldier->bAssignment == VEHICLE )
{
return FALSE;
}
@@ -4959,12 +4959,12 @@ BOOLEAN OKForSectorExit( INT8 bExitDirection, INT32 usAdditionalData, UINT32 *pu
// If we are here, at least one guy is controllable in this sector, at least he can go!
if ( fAtLeastOneMercControllable )
{
ubPlayerControllableMercsInSquad = (UINT8)NumberOfPlayerControllableMercsInSquad( MercPtrs[gusSelectedSoldier]->bAssignment );
ubPlayerControllableMercsInSquad = (UINT8)NumberOfPlayerControllableMercsInSquad( gusSelectedSoldier->bAssignment );
if ( fAtLeastOneMercControllable <= ubPlayerControllableMercsInSquad )
{ //if the selected merc is an EPC and we can only leave with that merc, then prevent it
//as EPCs aren't allowed to leave by themselves. Instead of restricting this in the
//exiting sector gui, we restrict it by explaining it with a message box.
if ( AM_AN_EPC( MercPtrs[gusSelectedSoldier] ) )
if ( AM_AN_EPC( gusSelectedSoldier ) )
{
if ( AM_A_ROBOT( pSoldier ) && !pSoldier->CanRobotBeControlled( ) )
{