Page MenuHomeWildfire Games

Inform player that second market is too close to setup trade route
Needs ReviewPublic

Authored by Angen on Wed, Sep 11, 9:18 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

Player is not allowed to set trade route between two markets if gain is 0.
But player is not informed why he cannot do that.

This is adding information for the player.

Test Plan

Build 2 markets close to each other.
Set one as origin.
Hover over second and confirm tooltip is displayed.
Confirm that after clicking to that market trade route is not set.

Event Timeline

Angen created this revision.Wed, Sep 11, 9:18 PM
Owners added a subscriber: Restricted Owners Package.Wed, Sep 11, 9:18 PM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/138/display/redirect

Successful build - Chance fights ever on the side of the prudent.

Linter detected issues:
Executing section Source...
Executing section JS...
|    | [NORMAL] ESLintBear (semi):
|    | Missing semicolon.
|----|    | /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
|    |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/unit_actions.js
| 579| 579| 
| 580| 580| 			case "set second":
| 581| 581| 				if (tradingDetails.gain.traderGain == 0) // markets too close
| 582|    |-					tooltip = translate("Market is too close to first one.\nRight-click to cancel setting of trading route.")
|    | 582|+					tooltip = translate("Market is too close to first one.\nRight-click to cancel setting of trading route.");
| 583| 583| 				else
| 584| 584| 					tooltip = translate("Right-click to set as destination trade market.") + "\n" +
| 585| 585| 						sprintf(translate("Gain: %(gain)s"), {

binaries/data/mods/public/gui/session/unit_actions.js
| 557| »   »   »   switch·(tradingDetails.type)
|    | [NORMAL] ESLintBear (default-case):
|    | Expected a default case.

binaries/data/mods/public/gui/session/unit_actions.js
| 582| »   »   »   »   »   tooltip·=·translate("Market·is·too·close·to·first·one.\nRight-click·to·cancel·setting·of·trading·route.")
|    | [NORMAL] JSHintBear:
|    | Missing semicolon.
Executing section cli...

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/647/display/redirect

Freagarach added inline comments.
binaries/data/mods/public/gui/session/unit_actions.js
593

But it still returns true then?

Angen added inline comments.Thu, Sep 12, 7:50 AM
binaries/data/mods/public/gui/session/unit_actions.js
593

yes, esle it would not display.
its similar to trying set the same market twice, it will not do it but to inform player it returns true

Stan added a subscriber: Stan.Thu, Sep 12, 7:53 AM
Stan added inline comments.
binaries/data/mods/public/gui/session/unit_actions.js
582

I believe you can remove 'setting of'

Freagarach added inline comments.Thu, Sep 12, 7:54 AM
binaries/data/mods/public/gui/session/unit_actions.js
593

Okay, but what happens if you return "possible": false here? The icon/tooltip do not show up at all?