diff --git a/src/data/backwardsCompatibility/backwardsCompatibility.js b/src/data/backwardsCompatibility/backwardsCompatibility.js index 04d6d2777246e82192e48f58c270d9002bc3c1c6..4de63106c8ec371cda5c496208401f4a48f2f2a5 100644 --- a/src/data/backwardsCompatibility/backwardsCompatibility.js +++ b/src/data/backwardsCompatibility/backwardsCompatibility.js @@ -895,6 +895,20 @@ App.Update.globalVariables = function() { // Corp { + // move from "V.corpDivArcade" format to "V.corp.DivArcade" (put corp into one object) + for (let variable in State.variables) { + if (variable.startsWith('corp')) { + console.log ("Corp: moving V." + variable, V[variable], "to V.corp." + variable.slice(4)); + if (Array.isArray(V[variable])){ + V.corp[variable.slice(4)] = Array.from(V[variable]); + } else if (typeof V[variable] === "object" && typeof V[variable] !== undefined) { + V.corp[variable.slice(4)] = {}; + Object.assign(V.corp[variable.slice(4)], V[variable]); + } else { + V.corp[variable.slice(4)] = V[variable]; + } + } + } App.Corporate.Backcompat(); /* Corporation variables added*/ if (V.corp.ExpandToken > 1) { @@ -915,13 +929,6 @@ App.Update.globalVariables = function() { } } } - // move from "V.corpDivArcade" format to "V.corp.DivArcade" (put corp into one object) - for (let variable in State.Variables ) { - if (variable.startsWith('corp')) { - console.log ("Corp: moving V.", variable, "to V.corp.", variable.slice(4)); - V.corp[variable.slice(4)] = V[variable]; - } - } } // Organs