Page MenuHomeWildfire Games

petra: fixes in building placement
ClosedPublic

Authored by mimo on Aug 11 2017, 9:54 PM.

Details

Summary

The patch fixes several small flaws:

  • in common-api/map-module.js the computation of the obstruction shape circle was slightly wrong, being sometimes a bit conservative (by one cell). In addition, the circle is now cached, instead of recomputed for each cell.
  • in petra/mapModule.js, the AI applies the minDistance by treating all cells within this distance of previous structures as obstructed. That was too conservative as only the center of the new building should be at minDistance, so now it treats only cells within (minDistance-obstructionRadius) as obstructed.
Test Plan

Check the code and in game that the Ai is never stuck, trying to build undefinitely a structure in an invalid place.

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

mimo created this revision.Aug 11 2017, 9:54 PM
Vulcan added a subscriber: Vulcan.Aug 11 2017, 11:26 PM

Build is green

Updating workspaces.
Build (release)...
Build (debug)...
Running release tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Running debug tests...
Running cxxtest tests (306 tests)..................................................................................................................................................................................................................................................................................................................OK!
Checking XML files...

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

Executing section Default...
Executing section Source...
Executing section JS...

binaries/data/mods/public/simulation/ai/petra/mapModule.js
|  48| »   »   let·isConnected·=·(territoryMap.data[k]·&·m.TERRITORY_BLINKING_MASK)·==·0;
|    | [NORMAL] JSHintBear:
|    | Use '===' to compare with '0'.
Executing section XML GUI...
Executing section Python...
Executing section Perl...

http://jw:8080/job/phabricator_lint/381/ for more details.

This revision was automatically updated to reflect the committed changes.