Page MenuHomeWildfire Games

Fix training tooltip with multiple selection
ClosedPublic

Authored by Imarok on Jan 6 2017, 5:28 PM.

Details

Summary

Training time at general and training costs for units with a training limit > 1 but < ∞ are not displayed correctly, when multiple training entities of the same type are selected.

Test Plan
  • select 1 barrack: train time is 10; select 2 barracks: train time is 18 (should be 10)
  • set hero limit to 7, select two hero train buildings -> the tooltip and button caption shows the costs for only one hero (should be the twice the costs)

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

Imarok updated this revision to Diff 145.Jan 6 2017, 5:28 PM
Imarok retitled this revision from to Fix training tooltip with multiple selection.
Imarok updated this object.
Imarok edited the test plan for this revision. (Show Details)
Imarok added reviewers: Itms, elexis.
Imarok updated the Trac tickets for this revision.
Owners added a subscriber: Restricted Owners Package.Jan 6 2017, 5:28 PM
Vulcan added a subscriber: Vulcan.Jan 6 2017, 6:12 PM

Build is green

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

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

elexis edited edge metadata.Jan 11 2017, 6:23 AM

Rest coming later.

binaries/data/mods/public/gui/session/input.js
1252 ↗(On Diff #145)

Pollutes the logic change, should be done in a separate commit IMO so that changes are self-contained, easier to audit and easier to bisect. Also not sure if we shouldn't feel offended having to review such a simple change

1466 ↗(On Diff #145)

!limits.canBeAddedCount?

1473 ↗(On Diff #145)

Personally I prefer x = max(x, 1)

binaries/data/mods/public/gui/session/selection_panels.js
1030 ↗(On Diff #145)

nooo

Itms edited edge metadata.Jan 14 2017, 8:28 PM

Tested and works!
I don't have anything to add to elexis' review but since he talked about "the rest", you may want to wait for him before fixing the code bits he mentioned.

Imarok edited the test plan for this revision. (Show Details)Jan 17 2017, 11:54 AM
Imarok updated this revision to Diff 268.Jan 17 2017, 12:04 PM
Imarok marked 2 inline comments as done.

Rebase and apply the two changes proposed by elexis

Imarok marked an inline comment as done.Jan 17 2017, 12:05 PM
Imarok added inline comments.
binaries/data/mods/public/gui/session/input.js
1466 ↗(On Diff #145)

Nope, as limits.canBeAddedCount can be 0

Imarok marked an inline comment as done.Jan 17 2017, 12:06 PM

Build is green

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

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

  • Thanks for committing the renames separately in rP19150, makes reading this diff much more enjoyable.
  • De facto broken:
    • Typo: It's Math.max, not max
    • Shows the time of the first selected building when selecting two buildings with different training speeds at each building (for example CC & barracks, or barracks & fort after researching the barracks train time upgrade)
  • De jure broken: No unit test
  • Refs: Encountered #4303 again while increasing the hero limit , but that's also a simulation bug, halfway out of scope.
  • Couldn't find the original revision that introduced the getEntityCostTooltip bug, it's been there since ages, likely since its introduction

If you want to address the newly identified bug in a new diff, tell me then I can accept this one.

binaries/data/mods/public/gui/common/tooltips.js
329 ↗(On Diff #268)

Don't like this ternary. If GetBatchTime returns 0, why would we make it 1?

binaries/data/mods/public/gui/session/input.js
1444 ↗(On Diff #268)

depending on the batch train modifier hotkey?

Imarok planned changes to this revision.Feb 10 2017, 4:56 PM
Imarok added inline comments.Feb 28 2017, 4:34 PM
binaries/data/mods/public/gui/common/tooltips.js
329 ↗(On Diff #268)

no it would be 1, when !entity

Imarok updated this revision to Diff 645.Feb 28 2017, 5:23 PM

Fix max typo and comment. The different training speed bug will not be part of this diff

  • Shows the time of the first selected building when selecting two buildings with different training speeds at each building (for example CC & barracks, or barracks & fort after researching the barracks train time upgrade)

Then the problem arises, which of the two train times we should show: both, the average, the higher one?

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

bb accepted this revision.Apr 3 2017, 2:30 PM
bb added a subscriber: bb.

Patch still apply and works as expected.

binaries/data/mods/public/gui/common/tooltips.js
443 ↗(On Diff #645)

Walls have bad style but out of scope of this diff.

462 ↗(On Diff #645)

All other calls to this function, only have template parameter, so changes complete.

This revision is now accepted and ready to land.Apr 3 2017, 2:30 PM
This revision was automatically updated to reflect the committed changes.
Imarok changed the visibility from "All Users" to "Public (No Login Required)".Mar 10 2019, 11:30 AM