Page MenuHomeWildfire Games

Fix maps with Garrisoned entities (Sicilia Nomad) following rP22991/D2197 and rP16270
Needs ReviewPublic

Authored by elexis on Jan 11 2020, 7:38 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

The Scenario Sicilia Nomad map is the only one that currently uses Garrison property that specifies which starting entities are garrisoned.
The code was introduced in rP16270.
It assigns the object reference from the C++ stored m_InitAttributes in Simulation[2].cpp.
This means the GarrisonHolder will modify that object and every other place that also modifies that object will have that object be modified sneakily.

rP22991/D2197 introduced a deepfreeze for this C++ object to systematically detect such issues and triggered errors in this case.

ERROR: Script message handler OnGlobalEntityRenamed failed
ERROR: Script message handler OnSkirmishReplace failed
ERROR: Script message handler OnSkirmishReplace failed
ERROR: Script message handler OnSkirmishReplace failed
...
ERROR: JavaScript error: simulation/components/GarrisonHolder.js line 630
TypeError: 10 is read-only
  GarrisonHolder.prototype.OnGlobalEntityRenamed@simulation/components/GarrisonHolder.js:630:4
  SkirmishReplacer.prototype.ReplaceEntities@simulation/components/SkirmishReplacer.js:72:1
  SkirmishReplacer.prototype.OnSkirmishReplace@simulation/components/SkirmishReplacer.js:83:2
  PreInitGame@simulation/helpers/InitGame.js:11:2

Leaving the player without starting units.

This iteration of the patch adds a simple clone to avoid the issue.
But it sounds cleaner if the GarrisonHolder component would have a function that consumes the object without modifying it or storing its reference.

Test Plan

The Garrison property can be tested on the map Sicilia Nomad.

Event Timeline

elexis created this revision.Jan 11 2020, 7:38 PM
elexis updated this revision to Diff 10978.Jan 11 2020, 7:42 PM

Actually clone

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/105/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1527/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/1009/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/macos-differential/106/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1528/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/1010/display/redirect