From 99aeecbd0ebf411486914f5d3d98ce59058567b7 Mon Sep 17 00:00:00 2001 From: Jon Hartnett Date: Wed, 20 Nov 2024 14:47:55 -0600 Subject: [PATCH] BUGFIX: Fix ramOverride check (#1787) ramOverride currently prevents you from actually using exactly all of a server's memory due to a bug in the ram check. Simply replace ">=" with ">" to allow the new ram to equal the max ram. Test script: ```js /** @param {NS} ns */ export async function main(ns) { ns.tprint(ns.ramOverride(8)); } ``` Expected output (on fresh save): ```js 8 ``` Output before this commit: ```js 1.6 ``` --- src/NetscriptFunctions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index c1e55f471..ce1fc8c6b 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -1524,7 +1524,7 @@ export const ns: InternalAPI = { return rs.ramUsage; } const newServerRamUsed = roundToTwo(server.ramUsed + (newRam - rs.ramUsage) * rs.threads); - if (newServerRamUsed >= server.maxRam) { + if (newServerRamUsed > server.maxRam) { // Can't allocate more RAM. return rs.ramUsage; }