mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
get rid of few magic numbers (obj types)
This commit is contained in:
parent
399fbb4dfa
commit
889031a95a
@ -519,31 +519,31 @@ std::pair<int,int> CGameState::pickObject (CGObjectInstance *obj)
|
|||||||
{
|
{
|
||||||
switch(obj->ID)
|
switch(obj->ID)
|
||||||
{
|
{
|
||||||
case 65:
|
case Obj::RANDOM_ART:
|
||||||
return std::pair<int,int>(5, VLC->arth->getRandomArt (CArtifact::ART_TREASURE | CArtifact::ART_MINOR | CArtifact::ART_MAJOR | CArtifact::ART_RELIC));
|
return std::pair<int,int>(Obj::ARTIFACT, VLC->arth->getRandomArt (CArtifact::ART_TREASURE | CArtifact::ART_MINOR | CArtifact::ART_MAJOR | CArtifact::ART_RELIC));
|
||||||
case 66: //random treasure artifact
|
case Obj::RANDOM_TREASURE_ART:
|
||||||
return std::pair<int,int>(5, VLC->arth->getRandomArt (CArtifact::ART_TREASURE));
|
return std::pair<int,int>(Obj::ARTIFACT, VLC->arth->getRandomArt (CArtifact::ART_TREASURE));
|
||||||
case 67: //random minor artifact
|
case Obj::RANDOM_MINOR_ART:
|
||||||
return std::pair<int,int>(5, VLC->arth->getRandomArt (CArtifact::ART_MINOR));
|
return std::pair<int,int>(Obj::ARTIFACT, VLC->arth->getRandomArt (CArtifact::ART_MINOR));
|
||||||
case 68: //random major artifact
|
case Obj::RANDOM_MAJOR_ART:
|
||||||
return std::pair<int,int>(5, VLC->arth->getRandomArt (CArtifact::ART_MAJOR));
|
return std::pair<int,int>(Obj::ARTIFACT, VLC->arth->getRandomArt (CArtifact::ART_MAJOR));
|
||||||
case 69: //random relic artifact
|
case Obj::RANDOM_RELIC_ART:
|
||||||
return std::pair<int,int>(5, VLC->arth->getRandomArt (CArtifact::ART_RELIC));
|
return std::pair<int,int>(Obj::ARTIFACT, VLC->arth->getRandomArt (CArtifact::ART_RELIC));
|
||||||
case 70: //random hero
|
case Obj::RANDOM_HERO:
|
||||||
return std::pair<int,int>(Obj::HERO,pickHero(obj->tempOwner));
|
return std::pair<int,int>(Obj::HERO, pickHero(obj->tempOwner));
|
||||||
case 71: //random monster
|
case Obj::RANDOM_MONSTER:
|
||||||
return std::pair<int,int>(54,VLC->creh->pickRandomMonster(boost::ref(ran)));
|
return std::pair<int,int>(Obj::MONSTER, VLC->creh->pickRandomMonster(boost::ref(ran)));
|
||||||
case 72: //random monster lvl1
|
case Obj::RANDOM_MONSTER_L1:
|
||||||
return std::pair<int,int>(54,VLC->creh->pickRandomMonster(boost::ref(ran), 1));
|
return std::pair<int,int>(Obj::MONSTER, VLC->creh->pickRandomMonster(boost::ref(ran), 1));
|
||||||
case 73: //random monster lvl2
|
case Obj::RANDOM_MONSTER_L2:
|
||||||
return std::pair<int,int>(54,VLC->creh->pickRandomMonster(boost::ref(ran), 2));
|
return std::pair<int,int>(Obj::MONSTER, VLC->creh->pickRandomMonster(boost::ref(ran), 2));
|
||||||
case 74: //random monster lvl3
|
case Obj::RANDOM_MONSTER_L3:
|
||||||
return std::pair<int,int>(54,VLC->creh->pickRandomMonster(boost::ref(ran), 3));
|
return std::pair<int,int>(Obj::MONSTER, VLC->creh->pickRandomMonster(boost::ref(ran), 3));
|
||||||
case 75: //random monster lvl4
|
case Obj::RANDOM_MONSTER_L4:
|
||||||
return std::pair<int,int>(54, VLC->creh->pickRandomMonster(boost::ref(ran), 4));
|
return std::pair<int,int>(Obj::MONSTER, VLC->creh->pickRandomMonster(boost::ref(ran), 4));
|
||||||
case 76: //random resource
|
case Obj::RANDOM_RESOURCE:
|
||||||
return std::pair<int,int>(79,ran()%7); //now it's OH3 style, use %8 for mithril
|
return std::pair<int,int>(Obj::RESOURCE,ran()%7); //now it's OH3 style, use %8 for mithril
|
||||||
case 77: //random town
|
case Obj::RANDOM_TOWN:
|
||||||
{
|
{
|
||||||
int align = (static_cast<CGTownInstance*>(obj))->alignment,
|
int align = (static_cast<CGTownInstance*>(obj))->alignment,
|
||||||
f;
|
f;
|
||||||
@ -566,15 +566,15 @@ std::pair<int,int> CGameState::pickObject (CGObjectInstance *obj)
|
|||||||
}
|
}
|
||||||
return std::pair<int,int>(Obj::TOWN,f);
|
return std::pair<int,int>(Obj::TOWN,f);
|
||||||
}
|
}
|
||||||
case 162: //random monster lvl5
|
case Obj::RANDOM_MONSTER_L5:
|
||||||
return std::pair<int,int>(54, VLC->creh->pickRandomMonster(boost::ref(ran), 5));
|
return std::pair<int,int>(Obj::MONSTER, VLC->creh->pickRandomMonster(boost::ref(ran), 5));
|
||||||
case 163: //random monster lvl6
|
case Obj::RANDOM_MONSTER_L6:
|
||||||
return std::pair<int,int>(54, VLC->creh->pickRandomMonster(boost::ref(ran), 6));
|
return std::pair<int,int>(Obj::MONSTER, VLC->creh->pickRandomMonster(boost::ref(ran), 6));
|
||||||
case 164: //random monster lvl7
|
case Obj::RANDOM_MONSTER_L7:
|
||||||
return std::pair<int,int>(54, VLC->creh->pickRandomMonster(boost::ref(ran), 7));
|
return std::pair<int,int>(Obj::MONSTER, VLC->creh->pickRandomMonster(boost::ref(ran), 7));
|
||||||
case 216: //random dwellings
|
case Obj::RANDOM_DWELLING:
|
||||||
case 217:
|
case Obj::RANDOM_DWELLING_LVL:
|
||||||
case 218:
|
case Obj::RANDOM_DWELLING_FACTION:
|
||||||
{
|
{
|
||||||
CGDwelling * dwl = static_cast<CGDwelling*>(obj);
|
CGDwelling * dwl = static_cast<CGDwelling*>(obj);
|
||||||
int faction;
|
int faction;
|
||||||
|
@ -311,6 +311,18 @@ namespace Obj
|
|||||||
PRISON = 62,
|
PRISON = 62,
|
||||||
PYRAMID = 63,
|
PYRAMID = 63,
|
||||||
RALLY_FLAG = 64,
|
RALLY_FLAG = 64,
|
||||||
|
RANDOM_ART = 65,
|
||||||
|
RANDOM_TREASURE_ART = 66,
|
||||||
|
RANDOM_MINOR_ART = 67,
|
||||||
|
RANDOM_MAJOR_ART = 68,
|
||||||
|
RANDOM_RELIC_ART = 69,
|
||||||
|
RANDOM_HERO = 70,
|
||||||
|
RANDOM_MONSTER = 71,
|
||||||
|
RANDOM_MONSTER_L1 = 72,
|
||||||
|
RANDOM_MONSTER_L2 = 73,
|
||||||
|
RANDOM_MONSTER_L3 = 74,
|
||||||
|
RANDOM_MONSTER_L4 = 75,
|
||||||
|
RANDOM_RESOURCE = 76,
|
||||||
RANDOM_TOWN = 77,
|
RANDOM_TOWN = 77,
|
||||||
REFUGEE_CAMP = 78,
|
REFUGEE_CAMP = 78,
|
||||||
RESOURCE = 79,
|
RESOURCE = 79,
|
||||||
@ -344,10 +356,16 @@ namespace Obj
|
|||||||
WHIRLPOOL = 111,
|
WHIRLPOOL = 111,
|
||||||
WINDMILL = 112,
|
WINDMILL = 112,
|
||||||
HOLE = 124,
|
HOLE = 124,
|
||||||
|
RANDOM_MONSTER_L5 = 162,
|
||||||
|
RANDOM_MONSTER_L6 = 163,
|
||||||
|
RANDOM_MONSTER_L7 = 164,
|
||||||
BORDER_GATE = 212,
|
BORDER_GATE = 212,
|
||||||
FREELANCERS_GUILD = 213,
|
FREELANCERS_GUILD = 213,
|
||||||
HERO_PLACEHOLDER = 214,
|
HERO_PLACEHOLDER = 214,
|
||||||
QUEST_GUARD = 215,
|
QUEST_GUARD = 215,
|
||||||
|
RANDOM_DWELLING = 216,
|
||||||
|
RANDOM_DWELLING_LVL = 217, //subtype = creature level
|
||||||
|
RANDOM_DWELLING_FACTION = 218, //subtype = faction
|
||||||
GARRISON2 = 219,
|
GARRISON2 = 219,
|
||||||
ABANDONED_MINE = 220,
|
ABANDONED_MINE = 220,
|
||||||
TRADING_POST_SNOW = 221,
|
TRADING_POST_SNOW = 221,
|
||||||
|
Loading…
Reference in New Issue
Block a user