Page MenuHomeWildfire Games

Tag exhausted resource as not available.
ClosedPublic

Authored by fatherbushido on Sep 11 2017, 4:33 PM.

Details

Reviewers
leper
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Commits
rP20193: Tag exhausted resource as not available in ResourceSupply component. Fix #4507.
Trac Tickets
#4507
Summary

Currently IsAvailable returns true when a resource is exhausted (and placed in the destroy queue).
So if UnitAI (or another code) wants to use it meanwhile, we have some issues.
That situation is hard to trigger but anyway the code should do the expected thing.

Test Plan
  • attached test do the job
  • scenario (refs #4507): open the Treasure islands scenario trigger map and use the I am too busy code. Grab the treasure at the top of the island. The victory is sent (it shouldn't be the case). Check it's fixed with the patch.
  • scenario: use P83 and open the Resource demo scenario map. Gather a water treasure on the left near the coast with one foot soldier. Don't use any cheat code. You will see that the treasure is 'gathered' many times. Check it's fixed with the patch.

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

fatherbushido created this revision.Sep 11 2017, 4:33 PM
fatherbushido edited the test plan for this revision. (Show Details)Sep 11 2017, 4:44 PM
fatherbushido edited the test plan for this revision. (Show Details)
Vulcan added a subscriber: Vulcan.Sep 11 2017, 5:26 PM
Executing section Default...
Executing section Source...
Executing section JS...

binaries/data/mods/public/simulation/components/ResourceSupply.js
|  87| »   »   »   »   return·diminishingReturns·==·1·?·1·:·(1.·-·Math.pow(diminishingReturns,·numGatherers))·/·(1.·-·diminishingReturns)·/·numGatherers;
|    | [NORMAL] JSHintBear:
|    | A trailing decimal point can be confused with a dot: '1.'.

binaries/data/mods/public/simulation/components/ResourceSupply.js
|  87| »   »   »   »   return·diminishingReturns·==·1·?·1·:·(1.·-·Math.pow(diminishingReturns,·numGatherers))·/·(1.·-·diminishingReturns)·/·numGatherers;
|    | [NORMAL] JSHintBear:
|    | A trailing decimal point can be confused with a dot: '1.'.
Executing section XML GUI...
Executing section Python...
Executing section Perl...

http://jenkins-master:8080/job/phabricator_lint/518/ 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://jenkins-master:8080/job/phabricator/2018/ for more details.

fatherbushido added a reviewer: Restricted Owners Package.Sep 16 2017, 5:32 PM
leper accepted this revision.Sep 17 2017, 6:49 AM
leper added a subscriber: leper.
leper added inline comments.
binaries/data/mods/public/simulation/components/ResourceSupply.js
126 ↗(On Diff #3638)

Why not just return that? Also why not > 0? (not that it would change anything).

This revision is now accepted and ready to land.Sep 17 2017, 6:49 AM
This revision was automatically updated to reflect the committed changes.
Executing section Default...
Executing section Source...
Executing section JS...
Executing section XML GUI...
Executing section Python...
Executing section Perl...

http://jenkins-master:8080/job/phabricator_lint/529/ for more details.