mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 07:33:48 +01:00
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 ```
This commit is contained in:
parent
04611a30b6
commit
99aeecbd0e
@ -1524,7 +1524,7 @@ export const ns: InternalAPI<NSFull> = {
|
|||||||
return rs.ramUsage;
|
return rs.ramUsage;
|
||||||
}
|
}
|
||||||
const newServerRamUsed = roundToTwo(server.ramUsed + (newRam - rs.ramUsage) * rs.threads);
|
const newServerRamUsed = roundToTwo(server.ramUsed + (newRam - rs.ramUsage) * rs.threads);
|
||||||
if (newServerRamUsed >= server.maxRam) {
|
if (newServerRamUsed > server.maxRam) {
|
||||||
// Can't allocate more RAM.
|
// Can't allocate more RAM.
|
||||||
return rs.ramUsage;
|
return rs.ramUsage;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user