Remove slave pool indices and move slave pools to Map objects
In my testing (#5518) this doesn't change the performance much in FCHost or Firefox
Closes #5518
Changes
- Note: Since I am writing this during my final code review the order may be strange as I am making note of the changes as I come along them in tree view order
- Added extensions to the built in Map prototype bringing some of the functionality of Arrays to Maps
- Removed
V.slaveIndices
,V.cribsIndices
, andV.incubator.tankIndices
- Moved
V.slaves
,V.cribs
, andV.incubator.tanks
from Arrays to Maps - Release id bump
- Removed
App.Verify.I.indices()
and all calls to it as it is no longer needed - Removed all direct calls to the slave pools with the exception of legacy BC
- Moved
slaves2indices()
toApp.Update.slaves2indices()
and physically moved it tosrc/data/backwardsCompatibility/backwardsCompatibility.js
as it no longer serves a purpose other than in BC - Replaced all calls to
getSlaves()
and friends inbackwardsCompatibility.js
with direct accesses to the slave pools becausegetSlaves()
and friends no longer return arrays as BC expects, but the old non BCed game state will be an array and needs to go through BC correctly - Removed
App.Facilities.Nursery.cribsToIndices()
and moved its functionality intobackwardsCompatibility.js
- Modified
patch.js
to handle both the old arrays and the new maps - Removed
App.Debug.slaveSummaryText()
as it isn't used anywhere - Added missing type defs and fixed formatting
- Lots and lots of refactoring to best use the fact that our pools are now Maps and the get*() functions now spit out a Map instead of an Array
- Added missing eye side to
getGeneticEyeColor()
call insrc/events/scheduled/seCustomSlaveDelivery.js
- Added logic in
src/facilities/nursery/utils/nurseryUtils.js
to stop it from potentially settingchild.eye.origColor
toundefined
- Removed
App.Facilities.Nursery.cribsToIndices()
,App.Facilities.Nursery.childIndexForID()
, andApp.Facilities.Nursery.removeChild()
- Removed
App.Debug.slavesConsistency()
and its file as it is no longer needed - Added
hasSlave()
,addSlave()
,slaveCount()
,hasInfant()
,addInfant()
,infantCount()
,hasTankSlave()
,addTankSlave()
,tankSlaveCount()
, andallSlaveCount()
- Added some checks into
setEyeColor()
,setEyeColorFull()
, andsetGeneticEyeColor()
TODO
-
Remove array functions -
Slave Sorting -
Handle and test slave ID change in NGP -
Cleanup -
Extensive testing -
AI image archiving (Arcology & Individual) - Should be working but testing was skipped because image archiving is currently broken. See #5574
-
Adding and removing slaves -
Conception and birth -
Slave death -
New game -
Very old save -
Recent save -
NGP
-
-
Final code review and change log
Edited by Frankly George