Page MenuHomeWildfire Games

petra cleanup
ClosedPublic

Authored by mimo on May 28 2017, 12:43 PM.

Details

Summary

some cleanup following rP19681: code cleanup + distant berries gatherer are reallowed in maps with disabled field and corrals.

Test Plan

mainly code cleanup. The hash value must be identical (except in maps without field and corral)

Event Timeline

mimo created this revision.May 28 2017, 12:43 PM
Vulcan added a subscriber: Vulcan.May 28 2017, 2:42 PM
Executing section Default...
Executing section Source...
Executing section JS...
Executing section XML GUI...
Executing section Python...
Executing section Perl...

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

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/1396/ for more details.

Sandarac added inline comments.
binaries/data/mods/public/simulation/ai/petra/worker.js
44

Perhaps it would be better to include "worker" in this variable name, in order to make it clear what this var is for, as it can be accessed from outside of worker.

But I'm also not sure if this var is needed, as it is only used in the one check at the end of the function, and this whole check here on turnCache.allowDistantFood could be moved below, so it is only done if needed.

484–485

Maybe it is time to rework some of this function to remove these assignments in selection statements, which are bad practice (perhaps not in this diff).

mimo updated this revision to Diff 2305.May 29 2017, 7:13 PM

fix Sandarac comments

mimo added inline comments.May 29 2017, 7:16 PM
binaries/data/mods/public/simulation/ai/petra/worker.js
44

good catch. It is now moved where needed.

484–485

ok done

Sandarac added inline comments.May 29 2017, 7:35 PM
binaries/data/mods/public/simulation/ai/petra/worker.js
558

I was rather thinking of doing (after updating turnCache.allowDistantFood):

if (resource !== "food" || gameState.ai.HQ.turnCache.allowDistantFood)

What do you think?

mimo added inline comments.May 29 2017, 7:55 PM
binaries/data/mods/public/simulation/ai/petra/worker.js
558

Wouldn't that force us to update allowDistantFood in the cache even if no food gatherer at this turn? which does not happen with the current code (although that would be irrelevant for performance, better avoid useless computations).

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/1409/ for more details.

Executing section Default...
Executing section Source...
Executing section JS...
Executing section XML GUI...
Executing section Python...
Executing section Perl...

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

Sandarac accepted this revision.May 29 2017, 8:10 PM

Okay, I think it is good.

binaries/data/mods/public/simulation/ai/petra/worker.js
558

Okay.

This revision is now accepted and ready to land.May 29 2017, 8:10 PM
This revision was automatically updated to reflect the committed changes.