Merge pull request #246 from danielyxie/dev

scp Terminal command and Active Scripts UI (hopefully) bug fixes
This commit is contained in:
danielyxie 2018-05-12 20:23:33 -05:00 committed by GitHub
commit ae509cf50d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 580 additions and 589 deletions

419
dist/engine.bundle.js vendored

File diff suppressed because one or more lines are too long

511
dist/tests.bundle.js vendored

File diff suppressed because one or more lines are too long

@ -26,7 +26,6 @@ let ActiveScriptsUI = {};
let ActiveScriptsTasks = []; //Sequentially schedule the creation/deletion of UI elements
function createActiveScriptsServerPanel(server) {
ActiveScriptsTasks.push(function(server) {
let hostname = server.hostname;
var activeScriptsList = document.getElementById("active-scripts-list");
@ -55,13 +54,11 @@ function createActiveScriptsServerPanel(server) {
};
return li;
}.bind(null, server));
}
//Deletes the info for a particular server (Dropdown header + Panel with all info)
//in the Active Scripts page if it exists
function deleteActiveScriptsServerPanel(server) {
ActiveScriptsTasks.push(function(server) {
let hostname = server.hostname;
if (ActiveScriptsUI[hostname] == null) {
console.log("WARNING: Tried to delete non-existent Active Scripts Server panel. Aborting");
@ -77,7 +74,6 @@ function deleteActiveScriptsServerPanel(server) {
removeElement(ActiveScriptsUI[hostname].panel);
removeElement(ActiveScriptsUI[hostname].header);
delete ActiveScriptsUI[hostname];
}.bind(null, server));
}
function addActiveScriptsItem(workerscript) {
@ -87,11 +83,12 @@ function addActiveScriptsItem(workerscript) {
return;
}
let hostname = server.hostname;
ActiveScriptsTasks.push(function(workerscript, hostname) {
if (ActiveScriptsUI[hostname] == null) {
createActiveScriptsServerPanel(server);
}
ActiveScriptsTasks.push(function(workerscript, hostname) {
//Create the unique identifier (key) for this script
var itemNameArray = ["active", "scripts", hostname, workerscript.name];
for (var i = 0; i < workerscript.args.length; ++i) {

@ -1432,7 +1432,7 @@ function NetscriptFunctions(workerScript) {
}
var stock = SymbolToStockMap[symbol];
if (stock == null) {
throw makeRuntimeRejectMsg(workerScript, "Invalid stock symbol passed into getStockPrice()");
throw makeRuntimeRejectMsg(workerScript, "Invalid stock symbol passed into getStockPosition()");
}
return [stock.playerShares, stock.playerAvgPx, stock.playerShortShares, stock.playerAvgShortPx];
},

@ -1379,7 +1379,7 @@ let Terminal = {
return;
}
var scriptname = args[0];
if (!scriptname.endsWith(".lit") && !isScriptFilename(scriptName) &&
if (!scriptname.endsWith(".lit") && !isScriptFilename(scriptname) &&
!scriptname.endsWith(".txt")){
post("Error: scp only works for .script, .txt, and .lit files");
return;