mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +02:00
Reduce usage of implicit conversions to int
This commit is contained in:
@@ -953,10 +953,10 @@ bool CVCMIServer::canUseThisHero(PlayerColor player, HeroTypeID ID)
|
||||
if (!ID.hasValue())
|
||||
return false;
|
||||
|
||||
if (ID >= LIBRARY->heroh->size())
|
||||
if (ID.getNum() >= LIBRARY->heroh->size())
|
||||
return false;
|
||||
|
||||
if (si->playerInfos[player].castle != LIBRARY->heroh->objects[ID]->heroClass->faction)
|
||||
if (si->playerInfos[player].castle != ID.toHeroType()->heroClass->faction)
|
||||
return false;
|
||||
|
||||
if (vstd::contains(getUsedHeroes(), ID))
|
||||
@@ -979,7 +979,7 @@ std::vector<HeroTypeID> CVCMIServer::getUsedHeroes()
|
||||
{
|
||||
const auto & heroes = getPlayerInfo(p.first).heroesNames;
|
||||
for(auto & hero : heroes)
|
||||
if(hero.heroId >= 0) //in VCMI map format heroId = -1 means random hero
|
||||
if(hero.heroId.hasValue())
|
||||
heroIds.push_back(hero.heroId);
|
||||
|
||||
if(p.second.hero != HeroTypeID::RANDOM)
|
||||
|
||||
Reference in New Issue
Block a user