1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-23 00:28:08 +02:00

Merge pull request #3037 from Laserlicht/missing_res

This commit is contained in:
Nordsoft91
2023-10-13 10:36:33 +02:00
committed by GitHub
3 changed files with 23 additions and 5 deletions

View File

@ -1477,7 +1477,13 @@ CBuildWindow::CBuildWindow(const CGTownInstance *Town, const CBuilding * Buildin
for(int i = 0; i<GameConstants::RESOURCE_QUANTITY; i++)
{
if(building->resources[i])
components.push_back(std::make_shared<CComponent>(CComponent::resource, i, building->resources[i], CComponent::small));
{
std::string text = std::to_string(building->resources[i]);
int resAfterBuy = LOCPLINT->cb->getResourceAmount(GameResID(i)) - building->resources[i];
if(resAfterBuy < 0 && state != EBuildingState::ALREADY_PRESENT && settings["general"]["enableUiEnhancements"].Bool())
text = "{H3Red|" + std::to_string(LOCPLINT->cb->getResourceAmount(GameResID(i))) + "}" + " / " + text;
components.push_back(std::make_shared<CComponent>(CComponent::resource, i, text, CComponent::small));
}
}
cost = std::make_shared<CComponentBox>(components, Rect(25, 300, pos.w - 50, 130));