fix ram miscalc

This commit is contained in:
Olivier Gagnon
2021-10-27 18:55:06 -04:00
parent 4ce0b59310
commit 8ab9a27966
4 changed files with 8 additions and 6 deletions
+2 -1
View File
@@ -114,13 +114,14 @@ function NetscriptFunctions(workerScript: WorkerScript): NS {
threads = 1;
}
workerScript.dynamicRamUsage += ramCost * threads;
workerScript.dynamicRamUsage += ramCost;
if (workerScript.dynamicRamUsage > 1.01 * workerScript.ramUsage) {
throw makeRuntimeRejectMsg(
workerScript,
`Dynamic RAM usage calculated to be greater than initial RAM usage on fn: ${fnName}.
This is probably because you somehow circumvented the static RAM calculation.
Threads: ${threads}
Dynamic RAM Usage: ${numeralWrapper.formatRAM(workerScript.dynamicRamUsage)}
Static RAM Usage: ${numeralWrapper.formatRAM(workerScript.ramUsage)}