Details
- Reviewers
Freagarach - Group Reviewers
Restricted Owners Package (Owns No Changed Paths) - Commits
- rP23944: Fix the barter string which were in reversed order.
Check for completeness and correctness.
Diff Detail
- Repository
- rP 0 A.D. Public Repository
- Branch
- /ps/trunk
- Lint
Lint OK - Unit
No Unit Test Coverage - Build Status
Buildable 12519 Build 24053: Vulcan Build Jenkins Build 24052: Vulcan Build (macOS) Jenkins Build 24051: Vulcan Build (Windows) Jenkins Build 24050: arc lint + arc unit
Event Timeline
Successful build - Chance fights ever on the side of the prudent.
Linter detected issues: Executing section Source... Executing section JS... | | [NORMAL] ESLintBear (dot-notation): | | ["sell"] is better written in dot notation. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/Barter.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Barter.js | 95| 95| amountsToSubtract[resourceToSell] = amount; | 96| 96| if (cmpPlayer.TrySubtractResources(amountsToSubtract)) | 97| 97| { | 98| |- var amountToAdd = Math.round(prices["sell"][resourceToSell] / prices["buy"][resourceToBuy] * amount); | | 98|+ var amountToAdd = Math.round(prices.sell[resourceToSell] / prices["buy"][resourceToBuy] * amount); | 99| 99| cmpPlayer.AddResource(resourceToBuy, amountToAdd); | 100| 100| | 101| 101| // Display chat message to observers. | | [NORMAL] ESLintBear (dot-notation): | | ["buy"] is better written in dot notation. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/Barter.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Barter.js | 95| 95| amountsToSubtract[resourceToSell] = amount; | 96| 96| if (cmpPlayer.TrySubtractResources(amountsToSubtract)) | 97| 97| { | 98| |- var amountToAdd = Math.round(prices["sell"][resourceToSell] / prices["buy"][resourceToBuy] * amount); | | 98|+ var amountToAdd = Math.round(prices["sell"][resourceToSell] / prices.buy[resourceToBuy] * amount); | 99| 99| cmpPlayer.AddResource(resourceToBuy, amountToAdd); | 100| 100| | 101| 101| // Display chat message to observers. binaries/data/mods/public/simulation/components/Barter.js | 98| » » var·amountToAdd·=·Math.round(prices["sell"][resourceToSell]·/·prices["buy"][resourceToBuy]·*·amount); | | [NORMAL] JSHintBear: | | ['sell'] is better written in dot notation. binaries/data/mods/public/simulation/components/Barter.js | 98| » » var·amountToAdd·=·Math.round(prices["sell"][resourceToSell]·/·prices["buy"][resourceToBuy]·*·amount); | | [NORMAL] JSHintBear: | | ['buy'] is better written in dot notation. | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /zpool0/trunk/binaries/data/mods/public/gui/session/messages.js | |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/messages.js | 339| 339| let notificationText = | 340| 340| notification.instructions.reduce((instructions, item) => | 341| 341| instructions + (typeof item == "string" ? translate(item) : colorizeHotkey(translate(item.text), item.hotkey)), | 342| |- ""); | | 342|+ ""); | 343| 343| | 344| 344| Engine.GetGUIObjectByName("tutorialText").caption = g_TutorialMessages.concat(setStringTags(notificationText, g_TutorialNewMessageTags)).join("\n"); | 345| 345| g_TutorialMessages.push(notificationText); Executing section cli...
Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2712/display/redirect
binaries/data/mods/public/gui/session/chat/ChatMessageFormatSimulation.js | ||
---|---|---|
38 | You can just switch them here and keep the names, right? |
binaries/data/mods/public/gui/session/chat/ChatMessageFormatSimulation.js | ||
---|---|---|
38 | Yes, I know, but while at it I decided to do a grep and fix the code names as well, because I prefer proper English. |
binaries/data/mods/public/gui/session/chat/ChatMessageFormatSimulation.js | ||
---|---|---|
38 | Understandable, however now this code is out of sync with the msg. |
binaries/data/mods/public/gui/session/chat/ChatMessageFormatSimulation.js | ||
---|---|---|
38 | Is it? |
binaries/data/mods/public/gui/session/chat/ChatMessageFormatSimulation.js | ||
---|---|---|
38 | Well, the message has: msg.resourceSold and the variable was amountsSold. Now the variable name is amountGiven and the message still is msg.resourceSold. It is no big issue, IMHO. I just liked the sold and bought more ^^' However, no need to change if you think that is inferior. Alternatively one could use resource(s)Sold/resource(s)Bought (or given/gained). |
binaries/data/mods/public/gui/session/chat/ChatMessageFormatSimulation.js | ||
---|---|---|
38 | Isn't msg.resourceSold the resource type? The problem is that bartering (anything for anything) is fundamentally different from buying and selling (to and from a single currency). I suppose I could also replace resourceSold and resourceBought with resourceGiven and resourceGained, if you think that's better. |
I did not mean to use the / in the string ^^ Sorry if that was unclear.
binaries/data/mods/public/gui/session/chat/ChatMessageFormatSimulation.js | ||
---|---|---|
38 |
Good to know, thanks :)
That seems to remove any ambiguity? |
Successful build - Chance fights ever on the side of the prudent.
Linter detected issues: Executing section Source... Executing section JS... | | [NORMAL] ESLintBear (dot-notation): | | ["sell"] is better written in dot notation. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/Barter.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Barter.js | 95| 95| amountsToSubtract[resourceToSell] = amount; | 96| 96| if (cmpPlayer.TrySubtractResources(amountsToSubtract)) | 97| 97| { | 98| |- var amountToAdd = Math.round(prices["sell"][resourceToSell] / prices["buy"][resourceToBuy] * amount); | | 98|+ var amountToAdd = Math.round(prices.sell[resourceToSell] / prices["buy"][resourceToBuy] * amount); | 99| 99| cmpPlayer.AddResource(resourceToBuy, amountToAdd); | 100| 100| | 101| 101| // Display chat message to observers. | | [NORMAL] ESLintBear (dot-notation): | | ["buy"] is better written in dot notation. |----| | /zpool0/trunk/binaries/data/mods/public/simulation/components/Barter.js | |++++| /zpool0/trunk/binaries/data/mods/public/simulation/components/Barter.js | 95| 95| amountsToSubtract[resourceToSell] = amount; | 96| 96| if (cmpPlayer.TrySubtractResources(amountsToSubtract)) | 97| 97| { | 98| |- var amountToAdd = Math.round(prices["sell"][resourceToSell] / prices["buy"][resourceToBuy] * amount); | | 98|+ var amountToAdd = Math.round(prices["sell"][resourceToSell] / prices.buy[resourceToBuy] * amount); | 99| 99| cmpPlayer.AddResource(resourceToBuy, amountToAdd); | 100| 100| | 101| 101| // Display chat message to observers. binaries/data/mods/public/simulation/components/Barter.js | 98| » » var·amountToAdd·=·Math.round(prices["sell"][resourceToSell]·/·prices["buy"][resourceToBuy]·*·amount); | | [NORMAL] JSHintBear: | | ['sell'] is better written in dot notation. binaries/data/mods/public/simulation/components/Barter.js | 98| » » var·amountToAdd·=·Math.round(prices["sell"][resourceToSell]·/·prices["buy"][resourceToBuy]·*·amount); | | [NORMAL] JSHintBear: | | ['buy'] is better written in dot notation. | | [NORMAL] ESLintBear (indent): | | Expected indentation of 2 tabs but found 3. |----| | /zpool0/trunk/binaries/data/mods/public/gui/session/messages.js | |++++| /zpool0/trunk/binaries/data/mods/public/gui/session/messages.js | 339| 339| let notificationText = | 340| 340| notification.instructions.reduce((instructions, item) => | 341| 341| instructions + (typeof item == "string" ? translate(item) : colorizeHotkey(translate(item.text), item.hotkey)), | 342| |- ""); | | 342|+ ""); | 343| 343| | 344| 344| Engine.GetGUIObjectByName("tutorialText").caption = g_TutorialMessages.concat(setStringTags(notificationText, g_TutorialNewMessageTags)).join("\n"); | 345| 345| g_TutorialMessages.push(notificationText); Executing section cli...
Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2722/display/redirect
binaries/data/mods/public/gui/session/chat/ChatMessageFormatSimulation.js | ||
---|---|---|
38 | wasn't the idea of the whole diff to use a more clear wording? |
binaries/data/mods/public/gui/session/chat/ChatMessageFormatSimulation.js | ||
---|---|---|
38 | @psypherium pointed out that the current wording is in the wrong order. The ambiguity is that the string uses the “barter” verb but the “purchase” word order. This patch addresses that. | |
38 | You're right e.g. %(player)s converted %(amountGiven)s into %(amountGained)s. or %(player)s gave %(amountGiven)s and gained %(amountGained)s. might be clearer in this particular string. |
binaries/data/mods/public/gui/session/chat/ChatMessageFormatSimulation.js | ||
---|---|---|
38 | Yeah, true. So let's stay with barter. Using the correct word order makes it definitely better :) |