1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Get rid of performance warning, refactor roman numbers, mark balancers, rebalance upgrades

This commit is contained in:
tobspr
2020-10-07 18:35:03 +02:00
parent f3dcdeb2b8
commit 1bb8b6f079
19 changed files with 50 additions and 29 deletions

View File

@@ -1,4 +1,6 @@
/* typehints:start */
import { Application } from "../application";
/* typehints:end */
import { IS_MAC } from "./config";
import { ExplainedResult } from "./explained_result";
import { queryParamOptions } from "./query_parameters";

View File

@@ -713,3 +713,40 @@ export function startFileChoose(acceptedType = ".bin") {
input.click();
});
}
const romanLiterals = [
"0", // NULL
"I",
"II",
"III",
"IV",
"V",
"VI",
"VII",
"VIII",
"IX",
"X",
"XI",
"XII",
"XIII",
"XIV",
"XV",
"XVI",
"XVII",
"XVIII",
"XIX",
"XX",
];
/**
*
* @param {number} number
* @returns {string}
*/
export function getRomanNumber(number) {
number = Math.max(0, Math.round(number));
if (number < romanLiterals.length) {
return romanLiterals[number];
}
return String(number);
}