From f6df107a5550c4357d1531d4173ac6e4d940ad76 Mon Sep 17 00:00:00 2001 From: Arseniy Shestakov Date: Sun, 18 Sep 2016 00:53:37 +0300 Subject: [PATCH] Replace more magic subIDs with readable enums --- lib/mapObjects/CGTownInstance.cpp | 8 ++++---- lib/mapObjects/MiscObjects.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/mapObjects/CGTownInstance.cpp b/lib/mapObjects/CGTownInstance.cpp index 3bb9b51df..61649d4a7 100644 --- a/lib/mapObjects/CGTownInstance.cpp +++ b/lib/mapObjects/CGTownInstance.cpp @@ -618,16 +618,16 @@ void CGTownInstance::initObj(CRandomGenerator & rand) switch (subID) { //add new visitable objects - case 0: + case ETownType::CASTLE: bonusingBuildings.push_back (new COPWBonus(BuildingID::STABLES, this)); break; - case 5: + case ETownType::DUNGEON: bonusingBuildings.push_back (new COPWBonus(BuildingID::MANA_VORTEX, this)); //fallthrough - case 2: case 3: case 6: + case ETownType::TOWER: case ETownType::INFERNO: case ETownType::STRONGHOLD: bonusingBuildings.push_back (new CTownBonus(BuildingID::SPECIAL_4, this)); break; - case 7: + case ETownType::FORTRESS: bonusingBuildings.push_back (new CTownBonus(BuildingID::SPECIAL_1, this)); break; } diff --git a/lib/mapObjects/MiscObjects.cpp b/lib/mapObjects/MiscObjects.cpp index 8da128efa..99f6da188 100644 --- a/lib/mapObjects/MiscObjects.cpp +++ b/lib/mapObjects/MiscObjects.cpp @@ -867,10 +867,10 @@ void CGResource::initObj(CRandomGenerator & rand) { switch(subID) { - case 6: + case Res::GOLD: amount = rand.nextInt(5, 10) * 100; break; - case 0: case 2: + case Res::WOOD: case Res::ORE: amount = rand.nextInt(6, 10); break; default: