|
|
|
@@ -142,13 +142,18 @@ function displayBuildings() { |
|
|
|
|
|
|
|
let button = document.querySelector("#building-" + key); |
|
|
|
|
|
|
|
document.querySelector("#building-" + key + " > .building-button-name").innerText = value.count + " " + (value.count == 1 ? buildings[key].name : buildings[key].plural); |
|
|
|
document.querySelector("#building-" + key + " > .building-button-cost").innerText = costOfBuilding(key) + " food"; |
|
|
|
let name = document.querySelector("#building-" + key + " > .building-button-name"); |
|
|
|
let cost = document.querySelector("#building-" + key + " > .building-button-cost"); |
|
|
|
|
|
|
|
name.innerText = value.count + " " + (value.count == 1 ? buildings[key].name : buildings[key].plural); |
|
|
|
cost.innerText = render(costOfBuilding(key)) + " food"; |
|
|
|
|
|
|
|
if (costOfBuilding(key) > resources.food) { |
|
|
|
button.classList.add("building-button-disabled"); |
|
|
|
cost.classList.add("building-button-cost-invalid"); |
|
|
|
} else { |
|
|
|
button.classList.remove("building-button-disabled"); |
|
|
|
cost.classList.add("building-button-cost-valid"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|