Browse Source

remove RESOURCE_QUANTITY usages

Laserlicht 2 months ago
parent
commit
8f392fcc82
2 changed files with 3 additions and 3 deletions
  1. 1 1
      client/adventureMap/AdventureMapWidget.cpp
  2. 2 2
      client/windows/CCastleInterface.cpp

+ 1 - 1
client/adventureMap/AdventureMapWidget.cpp

@@ -286,7 +286,7 @@ std::shared_ptr<CIntObject> AdventureMapWidget::buildResourceDateBar(const JsonN
 
 	auto result = std::make_shared<CResDataBar>(image, area.topLeft());
 
-	for(auto i = 0; i < GameConstants::RESOURCE_QUANTITY; i++) //TODO: configurable resource support
+	for (auto & i : LIBRARY->resourceTypeHandler->getAllObjects())
 	{
 		const auto & node = input[GameResID(i).toResource()->getJsonKey()];
 

+ 2 - 2
client/windows/CCastleInterface.cpp

@@ -293,7 +293,7 @@ CDwellingInfoBox::CDwellingInfoBox(int centerX, int centerY, const CGTownInstanc
 	available = std::make_shared<CLabel>(80,190, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, LIBRARY->generaltexth->allTexts[217] + text);
 	costPerTroop = std::make_shared<CLabel>(80, 227, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, LIBRARY->generaltexth->allTexts[346]);
 
-	for(int i = 0; i<GameConstants::RESOURCE_QUANTITY; i++) //TODO: configurable resource support
+	for (auto & i : LIBRARY->resourceTypeHandler->getAllObjects())
 	{
 		auto res = static_cast<EGameResID>(i);
 		if(creature->getRecruitCost(res))
@@ -1798,7 +1798,7 @@ CBuildWindow::CBuildWindow(const CGTownInstance *Town, const CBuilding * Buildin
 
 	for(GameResID i : LIBRARY->resourceTypeHandler->getAllObjects())
 	{
-		if(building->resources[i])
+		if(building->resources[i] || i == GameResID(8))
 		{
 			MetaString message;
 			int resourceAmount = GAME->interface()->cb->getResourceAmount(i);