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

Deprecating enum constants

This commit is contained in:
nordsoft 2023-05-01 15:29:56 +04:00 committed by Nordsoft91
parent 32277a007d
commit eb577a03b5
4 changed files with 26 additions and 19 deletions

View File

@ -298,6 +298,12 @@ int RewardEvaluator::getGoldCost(const CGObjectInstance * target, const CGHeroIn
if(!target)
return 0;
if(auto * m = dynamic_cast<const IMarket *>(target))
{
if(m->allowsTrade(EMarketMode::RESOURCE_SKILL))
return 2000;
}
switch(target->ID)
{
case Obj::HILL_FORT:
@ -305,8 +311,6 @@ int RewardEvaluator::getGoldCost(const CGObjectInstance * target, const CGHeroIn
case Obj::SCHOOL_OF_MAGIC:
case Obj::SCHOOL_OF_WAR:
return 1000;
case Obj::UNIVERSITY:
return 2000;
case Obj::CREATURE_GENERATOR1:
case Obj::CREATURE_GENERATOR2:
case Obj::CREATURE_GENERATOR3:

View File

@ -131,13 +131,16 @@ TSubgoal CollectRes::whatToDoToTrade()
std::vector<const CGObjectInstance *> visObjs;
ai->retrieveVisitableObjs(visObjs, true);
for (const CGObjectInstance * obj : visObjs)
for(const CGObjectInstance * obj : visObjs)
{
if (const IMarket * m = IMarket::castFrom(obj, false))
if(const IMarket * m = IMarket::castFrom(obj, false); m->allowsTrade(EMarketMode::RESOURCE_RESOURCE))
{
if (obj->ID == Obj::TOWN && obj->tempOwner == ai->playerID && m->allowsTrade(EMarketMode::RESOURCE_RESOURCE))
markets.push_back(m);
else if (obj->ID == Obj::TRADING_POST)
if(obj->ID == Obj::TOWN)
{
if(obj->tempOwner == ai->playerID)
markets.push_back(m);
}
else
markets.push_back(m);
}
}

View File

@ -15,7 +15,7 @@
},
"altarOfSacrifice" : {
"index" :2,
"index" :2, //deprecated
"handler" : "market",
"base" : {
"sounds" : {
@ -36,7 +36,7 @@
}
},
"tradingPost" : {
"index" :221,
"index" :221, //deprecated
"handler" : "market",
"base" : {
"sounds" : {
@ -60,7 +60,7 @@
}
},
"tradingPostDUPLICATE" : {
"index" :99,
"index" :99, //deprecated
"handler" : "market",
"base" : {
"sounds" : {
@ -84,7 +84,7 @@
}
},
"freelancersGuild" : {
"index" :213,
"index" :213, //deprecated
"handler" : "market",
"types" : {
"object" : {
@ -101,7 +101,7 @@
},
"blackMarket" : {
"index" :7,
"index" :7, //deprecated
"handler" : "market",
"base" : {
"sounds" : {
@ -545,7 +545,7 @@
}
},
"university" : {
"index" :104,
"index" :104, //deprecated
"handler" : "market",
"base" : {
"sounds" : {

View File

@ -763,12 +763,12 @@ public:
enum EObj
{
NO_OBJ = -1,
ALTAR_OF_SACRIFICE = 2,
ALTAR_OF_SACRIFICE [[deprecated]] = 2,
ANCHOR_POINT = 3,
ARENA = 4,
ARTIFACT = 5,
PANDORAS_BOX = 6,
BLACK_MARKET = 7,
BLACK_MARKET [[deprecated]] = 7,
BOAT = 8,
BORDERGUARD = 9,
KEYMASTER = 10,
@ -860,12 +860,12 @@ public:
TEMPLE = 96,
DEN_OF_THIEVES = 97,
TOWN = 98,
TRADING_POST = 99,
TRADING_POST [[deprecated]] = 99,
LEARNING_STONE = 100,
TREASURE_CHEST = 101,
TREE_OF_KNOWLEDGE = 102,
SUBTERRANEAN_GATE = 103,
UNIVERSITY = 104,
UNIVERSITY [[deprecated]] = 104,
WAGON = 105,
WAR_MACHINE_FACTORY = 106,
SCHOOL_OF_WAR = 107,
@ -880,7 +880,7 @@ public:
RANDOM_MONSTER_L6 = 163,
RANDOM_MONSTER_L7 = 164,
BORDER_GATE = 212,
FREELANCERS_GUILD = 213,
FREELANCERS_GUILD [[deprecated]] = 213,
HERO_PLACEHOLDER = 214,
QUEST_GUARD = 215,
RANDOM_DWELLING = 216,
@ -888,7 +888,7 @@ public:
RANDOM_DWELLING_FACTION = 218, //subtype = faction
GARRISON2 = 219,
ABANDONED_MINE = 220,
TRADING_POST_SNOW = 221,
TRADING_POST_SNOW [[deprecated]] = 221,
CLOVER_FIELD = 222,
CURSED_GROUND2 = 223,
EVIL_FOG = 224,