572
edits
(Pull out functions from GetBuildingTable into helper functions) |
No edit summary |
||
Line 349: | Line 349: | ||
local upgradesFrom = p._GetBuildingDowngrade(building) | local upgradesFrom = p._GetBuildingDowngrade(building) | ||
if upgradesFrom ~= nil then | if upgradesFrom ~= nil then | ||
table.insert(ret, '<br>'..Icons.Icon({upgradesFrom.name, type='building'}) | table.insert(ret, '<br>'..Icons.Icon({upgradesFrom.name, type='building'})) | ||
end | end | ||
-- Cost | -- Cost | ||
local cost = p._GetBuildingBaseCost(building) | local cost = p._GetBuildingBaseCost(building) | ||
table.insert(ret, cost) | table.insert(ret, '<br>'..cost) | ||
-- Upgrades To | -- Upgrades To | ||
Line 488: | Line 488: | ||
local join = _join ~= nil and _join or ', ' | local join = _join ~= nil and _join or ', ' | ||
local cost = {} | local cost = {} | ||
for _, resource in ipairs( | for _, resource in ipairs(building.cost) do | ||
local resource_data = p._GetResourceByID(resource.id) | local resource_data = p._GetResourceByID(resource.id) | ||
table.insert( | table.insert(cost, Icons.Icon({resource_data.name, type='resource', notext=true})..' '..resource.quantity) | ||
end | end | ||
return table.concat(cost, join) | |||
end | end | ||
edits