mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-25 07:32:27 +01:00
Fixed a bug where the special harcoded keywords that are search for in script RAM calculation would be counted once per 'scope'
This commit is contained in:
parent
ebeb803109
commit
c5841b65fe
@ -507,7 +507,8 @@ let CONSTANTS = {
|
|||||||
"* There is now a setting for enabling/disabling the popup that appears when you are hospitalized<br>" +
|
"* There is now a setting for enabling/disabling the popup that appears when you are hospitalized<br>" +
|
||||||
"* Bug Fix: Stock market should now be correctly initialized in BitNode-8 (by Kline-)<br>" +
|
"* Bug Fix: Stock market should now be correctly initialized in BitNode-8 (by Kline-)<br>" +
|
||||||
"* Bug Fix: bladeburner.getCurrentAction() should now properly an 'Idle' object rather than null (by Kline-)<br>" +
|
"* Bug Fix: bladeburner.getCurrentAction() should now properly an 'Idle' object rather than null (by Kline-)<br>" +
|
||||||
"* Bug Fix: Bladeburner skill cost multiplier should now properly increase in BitNode-12 (by hydroflame)<br>"
|
"* Bug Fix: Bladeburner skill cost multiplier should now properly increase in BitNode-12 (by hydroflame)<br>" +
|
||||||
|
"* Bug Fix: 'document', 'hacknet', and 'window' keywords should no longer be counted multiple times in RAM calculations <br>"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -462,6 +462,18 @@ function parseOnlyRamCalculate(server, code, workerScript) {
|
|||||||
const resolvedRefs = new Set();
|
const resolvedRefs = new Set();
|
||||||
while (unresolvedRefs.length > 0) {
|
while (unresolvedRefs.length > 0) {
|
||||||
const ref = unresolvedRefs.shift();
|
const ref = unresolvedRefs.shift();
|
||||||
|
|
||||||
|
// Check if this is one of the special keys, and add the appropriate ram cost if so.
|
||||||
|
if (ref === "hacknet" && !resolvedRefs.has("hacknet")) {
|
||||||
|
ram += CONSTANTS.ScriptHacknetNodesRamCost;
|
||||||
|
}
|
||||||
|
if (ref === "document" && !resolvedRefs.has("document")) {
|
||||||
|
ram += CONSTANTS.ScriptDomRamCost;
|
||||||
|
}
|
||||||
|
if (ref === "window" && !resolvedRefs.has("window")) {
|
||||||
|
ram += CONSTANTS.ScriptDomRamCost;
|
||||||
|
}
|
||||||
|
|
||||||
resolvedRefs.add(ref);
|
resolvedRefs.add(ref);
|
||||||
|
|
||||||
if (ref.endsWith(".*")) {
|
if (ref.endsWith(".*")) {
|
||||||
@ -479,13 +491,6 @@ function parseOnlyRamCalculate(server, code, workerScript) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if this is one of the special keys, and add the appropriate ram cost if so.
|
|
||||||
if (ref == specialReferenceIF) ram += CONSTANTS.ScriptIfRamCost;
|
|
||||||
if (ref == specialReferenceFOR) ram += CONSTANTS.ScriptForRamCost;
|
|
||||||
if (ref == specialReferenceWHILE) ram += CONSTANTS.ScriptWhileRamCost;
|
|
||||||
if (ref == "hacknet") ram += CONSTANTS.ScriptHacknetNodesRamCost;
|
|
||||||
if (ref == "document" || ref == "window") ram += CONSTANTS.ScriptDomRamCost;
|
|
||||||
|
|
||||||
// Check if this ident is a function in the workerscript env. If it is, then we need to
|
// Check if this ident is a function in the workerscript env. If it is, then we need to
|
||||||
// get its RAM cost. We do this by calling it, which works because the running script
|
// get its RAM cost. We do this by calling it, which works because the running script
|
||||||
// is in checkingRam mode.
|
// is in checkingRam mode.
|
||||||
|
Loading…
Reference in New Issue
Block a user