diff --git a/src/004-base/arcologyBuilding.js b/src/004-base/arcologyBuilding.js index 1d399872ecd6458c15d3498fe256564107261df7..70ea4fb08bbcc9e8473a3e14d485b65832f10548 100644 --- a/src/004-base/arcologyBuilding.js +++ b/src/004-base/arcologyBuilding.js @@ -91,29 +91,28 @@ App.Arcology.Cell.BaseCell = class extends App.Entity.Serializable { upgrades.append(this._body()); fragment.append(upgrades); - } - if (this.allowedConversions.length > 0 && this.isBaseType()) { - const p = document.createElement("p"); - if (V.rep < 5000) { - fragment.append(App.UI.DOM.makeElement("p", "You don't have the reputation required to convert the sector base type.")); - } else { - for (const ac of this.allowedConversions) { - const cellClass = eval(`App.Arcology.Cell.${ac}`); - if (!(this instanceof cellClass)) { - p.append(this._makeUpgrade(`Convert sector to ${cellClass.cellName}.`, () => { - const newCell = new cellClass(1); - newCell.allowedConversions = this.allowedConversions; - containingBuilding.replaceCell(this, newCell); - repX(-5000, "capEx"); - }, 50000, "and 5000 reputation as many citizens will lose most of what they own.")); + if (this.allowedConversions.length > 0 && this.isBaseType()) { + const p = document.createElement("p"); + if (V.rep < 5000) { + fragment.append(App.UI.DOM.makeElement("p", "You don't have the reputation required to convert the sector base type.")); + } else { + for (const ac of this.allowedConversions) { + const cellClass = App.Arcology.Cell[ac]; + if (!(this instanceof cellClass)) { + p.append(this._makeUpgrade(`Convert sector to ${cellClass.cellName}.`, () => { + const newCell = new cellClass(1); + newCell.allowedConversions = this.allowedConversions; + containingBuilding.replaceCell(this, newCell); + repX(-5000, "capEx"); + }, 50000, "and 5000 reputation as many citizens will lose most of what they own.")); + } } } + fragment.append(p); } - fragment.append(p); } - return fragment; /** diff --git a/src/arcologyBuilding/presets.js b/src/arcologyBuilding/presets.js index 9e5524ff4c0d47ba5b00a89b03bd4a778fabbf01..ab843f13be0903e8c8b127064f7488c768743c68 100644 --- a/src/arcologyBuilding/presets.js +++ b/src/arcologyBuilding/presets.js @@ -99,7 +99,7 @@ App.Arcology.presets = (function() { /** * @param {string} rowTemplate - * @returns {[App.Arcology.Cell.BaseCell]} + * @returns {App.Arcology.Cell.BaseCell[]} */ function getRow(rowTemplate) { const cells = []; @@ -108,12 +108,12 @@ App.Arcology.presets = (function() { let next = iter.next(); while (!next.done) { if (next.value === "(") { - const cell = charToCell(iter.next().value).cell; next = iter.next(); - while (next.value !== ")") { + const cell = charToCell(next.value).cell; + do { cell.allowedConversions.push(charToCell(next.value).code); next = iter.next(); - } + } while (next.value !== ")"); cells.push(cell); } else if (next.value === "[") { let number = ""; diff --git a/src/gui/tooltips.js b/src/gui/tooltips.js index b821534873d7be11baabcc19c973a73f3067f71d..b3856abfd80ece48bb3af64d7d3712209eda1203 100644 --- a/src/gui/tooltips.js +++ b/src/gui/tooltips.js @@ -32,7 +32,7 @@ }; /** - * @param {HTMLElement} container + * @param {Document|HTMLElement} container */ function addTooltips(container) { if (V.tooltipsEnabled === 0) {