Petra: assign guards to wonders in wonder games
Patch by Sandarac
Differential Revision: https://code.wildfiregames.com/D140
Description
Description
Details
Details
- Committed
mimo Feb 14 2017, 6:21 PM - Differential Revision
- D140: Petra: assign guards to wonders in wonder games
- Parents
- rP19225: Ensure unique client GUIDs. Patch by sbirmi, fixes #3949.
- Branches
- Unknown
- Tags
- Build Status
Buildable 526 Build 838: Post-Commit Build Jenkins
Event Timeline
Comment Actions
As the patch is basically ok, i've commited it although there are still some points which should be improved as listed below. But these are small changes which i prefer be adressed in a small correction patch to ease the review process.
line 23: it could happen that we start a wonder game with a wonder already built. In such case, we should initialise the criticalEnts (as is done line 77).
line 199 could have a break before
line 217: we could add a new metadata info to keep the id of the criticalEnt to which it should be assigned and use it here. Or maybe even better, in assignGuardToCriticalEnt line 358, break the loop if guardEnt.id() is in data.guards
line 284: assignGuardToCriticalEnt can fail (if the unit can't guard for example). So this function should return true and false, and the following lines done only if true.
same comment for 299
and futhermore, in both cases, what happen if not on same access? the guard does not know to which criticalEnt it has been assigned and once transported, will not necessarily be reaffected to the same criticalEnt, and then the counters will be wrong. (should be adressed by my comment on line 217)
line 399: we don't need to do it every turn, maybe add a playedTurn%something?
/ps/trunk/binaries/data/mods/public/simulation/ai/petra/gameTypeManager.js | ||
---|---|---|
23 | it could happen that we start a wonder game with a wonder. In such case, we should initialise the criticalEnts (as is done line 77) | |
199 | could have a break before that line |