Fix formatItemsPerSecond with double = true (#1148)

* Show double flag with items per second being 1

formatItemsPerSecond in utils.js does not indicate two items being processed in a building
if speed is exactly one item per second. That is now fixed.

* Fix code style to fit guidelines
pull/1185/head
TimerErTim 3 years ago committed by GitHub
parent 3363255984
commit b259c7576a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -573,12 +573,14 @@ export function round1DigitLocalized(speed, separator = T.global.decimalSeparato
* @param {string=} separator The decimal separator for numbers like 50.1 (separator='.')
*/
export function formatItemsPerSecond(speed, double = false, separator = T.global.decimalSeparator) {
return speed === 1.0
? T.ingame.buildingPlacement.infoTexts.oneItemPerSecond
: T.ingame.buildingPlacement.infoTexts.itemsPerSecond.replace(
"<x>",
round2Digits(speed).toString().replace(".", separator)
) + (double ? " " + T.ingame.buildingPlacement.infoTexts.itemsPerSecondDouble : "");
return (
(speed === 1.0
? T.ingame.buildingPlacement.infoTexts.oneItemPerSecond
: T.ingame.buildingPlacement.infoTexts.itemsPerSecond.replace(
"<x>",
round2Digits(speed).toString().replace(".", separator)
)) + (double ? "··" + T.ingame.buildingPlacement.infoTexts.itemsPerSecondDouble : "")
);
}
/**

Loading…
Cancel
Save