1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

Replace static_cast's of Identifiers with getNum call

This commit is contained in:
Ivan Savenko
2023-11-02 16:56:02 +02:00
parent 8f25f1fd4b
commit 885dce0c27
13 changed files with 23 additions and 36 deletions

View File

@@ -73,13 +73,13 @@ ImagePath CampaignRegions::getBackgroundName() const
Point CampaignRegions::getPosition(CampaignScenarioID which) const
{
auto const & region = regions[static_cast<int>(which)];
auto const & region = regions[which.getNum()];
return Point(region.xpos, region.ypos);
}
ImagePath CampaignRegions::getNameFor(CampaignScenarioID which, int colorIndex, std::string type) const
{
auto const & region = regions[static_cast<int>(which)];
auto const & region = regions[which.getNum()];
static const std::string colors[2][8] =
{
@@ -267,7 +267,7 @@ void CampaignState::setCurrentMapAsConquered(std::vector<CGHeroInstance *> heroe
return a->getHeroStrength() > b->getHeroStrength();
});
logGlobal->info("Scenario %d of campaign %s (%s) has been completed", static_cast<int>(*currentMap), getFilename(), getNameTranslated());
logGlobal->info("Scenario %d of campaign %s (%s) has been completed", currentMap->getNum(), getFilename(), getNameTranslated());
mapsConquered.push_back(*currentMap);
auto reservedHeroes = getReservedHeroes();
@@ -320,7 +320,7 @@ std::unique_ptr<CMap> CampaignState::getMap(CampaignScenarioID scenarioId) const
CMapService mapService;
std::string scenarioName = getFilename().substr(0, getFilename().find('.'));
boost::to_lower(scenarioName);
scenarioName += ':' + std::to_string(static_cast<int>(scenarioId));
scenarioName += ':' + std::to_string(scenarioId.getNum());
const auto & mapContent = mapPieces.find(scenarioId)->second;
return mapService.loadMap(mapContent.data(), mapContent.size(), scenarioName, getModName(), getEncoding());
}
@@ -333,7 +333,7 @@ std::unique_ptr<CMapHeader> CampaignState::getMapHeader(CampaignScenarioID scena
CMapService mapService;
std::string scenarioName = getFilename().substr(0, getFilename().find('.'));
boost::to_lower(scenarioName);
scenarioName += ':' + std::to_string(static_cast<int>(scenarioId));
scenarioName += ':' + std::to_string(scenarioId.getNum());
const auto & mapContent = mapPieces.find(scenarioId)->second;
return mapService.loadMapHeader(mapContent.data(), mapContent.size(), scenarioName, getModName(), getEncoding());
}