1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

use toEnum instead of getNum for switch'es

This commit is contained in:
Ivan Savenko 2023-11-03 19:20:25 +02:00
parent f1032063bc
commit 04aeea9b68
6 changed files with 7 additions and 7 deletions

View File

@ -167,7 +167,7 @@ bool CArtifact::isBig() const
bool CArtifact::isTradable() const bool CArtifact::isTradable() const
{ {
switch(id.getNum()) switch(id.toEnum())
{ {
case ArtifactID::SPELLBOOK: case ArtifactID::SPELLBOOK:
case ArtifactID::GRAIL: case ArtifactID::GRAIL:

View File

@ -686,7 +686,7 @@ void CTownHandler::loadBuilding(CTown * town, const std::string & stringID, cons
//MODS COMPATIBILITY FOR 0.96 //MODS COMPATIBILITY FOR 0.96
if(!ret->produce.nonZero()) if(!ret->produce.nonZero())
{ {
switch (ret->bid.getNum()) { switch (ret->bid.toEnum()) {
break; case BuildingID::VILLAGE_HALL: ret->produce[EGameResID::GOLD] = 500; break; case BuildingID::VILLAGE_HALL: ret->produce[EGameResID::GOLD] = 500;
break; case BuildingID::TOWN_HALL : ret->produce[EGameResID::GOLD] = 1000; break; case BuildingID::TOWN_HALL : ret->produce[EGameResID::GOLD] = 1000;
break; case BuildingID::CITY_HALL : ret->produce[EGameResID::GOLD] = 2000; break; case BuildingID::CITY_HALL : ret->produce[EGameResID::GOLD] = 2000;

View File

@ -931,7 +931,7 @@ void CGameState::initMapObjects()
if(!obj) if(!obj)
continue; continue;
switch (obj->ID.getNum()) switch(obj->ID.toEnum())
{ {
case Obj::QUEST_GUARD: case Obj::QUEST_GUARD:
case Obj::SEER_HUT: case Obj::SEER_HUT:

View File

@ -505,7 +505,7 @@ void CPathfinderHelper::updateTurnInfo(const int Turn)
bool CPathfinderHelper::isLayerAvailable(const EPathfindingLayer & layer) const bool CPathfinderHelper::isLayerAvailable(const EPathfindingLayer & layer) const
{ {
switch(layer.getNum()) switch(layer.toEnum())
{ {
case EPathfindingLayer::AIR: case EPathfindingLayer::AIR:
if(!options.useFlying) if(!options.useFlying)

View File

@ -556,7 +556,7 @@ void ObjectManager::placeObject(rmg::Object & object, bool guarded, bool updateD
} }
} }
switch (instance->object().ID.getNum()) switch (instance->object().ID.toEnum())
{ {
case Obj::RANDOM_TREASURE_ART: case Obj::RANDOM_TREASURE_ART:
case Obj::RANDOM_MINOR_ART: //In OH3 quest artifacts have higher value than normal arts case Obj::RANDOM_MINOR_ART: //In OH3 quest artifacts have higher value than normal arts
@ -586,7 +586,7 @@ void ObjectManager::placeObject(rmg::Object & object, bool guarded, bool updateD
case Obj::MONOLITH_ONE_WAY_EXIT: case Obj::MONOLITH_ONE_WAY_EXIT:
*/ */
switch (object.instances().front()->object().ID.getNum()) switch(object.instances().front()->object().ID.toEnum())
{ {
case Obj::WATER_WHEEL: case Obj::WATER_WHEEL:
if (auto* m = zone.getModificator<RiverPlacer>()) if (auto* m = zone.getModificator<RiverPlacer>())

View File

@ -717,7 +717,7 @@ IAdventureSpellMechanics::IAdventureSpellMechanics(const CSpell * s)
std::unique_ptr<IAdventureSpellMechanics> IAdventureSpellMechanics::createMechanics(const CSpell * s) std::unique_ptr<IAdventureSpellMechanics> IAdventureSpellMechanics::createMechanics(const CSpell * s)
{ {
switch (s->id.getNum()) switch(s->id.toEnum())
{ {
case SpellID::SUMMON_BOAT: case SpellID::SUMMON_BOAT:
return std::make_unique<SummonBoatMechanics>(s); return std::make_unique<SummonBoatMechanics>(s);