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
This commit is contained in:
parent
3363255984
commit
b259c7576a
|
@ -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…
Reference in New Issue