Update Scheduling.cpp

This commit is contained in:
Asdow
2024-11-18 17:34:41 +02:00
parent f49013307f
commit fa56a7ad6d
+16 -16
View File
@@ -190,7 +190,7 @@ void ProcessTacticalSchedule( UINT8 ubScheduleID )
} }
//Validate the existance of the soldier. //Validate the existance of the soldier.
pSoldier = MercPtrs[ pSchedule->ubSoldierID ]; pSoldier = pSchedule->ubSoldierID;
if ( pSoldier->stats.bLife < OKLIFE ) if ( pSoldier->stats.bLife < OKLIFE )
{ {
// dead or dying! // dead or dying!
@@ -331,7 +331,7 @@ void PrepareSchedulesForEditorEntry()
prev->next = curr->next; prev->next = curr->next;
else else
gpScheduleList = gpScheduleList->next; gpScheduleList = gpScheduleList->next;
MercPtrs[ curr->ubSoldierID ]->ubScheduleID = 0; curr->ubSoldierID->ubScheduleID = 0;
temp = curr; temp = curr;
curr = curr->next; curr = curr->next;
MemFree( temp ); MemFree( temp );
@@ -653,11 +653,11 @@ BOOLEAN SortSchedule( SCHEDULENODE *pSchedule )
BOOLEAN BumpAnyExistingMerc( INT32 sGridNo ) BOOLEAN BumpAnyExistingMerc( INT32 sGridNo )
{ {
UINT16 ubID; SoldierID ubID;
SOLDIERTYPE * pSoldier; // NB this is the person already in the location, SOLDIERTYPE *pSoldier; // NB this is the person already in the location,
INT32 sNewGridNo; INT32 sNewGridNo;
UINT8 ubDir; UINT8 ubDir;
INT16 sCellX, sCellY; INT16 sCellX, sCellY;
// this is for autoprocessing schedules... // this is for autoprocessing schedules...
// there could be someone in the destination location, in which case // there could be someone in the destination location, in which case
@@ -675,7 +675,7 @@ BOOLEAN BumpAnyExistingMerc( INT32 sGridNo )
return( TRUE ); return( TRUE );
} }
pSoldier = MercPtrs[ ubID ]; pSoldier = ubID;
// what if the existing merc is prone? // what if the existing merc is prone?
sNewGridNo = FindGridNoFromSweetSpotWithStructDataFromSoldier( pSoldier, STANDING, 5, &ubDir, 1, pSoldier ); sNewGridNo = FindGridNoFromSweetSpotWithStructDataFromSoldier( pSoldier, STANDING, 5, &ubDir, 1, pSoldier );
@@ -707,7 +707,7 @@ void AutoProcessSchedule( SCHEDULENODE *pSchedule, INT32 index )
return; return;
} }
pSoldier = MercPtrs[ pSchedule->ubSoldierID ]; pSoldier = pSchedule->ubSoldierID;
if (pSoldier->ubID == 0) if (pSoldier->ubID == 0)
{ {
@@ -1381,16 +1381,16 @@ void ReplaceSleepSpot( SCHEDULENODE * pSchedule, UINT16 usNewSpot )
void SecureSleepSpot( SOLDIERTYPE * pSoldier, UINT32 usSleepSpot ) void SecureSleepSpot( SOLDIERTYPE * pSoldier, UINT32 usSleepSpot )
{ {
SOLDIERTYPE * pSoldier2; SOLDIERTYPE *pSoldier2;
UINT32 usSleepSpot2; UINT32 usSleepSpot2;
UINT32 uiLoop; SoldierID uiLoop;
SCHEDULENODE * pSchedule; SCHEDULENODE *pSchedule;
UINT8 ubDirection; UINT8 ubDirection;
// start after this soldier's ID so we don't duplicate work done in previous passes // start after this soldier's ID so we don't duplicate work done in previous passes
for ( uiLoop = pSoldier->ubID + 1; uiLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; uiLoop++ ) for ( uiLoop = pSoldier->ubID + 1; uiLoop <= gTacticalStatus.Team[ CIV_TEAM ].bLastID; ++uiLoop )
{ {
pSoldier2 = MercPtrs[ uiLoop ]; pSoldier2 = uiLoop;
if ( pSoldier2->bActive && pSoldier2->bInSector && pSoldier2->ubScheduleID != 0 ) if ( pSoldier2->bActive && pSoldier2->bInSector && pSoldier2->ubScheduleID != 0 )
{ {
pSchedule = GetSchedule( pSoldier2->ubScheduleID ); pSchedule = GetSchedule( pSoldier2->ubScheduleID );