fixes issue #498 where retreating from combat in a sector that has a merc
inbound via the airdrop marker causes combat not to end
the reason this fails is that a the inbound soldier counts as being in
the sector being retreated from, even though he isn't
I add a check for `MercPtrs[i]->bInSector` so this doesn't happen
that way the function doesn't leave early and CheckForEndOfCombatMode is
reached
- If we have a sector already loaded (eg. Drassen airport)
- Squad in a different sector encounters enemies and goes to autoresolve
- After pressing DONE in autoresolve screen -> we miss calling the TrashWorld() function in CheckAndHandleUnloadingOfCurrentWorld() due to battle sector not being the same as loaded sector.
- Selected sector gets reset from Drassen airport to invalid values by same function
- Now we have the loaded sector's whole inventory existing in gWorldItems
- Enter any other sector in tactical mode and the gWorldItems gets added into its sector inventory in EnterSector()
Because the TrashItems() work in a way where it only sets gWorldItems elements to not existing if it finds them in a loaded map's structure data, we will pretty much always have that original bugged out set of items present in gWorlItems and they will constantly be added to sector inventories from then on once the bug has been triggered.
* User center insertion point for merc arrival
instead of initial arrival gridno that is meant only for the very first helidrop arrival at the start of a game.
* Prevent possible nullptr dereference
* Use ConvertGridNoToCenterCellXY instead of CenterX & CenterY
* Add direction utility function
We have a lot of places in the code that calculate direction based on center cell coordinates, but lack a utility function for it similar to other direction methods.
* Use utility function for calculating direction
* Use ConvertGridNoToCenterCellXY
* Use utility function for direction
* Use ConvertGridNoToCenterCellXY instead of CenterX & CenterY
* Use ConvertGridNoToCenterCellXY instead of CenterX & CenterY
* Remove CenterX & CenterY functions
Use ConvertGridNoToCenterCellXY instead
* Remove CenterX & CenterY calls from UB configuration
* Address review feedback
* Remove duplicate function
ConvertGridNoToCenterCellXY and ConvertMapPosToWorldTileCenter do the exact same thing
* Use PythSpacesAway instead of GetRangeFromGridNoDiff
Both functions calculate the same thing
* Remove GetRangeFromGridNoDiff
* Remove calls to abs()
The values end up being squared anyways making these unnecessary
* 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
* More unused stuff removal
delete:
- giant 'metaheaders' (JA2 All.h, Laptop All.h, etc), preferring to add #includes directly where needed
- unused ExceptionHandling and DbMan translation units
- unused WizShare.h, Bitmap.h, trle.h, video_private.h headers
* remove mentions from vc proj files too
* remove preprocessor conditionals for unused definitions
find . -iname '*.h' -o -iname '*.cpp' -exec unifdef.exe -m -UPRECOMPILED_HEADERS -UJA2_PRECOMPILED_HEADERS -UWIZ8_PRECOMPILED_HEADERS -UPRECOMPILEDHEADERS {} ';'
then manually fixed a couple files the tool errored out on
* yes, the comments too
as title
- SAM sites are no longer repaired instantly when AI takes control of a sector
- repairs begin 24 hours after the AI takes control, and repeat every 24 hours until the SAM is back at 100%
- repairs can be interrupted by the player regaining control of the SAM site
- time to repair a fully-destroyed SAM site depends on difficulty: novice takes 5 repair cycles, experienced takes 4, expert 3, and insane 2
- moved RepairSamSite() from ASD.h (where it was unused) into strategicmap.h
- this sets up the existing but previously unused strategic event hook EVENT_SAMSITE_REPAIRED
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9349 3b4a5df2-a311-0410-b5c6-a8a6f20db521
Adds timing logs to savegame function, similar to how we already had in loading a save file.
Uses a global struct for unloaded sectors' inventory instead of using map item temp files every time unloaded inventory is accessed.
From timing loading and saving functions with a save that has dozens of sectors with hundreds of items each, saving is a little bit slower than before, because map item temp files have to be written to disk just before the save, when that wasn't the case before (from ~0.3 s -> ~0.5s). It is offset by a decrease in loading a game (from ~1.1s -> 0.745s), once an older save is saved at least once. Any unloaded sector inventory access during gameplay is considerably faster and for example the autoresolve lag when militia is using sector equipment is completely gone for me.
Preserves save game compatibility
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9277 3b4a5df2-a311-0410-b5c6-a8a6f20db521
- new feature: added Tixa as another prison where capture mercs can be held (Alma is still primary choice though)
- fix: all mercs in the map will be taken POW when surrendered, however only 3 will appear in Alma/Tixa/N7, rest will be POW forever without chance of getting free
- fix: whenever player liberates any of the POW sectors (Alma, Tixa, N7) the respective quest/cutscene with POW will be disabled in that sector until enemy recapture the sector
- robot will be destroyed when surrendered as it makes no sense to inprison mechanical units
- externalized the GridNos for freeing POW mercs into Mod_Settings.ini
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@9095 3b4a5df2-a311-0410-b5c6-a8a6f20db521
Added: Right-Click on remove attachments button on sector inventory screen will not empty LBE items in sector
Changed: SLAY_STAYS_FOREVER disables Slay's hourly chance to leave when unattended
Added: SLAY_HOURLY_CHANCE_TO_LEAVE setting to Ja2_Options.ini
Fixed: a bunch of array index out of bounds bugs
Fixed: a bunch of typos in if contitions
Fixed: BuildListFile() function loading items from index 1 instead 0
Added translation: Polish text for some map inventory screen items
Added translation: English texts for new functionality for other language files
Cleaned up some old TODOs
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8404 3b4a5df2-a311-0410-b5c6-a8a6f20db521
- The problem was fixed with the mark of underground sectors on the strategic map (J14-1,K14-1,L15-2,L15-3).
- Fixed the problem with moving from the sector K14-1 to K15-1.
- Procedure HandleMovingTheEnemiesToBeNearPlayerWhenEnteringComplexMap was blocked in the file strategicamp.cpp.
- Added a few new parameters to the file UB_Options.ini
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8096 3b4a5df2-a311-0410-b5c6-a8a6f20db521