Prisoner feature bugfix (#110)

* Allow game to continue after offering to surrender to enemies

* Fix issues related to surrender and POW quests

- Quests were ended prematurely if one had prisoners in both alma and tixa
- Strategic status flags for rescue/escape were not set properly
- Only the maximum amount a prison can hold will be taken as POWs, rest of the mercs will either escape or have to fight to the death, to prevent a player having unrescuable POWs
- Capturing a mercenary had a lot of functions called that should not have been, IF the merc is not going to be captured after all

* Switch all tactical surrender calls to use one unified function

* Only mercs that are capable can escape

Incapacitated mercs left behind will die.
Should probably prioritize incapacitated mercs to be captured by the enemy to prevent needless deaths

* Combine pow quest state changes into one function

* Add JumpIntoEscapedSector to header file

* Allow enemy to demand surrender even if they already have POWs in Tixa and Alma

* Remove surrender from UB

* Address review feedback
This commit is contained in:
Asdow
2023-01-22 23:35:08 +02:00
committed by GitHub
parent 57d2674f37
commit ae1fd0a2ee
21 changed files with 434 additions and 351 deletions
+3 -15
View File
@@ -523,22 +523,10 @@ BOOLEAN SetThisSectorAsEnemyControlled( INT16 sMapX, INT16 sMapY, INT8 bMapZ, BO
UpdateRefuelSiteAvailability( );
}
//shadooow: re-enable quest if player loses control of the N7 prison and quest was disabled previously
if (sMapX == gModSettings.ubMeanwhileInterrogatePOWSectorX && sMapY == gModSettings.ubMeanwhileInterrogatePOWSectorY && gubQuest[QUEST_INTERROGATION] == QUESTCANNOTSTART)
{
gubQuest[QUEST_INTERROGATION] = QUESTNOTSTARTED;
}
//shadooow: re-enable quest if player loses control of the Alma prison and quest was disabled previously
if (sMapX == gModSettings.ubInitialPOWSectorX && sMapY == gModSettings.ubInitialPOWSectorY && gubQuest[QUEST_HELD_IN_ALMA] == QUESTCANNOTSTART)
{
gubQuest[QUEST_HELD_IN_ALMA] = QUESTNOTSTARTED;
}
#ifndef JA2UB
//shadooow: re-enable quest if player loses control of the Tixa prison and quest was disabled previously
if (sMapX == gModSettings.ubTixaPrisonSectorX && sMapY == gModSettings.ubTixaPrisonSectorY && gubQuest[QUEST_HELD_IN_TIXA] == QUESTCANNOTSTART)
{
gubQuest[QUEST_HELD_IN_TIXA] = QUESTNOTSTARTED;
}
HandlePOWQuestState(Q_RESET, QUEST_INTERROGATION, sMapX, sMapY, bMapZ);
HandlePOWQuestState(Q_RESET, QUEST_HELD_IN_ALMA, sMapX, sMapY, bMapZ);
HandlePOWQuestState(Q_RESET, QUEST_HELD_IN_TIXA, sMapX, sMapY, bMapZ);
#endif
// Flugente: reduce workforce
SectorInfo[SECTOR( sMapX, sMapY )].usWorkers = SectorInfo[SECTOR( sMapX, sMapY )].usWorkers * gGameExternalOptions.dInitialWorkerRate;