Page MenuHomeWildfire Games

Petra: cleanup of the gameTypeManager
ClosedPublic

Authored by Sandarac on Feb 19 2017, 8:14 AM.

Details

Summary

This diff is in response to the comments in rP19226. If a wonder game starts with any wonders already constructed, these will be added to the criticalEnts Map. assignGuardToCriticalEnt will correctly check if the entity passed to it can actually guard, and some other small improvements to the code's quality have been added.

Test Plan

Check to make sure that wonders are still guarded once they are built, and that (in regicide) the AI still assigns guards to the hero unit when it is transported to a different access index.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Sandarac created this revision.Feb 19 2017, 8:14 AM
Sandarac added inline comments.Feb 19 2017, 8:20 AM
binaries/data/mods/public/simulation/ai/petra/gameTypeManager.js
304 ↗(On Diff #545)

Just a white space fix here.

Vulcan added a subscriber: Vulcan.Feb 19 2017, 9:03 AM

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/369/ for more details.

mimo edited edge metadata.Feb 19 2017, 4:48 PM

Thanks for the patch. Looks nearly good.

binaries/data/mods/public/simulation/ai/petra/gameTypeManager.js
191 ↗(On Diff #545)

I think you should add here
if (guardEnt.getMetadata(PlayerID, "guardedEnt")
guardEnt.setMetadata(PlayerID, "guardedEnt", undefined);

382 ↗(On Diff #545)

same remark here, add
if (guardEnt.getMetadata(PlayerID, "guardedEnt")
guardEnt.setMetadata(PlayerID, "guardedEnt", undefined);

389 ↗(On Diff #545)

Shouldn't it return false?

Sandarac marked 3 inline comments as done.Feb 20 2017, 12:08 AM
Sandarac updated this revision to Diff 560.Feb 20 2017, 12:35 AM

Fix typo.

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/375/ for more details.

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (302 tests)..............................................................................................................................................................................................................................................................................................................OK!

http://jw:8080/job/phabricator/376/ for more details.

This revision was automatically updated to reflect the committed changes.