purchaseServer: improved error message for ram > maxRam

This commit is contained in:
lethern 2022-01-19 19:09:33 +01:00 committed by GitHub
parent 1dcae1aeec
commit 61cea12ca2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1631,7 +1631,12 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
const cost = getPurchaseServerCost(ram);
if (cost === Infinity) {
if(ram > getPurchaseServerMaxRam()){
workerScript.log("purchaseServer", () => `Invalid argument: ram='${ram}' must not be greater than getPurchaseServerMaxRam`);
}else{
workerScript.log("purchaseServer", () => `Invalid argument: ram='${ram}' must be a positive power of 2`);
}
return "";
}