Updated changelog. Fixed dynamic RAM calculation bug.

This commit is contained in:
danielyxie 2018-10-26 15:51:45 -05:00
parent 762726bf53
commit cc0a11bf77
2 changed files with 12 additions and 3 deletions

@ -524,6 +524,7 @@ let CONSTANTS = {
* Crimes commited through Singularity function no longer give half money/exp * Crimes commited through Singularity function no longer give half money/exp
* Improved number formatting for Player 'work' actions (including crimes, etc.). These numbers should also adhere to locale settings now (by Kline-) * Improved number formatting for Player 'work' actions (including crimes, etc.). These numbers should also adhere to locale settings now (by Kline-)
* The order that Augmentations are listed in (when purchasing from Faction and viewing your Augmentations) is now saved and persists when choosing different orders * The order that Augmentations are listed in (when purchasing from Faction and viewing your Augmentations) is now saved and persists when choosing different orders
* getCharacterInformation() Singularity function now returns multiplier information (from Augmentations/Source Files)
* Bug Fix: Calling print() in NetscriptJS no longer brings up the print dialog * Bug Fix: Calling print() in NetscriptJS no longer brings up the print dialog
* Bug Fix: Fixed a bug that sometimes caused a blank black screen when destroying/resetting/switching BitNodes * Bug Fix: Fixed a bug that sometimes caused a blank black screen when destroying/resetting/switching BitNodes
* Bug Fix: Netscript calls that throw errors will now no longer cause the 'concurrent calls' error if they are caught in the script. i.e. try/catch should now work properly in scripts * Bug Fix: Netscript calls that throw errors will now no longer cause the 'concurrent calls' error if they are caught in the script. i.e. try/catch should now work properly in scripts
@ -531,6 +532,7 @@ let CONSTANTS = {
* Bug Fix: Fixed a bug where calling the scp() Netscript function with invalid hostname/ips would throw an unclear error message * Bug Fix: Fixed a bug where calling the scp() Netscript function with invalid hostname/ips would throw an unclear error message
* Bug Fix: Bladeburner API function getActionCountRemaining() should now work properly for BlackOps * Bug Fix: Bladeburner API function getActionCountRemaining() should now work properly for BlackOps
* Bug Fix: Black Ops can no longer be attempted out-of-order or without the required rank via Bladeburner API * Bug Fix: Black Ops can no longer be attempted out-of-order or without the required rank via Bladeburner API
* Bug Fix: Dynamic RAM Calculation now properly accounts for number of threads
* RAM cost for basic Netscript functions added to documentation (by CBJamo) * RAM cost for basic Netscript functions added to documentation (by CBJamo)
` `

@ -156,7 +156,14 @@ function NetscriptFunctions(workerScript) {
var updateDynamicRam = function(fnName, ramCost) { var updateDynamicRam = function(fnName, ramCost) {
if (workerScript.dynamicLoadedFns[fnName]) {return;} if (workerScript.dynamicLoadedFns[fnName]) {return;}
workerScript.dynamicLoadedFns[fnName] = true; workerScript.dynamicLoadedFns[fnName] = true;
workerScript.dynamicRamUsage += ramCost;
const threads = workerScript.scriptRef.threads;
if (typeof threads !== 'number') {
console.warn(`WorkerScript detected NaN for threadcount for ${workerScript.name} on ${workerScript.serverIp}`);
threads = 1;
}
workerScript.dynamicRamUsage += (ramCost * threads);
if (workerScript.dynamicRamUsage > 1.01 * workerScript.ramUsage) { if (workerScript.dynamicRamUsage > 1.01 * workerScript.ramUsage) {
throw makeRuntimeRejectMsg(workerScript, throw makeRuntimeRejectMsg(workerScript,
"Dynamic RAM usage calculated to be greater than initial RAM usage on fn: " + fnName + "Dynamic RAM usage calculated to be greater than initial RAM usage on fn: " + fnName +
@ -2684,7 +2691,7 @@ function NetscriptFunctions(workerScript) {
company: Player.companyName, company: Player.companyName,
factions: Player.factions.slice(), factions: Player.factions.slice(),
jobTitle: companyPositionTitle, jobTitle: companyPositionTitle,
mults: { mult: {
agility: Player.agility_mult, agility: Player.agility_mult,
agilityExp: Player.agility_exp_mult, agilityExp: Player.agility_exp_mult,
companyRep: Player.company_rep_mult, companyRep: Player.company_rep_mult,