Page MenuHomeWildfire Games

Remove the ApplyValueModificationsToPlayer function.
ClosedPublic

Authored by fatherbushido on May 22 2017, 10:13 PM.

Details

Reviewers
bb
Group Reviewers
Restricted Owners Package(Owns No Changed Paths)
Summary

We have currently mainly two functions for taking care of modifications: ApplyValueModificationsToEntity and ApplyValueModificationsToTemplate.
The third one ApplyValueModificationsToPlayer was mainly ApplyValueModificationsToTemplate and is imo useless.
We can call directly ApplyValueModificationsToEntity in all the current use case.

Test Plan

Check completeness.
A quick in game test could consist of checking the wonder aura or the counter espionage tech.

Event Timeline

fatherbushido created this revision.May 22 2017, 10:13 PM

incomplete (I forgot to remove unused code in Player test)

fatherbushido planned changes to this revision.May 22 2017, 10:16 PM

Adapt Player test

Vulcan added a subscriber: Vulcan.May 22 2017, 10:28 PM
Executing section Default...
Executing section Source...
Executing section JS...

binaries/data/mods/public/simulation/components/Player.js
| 134| »   if·(num·!=·0·&&·num·>·(this.GetPopulationLimit()·-·this.GetPopulationCount()))
|    | [NORMAL] JSHintBear:
|    | Use '!==' to compare with '0'.

binaries/data/mods/public/simulation/components/Player.js
| 266| »   »   if·(this.resourceCount[type]·!=·undefined·&&·amounts[type]·>·this.resourceCount[type])
|    | [NORMAL] JSHintBear:
|    | Use '!==' to compare with 'undefined'.

binaries/data/mods/public/simulation/components/Player.js
| 269| »   if·(Object.keys(amountsNeeded).length·==·0)
|    | [NORMAL] JSHintBear:
|    | Use '===' to compare with '0'.

binaries/data/mods/public/simulation/components/Player.js
| 323| »   for·(var·type·in·amounts)
|    | [NORMAL] JSHintBear:
|    | 'type' is already defined.

binaries/data/mods/public/simulation/components/Player.js
| 692| »   return·this.diplomacy[id]·==·0;
|    | [NORMAL] JSHintBear:
|    | Use '===' to compare with '0'.
Executing section Python...
Executing section Perl...

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

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

binaries/data/mods/public/simulation/components/Player.js
| 134| »   if·(num·!=·0·&&·num·>·(this.GetPopulationLimit()·-·this.GetPopulationCount()))
|    | [NORMAL] JSHintBear:
|    | Use '!==' to compare with '0'.

binaries/data/mods/public/simulation/components/Player.js
| 266| »   »   if·(this.resourceCount[type]·!=·undefined·&&·amounts[type]·>·this.resourceCount[type])
|    | [NORMAL] JSHintBear:
|    | Use '!==' to compare with 'undefined'.

binaries/data/mods/public/simulation/components/Player.js
| 269| »   if·(Object.keys(amountsNeeded).length·==·0)
|    | [NORMAL] JSHintBear:
|    | Use '===' to compare with '0'.

binaries/data/mods/public/simulation/components/Player.js
| 323| »   for·(var·type·in·amounts)
|    | [NORMAL] JSHintBear:
|    | 'type' is already defined.

binaries/data/mods/public/simulation/components/Player.js
| 692| »   return·this.diplomacy[id]·==·0;
|    | [NORMAL] JSHintBear:
|    | Use '===' to compare with '0'.
Executing section Python...
Executing section Perl...

http://jw:8080/job/phabricator_lint/14/ 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!

http://jw:8080/job/phabricator/1317/ 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!

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

fatherbushido added a reviewer: Restricted Owners Package.May 30 2017, 10:32 PM
bb accepted this revision as: bb.Jul 11 2017, 11:56 AM
bb added a subscriber: bb.

function indeed deprecated since the other functions can perform the current use cases and new usecases can always be covered by the template function.

All instances of the function are removed and front doesn't fall of when ingame testing.

GetMaxPop() is (indirectly) tested in the unit test.

binaries/data/mods/public/simulation/components/tests/test_Player.js
31

seems unused already

This revision is now accepted and ready to land.Jul 11 2017, 11:56 AM