mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-20 20:23:03 +02:00
Converted (almost) all namespace enum's to enum classes
This commit is contained in:
parent
62cd8b12d4
commit
0240ee886d
@ -357,7 +357,7 @@ int64_t BattleExchangeEvaluator::calculateExchange(
|
|||||||
|
|
||||||
if(cb->battleGetMySide() == BattlePerspective::LEFT_SIDE
|
if(cb->battleGetMySide() == BattlePerspective::LEFT_SIDE
|
||||||
&& cb->battleGetGateState() == EGateState::BLOCKED
|
&& cb->battleGetGateState() == EGateState::BLOCKED
|
||||||
&& ap.attack.defender->coversPos(ESiegeHex::GATE_BRIDGE))
|
&& ap.attack.defender->coversPos(BattleHex::GATE_BRIDGE))
|
||||||
{
|
{
|
||||||
return EvaluationResult::INEFFECTIVE_SCORE;
|
return EvaluationResult::INEFFECTIVE_SCORE;
|
||||||
}
|
}
|
||||||
|
@ -773,7 +773,7 @@ void AIGateway::makeTurn()
|
|||||||
{
|
{
|
||||||
MAKING_TURN;
|
MAKING_TURN;
|
||||||
|
|
||||||
auto day = cb->getDate(Date::EDateType::DAY);
|
auto day = cb->getDate(Date::DAY);
|
||||||
logAi->info("Player %d (%s) starting turn, day %d", playerID, playerID.getStr(), day);
|
logAi->info("Player %d (%s) starting turn, day %d", playerID, playerID.getStr(), day);
|
||||||
|
|
||||||
boost::shared_lock<boost::shared_mutex> gsLock(CGameState::mutex);
|
boost::shared_lock<boost::shared_mutex> gsLock(CGameState::mutex);
|
||||||
|
@ -160,7 +160,7 @@ void BuildAnalyzer::update()
|
|||||||
|
|
||||||
updateDailyIncome();
|
updateDailyIncome();
|
||||||
|
|
||||||
if(ai->cb->getDate(Date::EDateType::DAY) == 1)
|
if(ai->cb->getDate(Date::DAY) == 1)
|
||||||
{
|
{
|
||||||
goldPreasure = 1;
|
goldPreasure = 1;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ bool BuildingManager::tryBuildThisStructure(const CGTownInstance * t, BuildingID
|
|||||||
|
|
||||||
for (BuildingID buildID : toBuild)
|
for (BuildingID buildID : toBuild)
|
||||||
{
|
{
|
||||||
EBuildingState::EBuildingState canBuild = cb->canBuildStructure(t, buildID);
|
EBuildingState canBuild = cb->canBuildStructure(t, buildID);
|
||||||
if (canBuild == EBuildingState::HAVE_CAPITAL || canBuild == EBuildingState::FORBIDDEN || canBuild == EBuildingState::NO_WATER)
|
if (canBuild == EBuildingState::HAVE_CAPITAL || canBuild == EBuildingState::FORBIDDEN || canBuild == EBuildingState::NO_WATER)
|
||||||
return false; //we won't be able to build this
|
return false; //we won't be able to build this
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ bool BuildingManager::tryBuildThisStructure(const CGTownInstance * t, BuildingID
|
|||||||
{
|
{
|
||||||
const CBuilding * b = t->town->buildings.at(buildID);
|
const CBuilding * b = t->town->buildings.at(buildID);
|
||||||
|
|
||||||
EBuildingState::EBuildingState canBuild = cb->canBuildStructure(t, buildID);
|
EBuildingState canBuild = cb->canBuildStructure(t, buildID);
|
||||||
if (canBuild == EBuildingState::ALLOWED)
|
if (canBuild == EBuildingState::ALLOWED)
|
||||||
{
|
{
|
||||||
PotentialBuilding pb;
|
PotentialBuilding pb;
|
||||||
|
@ -776,7 +776,7 @@ void VCAI::makeTurn()
|
|||||||
{
|
{
|
||||||
MAKING_TURN;
|
MAKING_TURN;
|
||||||
|
|
||||||
auto day = cb->getDate(Date::EDateType::DAY);
|
auto day = cb->getDate(Date::DAY);
|
||||||
logAi->info("Player %d (%s) starting turn, day %d", playerID, playerID.getStr(), day);
|
logAi->info("Player %d (%s) starting turn, day %d", playerID, playerID.getStr(), day);
|
||||||
|
|
||||||
boost::shared_lock<boost::shared_mutex> gsLock(CGameState::mutex);
|
boost::shared_lock<boost::shared_mutex> gsLock(CGameState::mutex);
|
||||||
|
@ -195,7 +195,7 @@ bool CCallback::buildBuilding(const CGTownInstance *town, BuildingID buildingID)
|
|||||||
if(town->tempOwner!=player)
|
if(town->tempOwner!=player)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(!canBuildStructure(town, buildingID))
|
if(canBuildStructure(town, buildingID) != EBuildingState::ALLOWED)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
BuildStructure pack(town->id,buildingID);
|
BuildStructure pack(town->id,buildingID);
|
||||||
|
@ -523,7 +523,7 @@ void BattleWindow::bSpellf()
|
|||||||
|
|
||||||
CCS->curh->set(Cursor::Map::POINTER);
|
CCS->curh->set(Cursor::Map::POINTER);
|
||||||
|
|
||||||
ESpellCastProblem::ESpellCastProblem spellCastProblem = owner.curInt->cb->battleCanCastSpell(myHero, spells::Mode::HERO);
|
ESpellCastProblem spellCastProblem = owner.curInt->cb->battleCanCastSpell(myHero, spells::Mode::HERO);
|
||||||
|
|
||||||
if(spellCastProblem == ESpellCastProblem::OK)
|
if(spellCastProblem == ESpellCastProblem::OK)
|
||||||
{
|
{
|
||||||
@ -629,7 +629,7 @@ void BattleWindow::blockUI(bool on)
|
|||||||
|
|
||||||
if(hero)
|
if(hero)
|
||||||
{
|
{
|
||||||
ESpellCastProblem::ESpellCastProblem spellcastingProblem = owner.curInt->cb->battleCanCastSpell(hero, spells::Mode::HERO);
|
ESpellCastProblem spellcastingProblem = owner.curInt->cb->battleCanCastSpell(hero, spells::Mode::HERO);
|
||||||
|
|
||||||
//if magic is blocked, we leave button active, so the message can be displayed after button click
|
//if magic is blocked, we leave button active, so the message can be displayed after button click
|
||||||
canCastSpells = spellcastingProblem == ESpellCastProblem::OK || spellcastingProblem == ESpellCastProblem::MAGIC_IS_BLOCKED;
|
canCastSpells = spellcastingProblem == ESpellCastProblem::OK || spellcastingProblem == ESpellCastProblem::MAGIC_IS_BLOCKED;
|
||||||
|
@ -441,7 +441,7 @@ OptionsTab::SelectionWindow::SelectionWindow(PlayerColor _color, SelType _type)
|
|||||||
if(initialHero >= -1)
|
if(initialHero >= -1)
|
||||||
allowedBonus.push_back(0); // artifact
|
allowedBonus.push_back(0); // artifact
|
||||||
allowedBonus.push_back(1); // gold
|
allowedBonus.push_back(1); // gold
|
||||||
if(initialFaction >= 0)
|
if(initialFaction.getNum() >= 0)
|
||||||
allowedBonus.push_back(2); // resource
|
allowedBonus.push_back(2); // resource
|
||||||
|
|
||||||
recreate();
|
recreate();
|
||||||
@ -451,7 +451,7 @@ int OptionsTab::SelectionWindow::calcLines(FactionID faction)
|
|||||||
{
|
{
|
||||||
double additionalItems = 1; // random
|
double additionalItems = 1; // random
|
||||||
|
|
||||||
if(faction < 0)
|
if(faction.getNum() < 0)
|
||||||
return std::ceil(((double)allowedFactions.size() + additionalItems) / elementsPerLine);
|
return std::ceil(((double)allowedFactions.size() + additionalItems) / elementsPerLine);
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@ -568,8 +568,8 @@ void OptionsTab::SelectionWindow::genContentFactions()
|
|||||||
set.castle = PlayerSettings::RANDOM;
|
set.castle = PlayerSettings::RANDOM;
|
||||||
CPlayerSettingsHelper helper = CPlayerSettingsHelper(set, SelType::TOWN);
|
CPlayerSettingsHelper helper = CPlayerSettingsHelper(set, SelType::TOWN);
|
||||||
components.push_back(std::make_shared<CAnimImage>(helper.getImageName(), helper.getImageIndex(), 0, 6, (ICON_SMALL_HEIGHT/2)));
|
components.push_back(std::make_shared<CAnimImage>(helper.getImageName(), helper.getImageIndex(), 0, 6, (ICON_SMALL_HEIGHT/2)));
|
||||||
drawOutlinedText(TEXT_POS_X, TEXT_POS_Y, (selectedFaction == PlayerSettings::RANDOM) ? Colors::YELLOW : Colors::WHITE, helper.getName());
|
drawOutlinedText(TEXT_POS_X, TEXT_POS_Y, (selectedFaction.getNum() == PlayerSettings::RANDOM) ? Colors::YELLOW : Colors::WHITE, helper.getName());
|
||||||
if(selectedFaction == PlayerSettings::RANDOM)
|
if(selectedFaction.getNum() == PlayerSettings::RANDOM)
|
||||||
components.push_back(std::make_shared<CPicture>("lobby/townBorderSmallActivated", 6, (ICON_SMALL_HEIGHT/2)));
|
components.push_back(std::make_shared<CPicture>("lobby/townBorderSmallActivated", 6, (ICON_SMALL_HEIGHT/2)));
|
||||||
|
|
||||||
for(auto & elem : allowedFactions)
|
for(auto & elem : allowedFactions)
|
||||||
@ -677,7 +677,7 @@ void OptionsTab::SelectionWindow::setElement(int elem, bool doApply)
|
|||||||
{
|
{
|
||||||
set.castle = PlayerSettings::RANDOM;
|
set.castle = PlayerSettings::RANDOM;
|
||||||
}
|
}
|
||||||
if(set.castle != PlayerSettings::NONE)
|
if(set.castle.getNum() != PlayerSettings::NONE)
|
||||||
{
|
{
|
||||||
if(!doApply)
|
if(!doApply)
|
||||||
{
|
{
|
||||||
@ -800,7 +800,7 @@ void OptionsTab::SelectedBox::clickReleased(const Point & cursorPosition)
|
|||||||
if(type == SelType::TOWN && ((pi.allowedFactions.size() < 2 && !pi.isFactionRandom) || foreignPlayer))
|
if(type == SelType::TOWN && ((pi.allowedFactions.size() < 2 && !pi.isFactionRandom) || foreignPlayer))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(type == SelType::HERO && ((pi.defaultHero() != -1 || settings.castle < 0) || foreignPlayer))
|
if(type == SelType::HERO && ((pi.defaultHero() != -1 || settings.castle.getNum() < 0) || foreignPlayer))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(type == SelType::BONUS && foreignPlayer)
|
if(type == SelType::BONUS && foreignPlayer)
|
||||||
@ -954,4 +954,4 @@ void OptionsTab::PlayerOptionsEntry::hideUnavailableButtons()
|
|||||||
buttonBonusLeft->enable();
|
buttonBonusLeft->enable();
|
||||||
buttonBonusRight->enable();
|
buttonBonusRight->enable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1351,9 +1351,9 @@ CHallInterface::CBuildingBox::CBuildingBox(int x, int y, const CGTownInstance *
|
|||||||
};
|
};
|
||||||
|
|
||||||
icon = std::make_shared<CAnimImage>(town->town->clientInfo.buildingsIcons, building->bid, 0, 2, 2);
|
icon = std::make_shared<CAnimImage>(town->town->clientInfo.buildingsIcons, building->bid, 0, 2, 2);
|
||||||
header = std::make_shared<CAnimImage>("TPTHBAR", panelIndex[state], 0, 1, 73);
|
header = std::make_shared<CAnimImage>("TPTHBAR", panelIndex[static_cast<int>(state)], 0, 1, 73);
|
||||||
if(iconIndex[state] >=0)
|
if(iconIndex[static_cast<int>(state)] >=0)
|
||||||
mark = std::make_shared<CAnimImage>("TPTHCHK", iconIndex[state], 0, 136, 56);
|
mark = std::make_shared<CAnimImage>("TPTHCHK", iconIndex[static_cast<int>(state)], 0, 136, 56);
|
||||||
name = std::make_shared<CLabel>(75, 81, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, building->getNameTranslated());
|
name = std::make_shared<CLabel>(75, 81, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, building->getNameTranslated());
|
||||||
|
|
||||||
//todo: add support for all possible states
|
//todo: add support for all possible states
|
||||||
@ -1371,7 +1371,7 @@ void CHallInterface::CBuildingBox::hover(bool on)
|
|||||||
else if(state==EBuildingState::CANT_BUILD_TODAY)
|
else if(state==EBuildingState::CANT_BUILD_TODAY)
|
||||||
toPrint = CGI->generaltexth->allTexts[223];
|
toPrint = CGI->generaltexth->allTexts[223];
|
||||||
else
|
else
|
||||||
toPrint = CGI->generaltexth->hcommands[state];
|
toPrint = CGI->generaltexth->hcommands[static_cast<int>(state)];
|
||||||
boost::algorithm::replace_first(toPrint,"%s",building->getNameTranslated());
|
boost::algorithm::replace_first(toPrint,"%s",building->getNameTranslated());
|
||||||
GH.statusbar()->write(toPrint);
|
GH.statusbar()->write(toPrint);
|
||||||
}
|
}
|
||||||
@ -1439,7 +1439,7 @@ CHallInterface::CHallInterface(const CGTownInstance * Town):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CBuildWindow::CBuildWindow(const CGTownInstance *Town, const CBuilding * Building, int state, bool rightClick):
|
CBuildWindow::CBuildWindow(const CGTownInstance *Town, const CBuilding * Building, EBuildingState state, bool rightClick):
|
||||||
CStatusbarWindow(PLAYER_COLORED | (rightClick ? RCLICK_POPUP : 0), "TPUBUILD"),
|
CStatusbarWindow(PLAYER_COLORED | (rightClick ? RCLICK_POPUP : 0), "TPUBUILD"),
|
||||||
town(Town),
|
town(Town),
|
||||||
building(Building)
|
building(Building)
|
||||||
@ -1482,7 +1482,7 @@ CBuildWindow::CBuildWindow(const CGTownInstance *Town, const CBuilding * Buildin
|
|||||||
|
|
||||||
buy = std::make_shared<CButton>(Point(45, 446), "IBUY30", CButton::tooltip(tooltipYes.toString()), [&](){ buyFunc(); }, EShortcut::GLOBAL_ACCEPT);
|
buy = std::make_shared<CButton>(Point(45, 446), "IBUY30", CButton::tooltip(tooltipYes.toString()), [&](){ buyFunc(); }, EShortcut::GLOBAL_ACCEPT);
|
||||||
buy->setBorderColor(Colors::METALLIC_GOLD);
|
buy->setBorderColor(Colors::METALLIC_GOLD);
|
||||||
buy->block(state!=7 || LOCPLINT->playerID != town->tempOwner);
|
buy->block(state!=EBuildingState::ALLOWED || LOCPLINT->playerID != town->tempOwner);
|
||||||
|
|
||||||
cancel = std::make_shared<CButton>(Point(290, 445), "ICANCEL", CButton::tooltip(tooltipNo.toString()), [&](){ close();}, EShortcut::GLOBAL_CANCEL);
|
cancel = std::make_shared<CButton>(Point(290, 445), "ICANCEL", CButton::tooltip(tooltipNo.toString()), [&](){ close();}, EShortcut::GLOBAL_CANCEL);
|
||||||
cancel->setBorderColor(Colors::METALLIC_GOLD);
|
cancel->setBorderColor(Colors::METALLIC_GOLD);
|
||||||
@ -1495,11 +1495,11 @@ void CBuildWindow::buyFunc()
|
|||||||
GH.windows().popWindows(2); //we - build window and hall screen
|
GH.windows().popWindows(2); //we - build window and hall screen
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CBuildWindow::getTextForState(int state)
|
std::string CBuildWindow::getTextForState(EBuildingState state)
|
||||||
{
|
{
|
||||||
std::string ret;
|
std::string ret;
|
||||||
if(state < EBuildingState::ALLOWED)
|
if(state < EBuildingState::ALLOWED)
|
||||||
ret = CGI->generaltexth->hcommands[state];
|
ret = CGI->generaltexth->hcommands[static_cast<int>(state)];
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case EBuildingState::ALREADY_PRESENT:
|
case EBuildingState::ALREADY_PRESENT:
|
||||||
|
@ -265,7 +265,7 @@ class CHallInterface : public CStatusbarWindow
|
|||||||
const CGTownInstance * town;
|
const CGTownInstance * town;
|
||||||
const CBuilding * building;
|
const CBuilding * building;
|
||||||
|
|
||||||
ui32 state;//Buildings::EBuildStructure enum
|
EBuildingState state;
|
||||||
|
|
||||||
std::shared_ptr<CAnimImage> header;
|
std::shared_ptr<CAnimImage> header;
|
||||||
std::shared_ptr<CAnimImage> icon;
|
std::shared_ptr<CAnimImage> icon;
|
||||||
@ -303,10 +303,10 @@ class CBuildWindow: public CStatusbarWindow
|
|||||||
std::shared_ptr<CButton> buy;
|
std::shared_ptr<CButton> buy;
|
||||||
std::shared_ptr<CButton> cancel;
|
std::shared_ptr<CButton> cancel;
|
||||||
|
|
||||||
std::string getTextForState(int state);
|
std::string getTextForState(EBuildingState state);
|
||||||
void buyFunc();
|
void buyFunc();
|
||||||
public:
|
public:
|
||||||
CBuildWindow(const CGTownInstance *Town, const CBuilding * building, int State, bool rightClick);
|
CBuildWindow(const CGTownInstance *Town, const CBuilding * building, EBuildingState State, bool rightClick);
|
||||||
};
|
};
|
||||||
|
|
||||||
//Small class to display
|
//Small class to display
|
||||||
|
@ -1711,7 +1711,7 @@ CThievesGuildWindow::CThievesGuildWindow(const CGObjectInstance * _owner):
|
|||||||
}
|
}
|
||||||
else if(it.second != EAiTactic::RANDOM)
|
else if(it.second != EAiTactic::RANDOM)
|
||||||
{
|
{
|
||||||
text = CGI->generaltexth->arraytxt[168 + it.second];
|
text = CGI->generaltexth->arraytxt[168 + static_cast<int>(it.second)];
|
||||||
}
|
}
|
||||||
|
|
||||||
personalities.push_back(std::make_shared<CLabel>(283 + 66*counter, 459, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, text));
|
personalities.push_back(std::make_shared<CLabel>(283 + 66*counter, 459, FONT_SMALL, ETextAlignment::CENTER, Colors::WHITE, text));
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
class BonusList;
|
class BonusList;
|
||||||
enum class PrimarySkill : int32_t;
|
enum class PrimarySkill : int8_t;
|
||||||
|
|
||||||
class DLL_LINKAGE AFactionMember: public IConstBonusProvider, public INativeTerrainProvider
|
class DLL_LINKAGE AFactionMember: public IConstBonusProvider, public INativeTerrainProvider
|
||||||
{
|
{
|
||||||
|
@ -405,7 +405,7 @@ bool CGameInfoCallback::getHeroInfo(const CGObjectInstance * hero, InfoAboutHero
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CGameInfoCallback::getDate(Date::EDateType mode) const
|
int CGameInfoCallback::getDate(Date mode) const
|
||||||
{
|
{
|
||||||
//boost::shared_lock<boost::shared_mutex> lock(*gs->mx);
|
//boost::shared_lock<boost::shared_mutex> lock(*gs->mx);
|
||||||
return gs->getDate(mode);
|
return gs->getDate(mode);
|
||||||
@ -551,7 +551,7 @@ std::shared_ptr<const boost::multi_array<TerrainTile*, 3>> CGameInfoCallback::ge
|
|||||||
return std::shared_ptr<const boost::multi_array<TerrainTile*, 3>>(ptr);
|
return std::shared_ptr<const boost::multi_array<TerrainTile*, 3>>(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
EBuildingState::EBuildingState CGameInfoCallback::canBuildStructure( const CGTownInstance *t, BuildingID ID )
|
EBuildingState CGameInfoCallback::canBuildStructure( const CGTownInstance *t, BuildingID ID )
|
||||||
{
|
{
|
||||||
ERROR_RET_VAL_IF(!canGetFullInfo(t), "Town is not owned!", EBuildingState::TOWN_NOT_OWNED);
|
ERROR_RET_VAL_IF(!canGetFullInfo(t), "Town is not owned!", EBuildingState::TOWN_NOT_OWNED);
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public:
|
|||||||
//TODO: all other public methods of CGameInfoCallback
|
//TODO: all other public methods of CGameInfoCallback
|
||||||
|
|
||||||
// //various
|
// //various
|
||||||
virtual int getDate(Date::EDateType mode=Date::DAY) const = 0; //mode=0 - total days in game, mode=1 - day of week, mode=2 - current week, mode=3 - current month
|
virtual int getDate(Date mode=Date::DAY) const = 0; //mode=0 - total days in game, mode=1 - day of week, mode=2 - current week, mode=3 - current month
|
||||||
// const StartInfo * getStartInfo(bool beforeRandomization = false)const;
|
// const StartInfo * getStartInfo(bool beforeRandomization = false)const;
|
||||||
virtual bool isAllowed(int32_t type, int32_t id) const = 0; //type: 0 - spell; 1- artifact; 2 - secondary skill
|
virtual bool isAllowed(int32_t type, int32_t id) const = 0; //type: 0 - spell; 1- artifact; 2 - secondary skill
|
||||||
|
|
||||||
@ -107,13 +107,13 @@ public:
|
|||||||
// const CGTownInstance * getTownInfo(int val, bool mode)const; //mode = 0 -> val = player town serial; mode = 1 -> val = object id (serial)
|
// const CGTownInstance * getTownInfo(int val, bool mode)const; //mode = 0 -> val = player town serial; mode = 1 -> val = object id (serial)
|
||||||
// std::vector<const CGHeroInstance *> getAvailableHeroes(const CGObjectInstance * townOrTavern) const; //heroes that can be recruited
|
// std::vector<const CGHeroInstance *> getAvailableHeroes(const CGObjectInstance * townOrTavern) const; //heroes that can be recruited
|
||||||
// std::string getTavernRumor(const CGObjectInstance * townOrTavern) const;
|
// std::string getTavernRumor(const CGObjectInstance * townOrTavern) const;
|
||||||
// EBuildingState::EBuildingState canBuildStructure(const CGTownInstance *t, BuildingID ID);//// 0 - no more than one capitol, 1 - lack of water, 2 - forbidden, 3 - Add another level to Mage Guild, 4 - already built, 5 - cannot build, 6 - cannot afford, 7 - build, 8 - lack of requirements
|
// EBuildingState canBuildStructure(const CGTownInstance *t, BuildingID ID);//// 0 - no more than one capitol, 1 - lack of water, 2 - forbidden, 3 - Add another level to Mage Guild, 4 - already built, 5 - cannot build, 6 - cannot afford, 7 - build, 8 - lack of requirements
|
||||||
// virtual bool getTownInfo(const CGObjectInstance * town, InfoAboutTown & dest, const CGObjectInstance * selectedObject = nullptr) const;
|
// virtual bool getTownInfo(const CGObjectInstance * town, InfoAboutTown & dest, const CGObjectInstance * selectedObject = nullptr) const;
|
||||||
|
|
||||||
//from gs
|
//from gs
|
||||||
// const TeamState *getTeam(TeamID teamID) const;
|
// const TeamState *getTeam(TeamID teamID) const;
|
||||||
// const TeamState *getPlayerTeam(PlayerColor color) const;
|
// const TeamState *getPlayerTeam(PlayerColor color) const;
|
||||||
// EBuildingState::EBuildingState canBuildStructure(const CGTownInstance *t, BuildingID ID) const;// 0 - no more than one capitol, 1 - lack of water, 2 - forbidden, 3 - Add another level to Mage Guild, 4 - already built, 5 - cannot build, 6 - cannot afford, 7 - build, 8 - lack of requirements
|
// EBuildingState canBuildStructure(const CGTownInstance *t, BuildingID ID) const;// 0 - no more than one capitol, 1 - lack of water, 2 - forbidden, 3 - Add another level to Mage Guild, 4 - already built, 5 - cannot build, 6 - cannot afford, 7 - build, 8 - lack of requirements
|
||||||
|
|
||||||
//teleport
|
//teleport
|
||||||
// std::vector<ObjectInstanceID> getVisibleTeleportObjects(std::vector<ObjectInstanceID> ids, PlayerColor player) const;
|
// std::vector<ObjectInstanceID> getVisibleTeleportObjects(std::vector<ObjectInstanceID> ids, PlayerColor player) const;
|
||||||
@ -140,7 +140,7 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
//various
|
//various
|
||||||
int getDate(Date::EDateType mode=Date::DAY)const override; //mode=0 - total days in game, mode=1 - day of week, mode=2 - current week, mode=3 - current month
|
int getDate(Date mode=Date::DAY)const override; //mode=0 - total days in game, mode=1 - day of week, mode=2 - current week, mode=3 - current month
|
||||||
virtual const StartInfo * getStartInfo(bool beforeRandomization = false)const;
|
virtual const StartInfo * getStartInfo(bool beforeRandomization = false)const;
|
||||||
bool isAllowed(int32_t type, int32_t id) const override; //type: 0 - spell; 1- artifact; 2 - secondary skill
|
bool isAllowed(int32_t type, int32_t id) const override; //type: 0 - spell; 1- artifact; 2 - secondary skill
|
||||||
|
|
||||||
@ -205,13 +205,13 @@ public:
|
|||||||
//virtual const CGTownInstance * getTownInfo(int val, bool mode)const; //mode = 0 -> val = player town serial; mode = 1 -> val = object id (serial)
|
//virtual const CGTownInstance * getTownInfo(int val, bool mode)const; //mode = 0 -> val = player town serial; mode = 1 -> val = object id (serial)
|
||||||
virtual std::vector<const CGHeroInstance *> getAvailableHeroes(const CGObjectInstance * townOrTavern) const; //heroes that can be recruited
|
virtual std::vector<const CGHeroInstance *> getAvailableHeroes(const CGObjectInstance * townOrTavern) const; //heroes that can be recruited
|
||||||
virtual std::string getTavernRumor(const CGObjectInstance * townOrTavern) const;
|
virtual std::string getTavernRumor(const CGObjectInstance * townOrTavern) const;
|
||||||
virtual EBuildingState::EBuildingState canBuildStructure(const CGTownInstance *t, BuildingID ID);//// 0 - no more than one capitol, 1 - lack of water, 2 - forbidden, 3 - Add another level to Mage Guild, 4 - already built, 5 - cannot build, 6 - cannot afford, 7 - build, 8 - lack of requirements
|
virtual EBuildingState canBuildStructure(const CGTownInstance *t, BuildingID ID);//// 0 - no more than one capitol, 1 - lack of water, 2 - forbidden, 3 - Add another level to Mage Guild, 4 - already built, 5 - cannot build, 6 - cannot afford, 7 - build, 8 - lack of requirements
|
||||||
virtual bool getTownInfo(const CGObjectInstance * town, InfoAboutTown & dest, const CGObjectInstance * selectedObject = nullptr) const;
|
virtual bool getTownInfo(const CGObjectInstance * town, InfoAboutTown & dest, const CGObjectInstance * selectedObject = nullptr) const;
|
||||||
|
|
||||||
//from gs
|
//from gs
|
||||||
virtual const TeamState *getTeam(TeamID teamID) const;
|
virtual const TeamState *getTeam(TeamID teamID) const;
|
||||||
virtual const TeamState *getPlayerTeam(PlayerColor color) const;
|
virtual const TeamState *getPlayerTeam(PlayerColor color) const;
|
||||||
//virtual EBuildingState::EBuildingState canBuildStructure(const CGTownInstance *t, BuildingID ID) const;// 0 - no more than one capitol, 1 - lack of water, 2 - forbidden, 3 - Add another level to Mage Guild, 4 - already built, 5 - cannot build, 6 - cannot afford, 7 - build, 8 - lack of requirements
|
//virtual EBuildingState canBuildStructure(const CGTownInstance *t, BuildingID ID) const;// 0 - no more than one capitol, 1 - lack of water, 2 - forbidden, 3 - Add another level to Mage Guild, 4 - already built, 5 - cannot build, 6 - cannot afford, 7 - build, 8 - lack of requirements
|
||||||
|
|
||||||
//teleport
|
//teleport
|
||||||
virtual std::vector<ObjectInstanceID> getVisibleTeleportObjects(std::vector<ObjectInstanceID> ids, PlayerColor player) const;
|
virtual std::vector<ObjectInstanceID> getVisibleTeleportObjects(std::vector<ObjectInstanceID> ids, PlayerColor player) const;
|
||||||
|
@ -412,7 +412,7 @@ class TeleportChannelID : public BaseForID<TeleportChannelID, si32>
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Enum declarations
|
// Enum declarations
|
||||||
enum class PrimarySkill : int32_t
|
enum class PrimarySkill : int8_t
|
||||||
{
|
{
|
||||||
NONE = -1,
|
NONE = -1,
|
||||||
ATTACK,
|
ATTACK,
|
||||||
@ -603,7 +603,7 @@ namespace BuildingSubID
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class EMarketMode : int32_t
|
enum class EMarketMode : int8_t
|
||||||
{
|
{
|
||||||
RESOURCE_RESOURCE, RESOURCE_PLAYER, CREATURE_RESOURCE, RESOURCE_ARTIFACT,
|
RESOURCE_RESOURCE, RESOURCE_PLAYER, CREATURE_RESOURCE, RESOURCE_ARTIFACT,
|
||||||
ARTIFACT_RESOURCE, ARTIFACT_EXP, CREATURE_EXP, CREATURE_UNDEAD, RESOURCE_SKILL,
|
ARTIFACT_RESOURCE, ARTIFACT_EXP, CREATURE_EXP, CREATURE_UNDEAD, RESOURCE_SKILL,
|
||||||
@ -701,9 +701,7 @@ namespace MappedKeys
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace EAiTactic
|
enum class EAiTactic : int8_t
|
||||||
{
|
|
||||||
enum EAiTactic
|
|
||||||
{
|
{
|
||||||
NONE = -1,
|
NONE = -1,
|
||||||
RANDOM,
|
RANDOM,
|
||||||
@ -711,29 +709,22 @@ enum EAiTactic
|
|||||||
BUILDER,
|
BUILDER,
|
||||||
EXPLORER
|
EXPLORER
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
namespace EBuildingState
|
enum class EBuildingState : int8_t
|
||||||
{
|
{
|
||||||
enum EBuildingState
|
HAVE_CAPITAL, NO_WATER, FORBIDDEN, ADD_MAGES_GUILD, ALREADY_PRESENT, CANT_BUILD_TODAY,
|
||||||
{
|
NO_RESOURCES, ALLOWED, PREREQUIRES, MISSING_BASE, BUILDING_ERROR, TOWN_NOT_OWNED
|
||||||
HAVE_CAPITAL, NO_WATER, FORBIDDEN, ADD_MAGES_GUILD, ALREADY_PRESENT, CANT_BUILD_TODAY,
|
};
|
||||||
NO_RESOURCES, ALLOWED, PREREQUIRES, MISSING_BASE, BUILDING_ERROR, TOWN_NOT_OWNED
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace ESpellCastProblem
|
enum class ESpellCastProblem : int8_t
|
||||||
{
|
{
|
||||||
enum ESpellCastProblem
|
OK, NO_HERO_TO_CAST_SPELL, CASTS_PER_TURN_LIMIT, NO_SPELLBOOK,
|
||||||
{
|
HERO_DOESNT_KNOW_SPELL, NOT_ENOUGH_MANA, ADVMAP_SPELL_INSTEAD_OF_BATTLE_SPELL,
|
||||||
OK, NO_HERO_TO_CAST_SPELL, CASTS_PER_TURN_LIMIT, NO_SPELLBOOK,
|
SPELL_LEVEL_LIMIT_EXCEEDED, NO_SPELLS_TO_DISPEL,
|
||||||
HERO_DOESNT_KNOW_SPELL, NOT_ENOUGH_MANA, ADVMAP_SPELL_INSTEAD_OF_BATTLE_SPELL,
|
NO_APPROPRIATE_TARGET, STACK_IMMUNE_TO_SPELL, WRONG_SPELL_TARGET, ONGOING_TACTIC_PHASE,
|
||||||
SPELL_LEVEL_LIMIT_EXCEEDED, NO_SPELLS_TO_DISPEL,
|
MAGIC_IS_BLOCKED, //For Orb of Inhibition and similar - no casting at all
|
||||||
NO_APPROPRIATE_TARGET, STACK_IMMUNE_TO_SPELL, WRONG_SPELL_TARGET, ONGOING_TACTIC_PHASE,
|
INVALID
|
||||||
MAGIC_IS_BLOCKED, //For Orb of Inhibition and similar - no casting at all
|
};
|
||||||
INVALID
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace ECommander
|
namespace ECommander
|
||||||
{
|
{
|
||||||
@ -757,7 +748,7 @@ enum class EWallState : int8_t
|
|||||||
REINFORCED, // walls in towns with castle
|
REINFORCED, // walls in towns with castle
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class EGateState : uint8_t
|
enum class EGateState : int8_t
|
||||||
{
|
{
|
||||||
NONE,
|
NONE,
|
||||||
CLOSED,
|
CLOSED,
|
||||||
@ -766,32 +757,16 @@ enum class EGateState : uint8_t
|
|||||||
DESTROYED
|
DESTROYED
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace ESiegeHex
|
|
||||||
{
|
|
||||||
enum ESiegeHex : si16
|
|
||||||
{
|
|
||||||
DESTRUCTIBLE_WALL_1 = 29,
|
|
||||||
DESTRUCTIBLE_WALL_2 = 78,
|
|
||||||
DESTRUCTIBLE_WALL_3 = 130,
|
|
||||||
DESTRUCTIBLE_WALL_4 = 182,
|
|
||||||
GATE_BRIDGE = 94,
|
|
||||||
GATE_OUTER = 95,
|
|
||||||
GATE_INNER = 96
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace ETileType
|
enum class ETileType : int8_t
|
||||||
{
|
{
|
||||||
enum ETileType
|
FREE,
|
||||||
{
|
POSSIBLE,
|
||||||
FREE,
|
BLOCKED,
|
||||||
POSSIBLE,
|
USED
|
||||||
BLOCKED,
|
};
|
||||||
USED
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
enum class ETeleportChannelType
|
enum class ETeleportChannelType : int8_t
|
||||||
{
|
{
|
||||||
IMPASSABLE,
|
IMPASSABLE,
|
||||||
BIDIRECTIONAL,
|
BIDIRECTIONAL,
|
||||||
@ -1006,17 +981,14 @@ namespace SecSkillLevel
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Date
|
enum class Date : int8_t
|
||||||
{
|
{
|
||||||
enum EDateType
|
DAY = 0,
|
||||||
{
|
DAY_OF_WEEK = 1,
|
||||||
DAY = 0,
|
WEEK = 2,
|
||||||
DAY_OF_WEEK = 1,
|
MONTH = 3,
|
||||||
WEEK = 2,
|
DAY_OF_MONTH
|
||||||
MONTH = 3,
|
};
|
||||||
DAY_OF_MONTH
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
enum class EActionType : int8_t
|
enum class EActionType : int8_t
|
||||||
{
|
{
|
||||||
@ -1041,7 +1013,7 @@ enum class EActionType : int8_t
|
|||||||
|
|
||||||
DLL_LINKAGE std::ostream & operator<<(std::ostream & os, const EActionType actionType);
|
DLL_LINKAGE std::ostream & operator<<(std::ostream & os, const EActionType actionType);
|
||||||
|
|
||||||
enum class EDiggingStatus : int32_t
|
enum class EDiggingStatus : int8_t
|
||||||
{
|
{
|
||||||
UNKNOWN = -1,
|
UNKNOWN = -1,
|
||||||
CAN_DIG = 0,
|
CAN_DIG = 0,
|
||||||
@ -1348,7 +1320,7 @@ public:
|
|||||||
|
|
||||||
using ESpellSchool = SpellSchool;
|
using ESpellSchool = SpellSchool;
|
||||||
|
|
||||||
enum class EMetaclass: ui8
|
enum class EMetaclass: int8_t
|
||||||
{
|
{
|
||||||
INVALID = 0,
|
INVALID = 0,
|
||||||
ARTIFACT,
|
ARTIFACT,
|
||||||
|
@ -47,6 +47,14 @@ struct DLL_LINKAGE BattleHex //TODO: decide if this should be changed to class f
|
|||||||
static constexpr si16 HEX_BEFORE_ALL = std::numeric_limits<si16>::min();
|
static constexpr si16 HEX_BEFORE_ALL = std::numeric_limits<si16>::min();
|
||||||
static constexpr si16 HEX_AFTER_ALL = std::numeric_limits<si16>::max();
|
static constexpr si16 HEX_AFTER_ALL = std::numeric_limits<si16>::max();
|
||||||
|
|
||||||
|
static constexpr si16 DESTRUCTIBLE_WALL_1 = 29;
|
||||||
|
static constexpr si16 DESTRUCTIBLE_WALL_2 = 78;
|
||||||
|
static constexpr si16 DESTRUCTIBLE_WALL_3 = 130;
|
||||||
|
static constexpr si16 DESTRUCTIBLE_WALL_4 = 182;
|
||||||
|
static constexpr si16 GATE_BRIDGE = 94;
|
||||||
|
static constexpr si16 GATE_OUTER = 95;
|
||||||
|
static constexpr si16 GATE_INNER = 96;
|
||||||
|
|
||||||
si16 hex;
|
si16 hex;
|
||||||
static constexpr si16 INVALID = -1;
|
static constexpr si16 INVALID = -1;
|
||||||
enum EDir
|
enum EDir
|
||||||
|
@ -93,7 +93,7 @@ static BattleHex WallPartToHex(EWallPart part)
|
|||||||
|
|
||||||
using namespace SiegeStuffThatShouldBeMovedToHandlers;
|
using namespace SiegeStuffThatShouldBeMovedToHandlers;
|
||||||
|
|
||||||
ESpellCastProblem::ESpellCastProblem CBattleInfoCallback::battleCanCastSpell(const spells::Caster * caster, spells::Mode mode) const
|
ESpellCastProblem CBattleInfoCallback::battleCanCastSpell(const spells::Caster * caster, spells::Mode mode) const
|
||||||
{
|
{
|
||||||
RETURN_IF_NOT_BATTLE(ESpellCastProblem::INVALID);
|
RETURN_IF_NOT_BATTLE(ESpellCastProblem::INVALID);
|
||||||
if(caster == nullptr)
|
if(caster == nullptr)
|
||||||
@ -187,7 +187,7 @@ bool CBattleInfoCallback::battleHasPenaltyOnLine(BattleHex from, BattleHex dest,
|
|||||||
|
|
||||||
auto obstacles = battleGetAllObstaclesOnPos(hex, false);
|
auto obstacles = battleGetAllObstaclesOnPos(hex, false);
|
||||||
|
|
||||||
if(hex != ESiegeHex::GATE_BRIDGE || (battleIsGatePassable()))
|
if(hex != BattleHex::GATE_BRIDGE || (battleIsGatePassable()))
|
||||||
for(const auto & obst : obstacles)
|
for(const auto & obst : obstacles)
|
||||||
if(obst->obstacleType == CObstacleInstance::MOAT)
|
if(obst->obstacleType == CObstacleInstance::MOAT)
|
||||||
pathHasMoat |= true;
|
pathHasMoat |= true;
|
||||||
@ -821,7 +821,7 @@ std::vector<std::shared_ptr<const CObstacleInstance>> CBattleInfoCallback::getAl
|
|||||||
affectedObstacles.push_back(i);
|
affectedObstacles.push_back(i);
|
||||||
}
|
}
|
||||||
for(auto hex : unit->getHexes())
|
for(auto hex : unit->getHexes())
|
||||||
if(hex == ESiegeHex::GATE_BRIDGE && battleIsGatePassable())
|
if(hex == BattleHex::GATE_BRIDGE && battleIsGatePassable())
|
||||||
for(int i=0; i<affectedObstacles.size(); i++)
|
for(int i=0; i<affectedObstacles.size(); i++)
|
||||||
if(affectedObstacles.at(i)->obstacleType == CObstacleInstance::MOAT)
|
if(affectedObstacles.at(i)->obstacleType == CObstacleInstance::MOAT)
|
||||||
affectedObstacles.erase(affectedObstacles.begin()+i);
|
affectedObstacles.erase(affectedObstacles.begin()+i);
|
||||||
@ -926,7 +926,7 @@ AccessibilityInfo CBattleInfoCallback::getAccesibility() const
|
|||||||
accessability = EAccessibility::UNAVAILABLE;
|
accessability = EAccessibility::UNAVAILABLE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ret[ESiegeHex::GATE_OUTER] = ret[ESiegeHex::GATE_INNER] = accessability;
|
ret[BattleHex::GATE_OUTER] = ret[BattleHex::GATE_INNER] = accessability;
|
||||||
}
|
}
|
||||||
|
|
||||||
//tiles occupied by standing stacks
|
//tiles occupied by standing stacks
|
||||||
@ -955,10 +955,10 @@ AccessibilityInfo CBattleInfoCallback::getAccesibility() const
|
|||||||
static const std::pair<EWallPart, BattleHex> lockedIfNotDestroyed[] =
|
static const std::pair<EWallPart, BattleHex> lockedIfNotDestroyed[] =
|
||||||
{
|
{
|
||||||
//which part of wall, which hex is blocked if this part of wall is not destroyed
|
//which part of wall, which hex is blocked if this part of wall is not destroyed
|
||||||
std::make_pair(EWallPart::BOTTOM_WALL, BattleHex(ESiegeHex::DESTRUCTIBLE_WALL_4)),
|
std::make_pair(EWallPart::BOTTOM_WALL, BattleHex(BattleHex::DESTRUCTIBLE_WALL_4)),
|
||||||
std::make_pair(EWallPart::BELOW_GATE, BattleHex(ESiegeHex::DESTRUCTIBLE_WALL_3)),
|
std::make_pair(EWallPart::BELOW_GATE, BattleHex(BattleHex::DESTRUCTIBLE_WALL_3)),
|
||||||
std::make_pair(EWallPart::OVER_GATE, BattleHex(ESiegeHex::DESTRUCTIBLE_WALL_2)),
|
std::make_pair(EWallPart::OVER_GATE, BattleHex(BattleHex::DESTRUCTIBLE_WALL_2)),
|
||||||
std::make_pair(EWallPart::UPPER_WALL, BattleHex(ESiegeHex::DESTRUCTIBLE_WALL_1))
|
std::make_pair(EWallPart::UPPER_WALL, BattleHex(BattleHex::DESTRUCTIBLE_WALL_1))
|
||||||
};
|
};
|
||||||
|
|
||||||
for(const auto & elem : lockedIfNotDestroyed)
|
for(const auto & elem : lockedIfNotDestroyed)
|
||||||
@ -1055,7 +1055,7 @@ bool CBattleInfoCallback::isInObstacle(
|
|||||||
|
|
||||||
if(vstd::contains(obstacles, occupiedHex))
|
if(vstd::contains(obstacles, occupiedHex))
|
||||||
{
|
{
|
||||||
if(occupiedHex == ESiegeHex::GATE_BRIDGE)
|
if(occupiedHex == BattleHex::GATE_BRIDGE)
|
||||||
{
|
{
|
||||||
if(battleGetGateState() != EGateState::DESTROYED && params.side == BattleSide::ATTACKER)
|
if(battleGetGateState() != EGateState::DESTROYED && params.side == BattleSide::ATTACKER)
|
||||||
return true;
|
return true;
|
||||||
@ -1080,7 +1080,7 @@ std::set<BattleHex> CBattleInfoCallback::getStoppers(BattlePerspective::BattlePe
|
|||||||
|
|
||||||
for(const auto & hex : oi->getStoppingTile())
|
for(const auto & hex : oi->getStoppingTile())
|
||||||
{
|
{
|
||||||
if(hex == ESiegeHex::GATE_BRIDGE && oi->obstacleType == CObstacleInstance::MOAT)
|
if(hex == BattleHex::GATE_BRIDGE && oi->obstacleType == CObstacleInstance::MOAT)
|
||||||
{
|
{
|
||||||
if(battleGetGateState() == EGateState::OPENED || battleGetGateState() == EGateState::DESTROYED)
|
if(battleGetGateState() == EGateState::OPENED || battleGetGateState() == EGateState::DESTROYED)
|
||||||
continue; // this tile is disabled by drawbridge on top of it
|
continue; // this tile is disabled by drawbridge on top of it
|
||||||
|
@ -118,7 +118,7 @@ public:
|
|||||||
si8 battleMinSpellLevel(ui8 side) const; //calculates maximum spell level possible to be cast on battlefield - takes into account artifacts of both heroes; if no effects are set, 0 is returned
|
si8 battleMinSpellLevel(ui8 side) const; //calculates maximum spell level possible to be cast on battlefield - takes into account artifacts of both heroes; if no effects are set, 0 is returned
|
||||||
si8 battleMaxSpellLevel(ui8 side) const; //calculates minimum spell level possible to be cast on battlefield - takes into account artifacts of both heroes; if no effects are set, 0 is returned
|
si8 battleMaxSpellLevel(ui8 side) const; //calculates minimum spell level possible to be cast on battlefield - takes into account artifacts of both heroes; if no effects are set, 0 is returned
|
||||||
int32_t battleGetSpellCost(const spells::Spell * sp, const CGHeroInstance * caster) const; //returns cost of given spell
|
int32_t battleGetSpellCost(const spells::Spell * sp, const CGHeroInstance * caster) const; //returns cost of given spell
|
||||||
ESpellCastProblem::ESpellCastProblem battleCanCastSpell(const spells::Caster * caster, spells::Mode mode) const; //returns true if there are no general issues preventing from casting a spell
|
ESpellCastProblem battleCanCastSpell(const spells::Caster * caster, spells::Mode mode) const; //returns true if there are no general issues preventing from casting a spell
|
||||||
|
|
||||||
SpellID battleGetRandomStackSpell(CRandomGenerator & rand, const CStack * stack, ERandomSpell mode) const;
|
SpellID battleGetRandomStackSpell(CRandomGenerator & rand, const CStack * stack, ERandomSpell mode) const;
|
||||||
SpellID getRandomBeneficialSpell(CRandomGenerator & rand, const CStack * subject) const;
|
SpellID getRandomBeneficialSpell(CRandomGenerator & rand, const CStack * subject) const;
|
||||||
|
@ -356,7 +356,7 @@ void CGameState::randomizeObject(CGObjectInstance *cur)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int CGameState::getDate(Date::EDateType mode) const
|
int CGameState::getDate(Date mode) const
|
||||||
{
|
{
|
||||||
int temp;
|
int temp;
|
||||||
switch (mode)
|
switch (mode)
|
||||||
|
@ -133,7 +133,7 @@ public:
|
|||||||
bool isVisible(int3 pos, const std::optional<PlayerColor> & player) const override;
|
bool isVisible(int3 pos, const std::optional<PlayerColor> & player) const override;
|
||||||
bool isVisible(const CGObjectInstance * obj, const std::optional<PlayerColor> & player) const override;
|
bool isVisible(const CGObjectInstance * obj, const std::optional<PlayerColor> & player) const override;
|
||||||
|
|
||||||
int getDate(Date::EDateType mode=Date::DAY) const override; //mode=0 - total days in game, mode=1 - day of week, mode=2 - current week, mode=3 - current month
|
int getDate(Date mode=Date::DAY) const override; //mode=0 - total days in game, mode=1 - day of week, mode=2 - current week, mode=3 - current month
|
||||||
|
|
||||||
// ----- getters, setters -----
|
// ----- getters, setters -----
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ struct DLL_LINKAGE SThievesGuildInfo
|
|||||||
|
|
||||||
std::map<PlayerColor, InfoAboutHero> colorToBestHero; //maps player's color to his best heros'
|
std::map<PlayerColor, InfoAboutHero> colorToBestHero; //maps player's color to his best heros'
|
||||||
|
|
||||||
std::map<PlayerColor, EAiTactic::EAiTactic> personality; // color to personality // ai tactic
|
std::map<PlayerColor, EAiTactic> personality; // color to personality // ai tactic
|
||||||
std::map<PlayerColor, si32> bestCreature; // color to ID // id or -1 if not known
|
std::map<PlayerColor, si32> bestCreature; // color to ID // id or -1 if not known
|
||||||
|
|
||||||
// template <typename Handler> void serialize(Handler &h, const int version)
|
// template <typename Handler> void serialize(Handler &h, const int version)
|
||||||
|
@ -52,7 +52,7 @@ struct DLL_LINKAGE PlayerInfo
|
|||||||
|
|
||||||
bool canHumanPlay;
|
bool canHumanPlay;
|
||||||
bool canComputerPlay;
|
bool canComputerPlay;
|
||||||
EAiTactic::EAiTactic aiTactic; /// The default value is EAiTactic::RANDOM.
|
EAiTactic aiTactic; /// The default value is EAiTactic::RANDOM.
|
||||||
|
|
||||||
std::set<FactionID> allowedFactions;
|
std::set<FactionID> allowedFactions;
|
||||||
bool isFactionRandom;
|
bool isFactionRandom;
|
||||||
|
@ -215,7 +215,7 @@ void CMapLoaderH3M::readPlayerInfo()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
playerInfo.aiTactic = static_cast<EAiTactic::EAiTactic>(reader->readUInt8());
|
playerInfo.aiTactic = static_cast<EAiTactic>(reader->readUInt8());
|
||||||
|
|
||||||
if(features.levelSOD)
|
if(features.levelSOD)
|
||||||
reader->skipUnused(1); //TODO: check meaning?
|
reader->skipUnused(1); //TODO: check meaning?
|
||||||
|
@ -269,7 +269,7 @@ bool RmgMap::isRoad(const int3& tile) const
|
|||||||
return tiles[tile.x][tile.y][tile.z].isRoad();
|
return tiles[tile.x][tile.y][tile.z].isRoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RmgMap::setOccupied(const int3 &tile, ETileType::ETileType state)
|
void RmgMap::setOccupied(const int3 &tile, ETileType state)
|
||||||
{
|
{
|
||||||
assertOnMap(tile);
|
assertOnMap(tile);
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public:
|
|||||||
int height() const;
|
int height() const;
|
||||||
PlayerInfo & getPlayer(int playerId);
|
PlayerInfo & getPlayer(int playerId);
|
||||||
|
|
||||||
void setOccupied(const int3 &tile, ETileType::ETileType state);
|
void setOccupied(const int3 &tile, ETileType state);
|
||||||
void setRoad(const int3 &tile, RoadId roadType);
|
void setRoad(const int3 &tile, RoadId roadType);
|
||||||
|
|
||||||
TileInfo getTileInfo(const int3 & tile) const;
|
TileInfo getTileInfo(const int3 & tile) const;
|
||||||
|
@ -356,7 +356,7 @@ void Object::Instance::finalize(RmgMap & map)
|
|||||||
|
|
||||||
for(const auto & tile : getBlockedArea().getTilesVector())
|
for(const auto & tile : getBlockedArea().getTilesVector())
|
||||||
{
|
{
|
||||||
map.setOccupied(tile, ETileType::ETileType::USED);
|
map.setOccupied(tile, ETileType::USED);
|
||||||
}
|
}
|
||||||
|
|
||||||
map.getMapProxy()->insertObject(&dObject);
|
map.getMapProxy()->insertObject(&dObject);
|
||||||
|
@ -54,12 +54,12 @@ bool TileInfo::isUsed() const
|
|||||||
{
|
{
|
||||||
return occupied == ETileType::USED;
|
return occupied == ETileType::USED;
|
||||||
}
|
}
|
||||||
void TileInfo::setOccupied(ETileType::ETileType value)
|
void TileInfo::setOccupied(ETileType value)
|
||||||
{
|
{
|
||||||
occupied = value;
|
occupied = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
ETileType::ETileType TileInfo::getTileType() const
|
ETileType TileInfo::getTileType() const
|
||||||
{
|
{
|
||||||
return occupied;
|
return occupied;
|
||||||
}
|
}
|
||||||
|
@ -28,15 +28,15 @@ public:
|
|||||||
bool isFree() const;
|
bool isFree() const;
|
||||||
bool isUsed() const;
|
bool isUsed() const;
|
||||||
bool isRoad() const;
|
bool isRoad() const;
|
||||||
void setOccupied(ETileType::ETileType value);
|
void setOccupied(ETileType value);
|
||||||
TerrainId getTerrainType() const;
|
TerrainId getTerrainType() const;
|
||||||
ETileType::ETileType getTileType() const;
|
ETileType getTileType() const;
|
||||||
void setTerrainType(TerrainId value);
|
void setTerrainType(TerrainId value);
|
||||||
|
|
||||||
void setRoadType(RoadId type);
|
void setRoadType(RoadId type);
|
||||||
private:
|
private:
|
||||||
float nearestObjectDistance;
|
float nearestObjectDistance;
|
||||||
ETileType::ETileType occupied;
|
ETileType occupied;
|
||||||
TerrainId terrain;
|
TerrainId terrain;
|
||||||
RoadId roadType;
|
RoadId roadType;
|
||||||
};
|
};
|
||||||
|
@ -468,7 +468,7 @@ bool BaseMechanics::adaptGenericProblem(Problem & target) const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BaseMechanics::adaptProblem(ESpellCastProblem::ESpellCastProblem source, Problem & target) const
|
bool BaseMechanics::adaptProblem(ESpellCastProblem source, Problem & target) const
|
||||||
{
|
{
|
||||||
if(source == ESpellCastProblem::OK)
|
if(source == ESpellCastProblem::OK)
|
||||||
return true;
|
return true;
|
||||||
|
@ -180,7 +180,7 @@ class DLL_LINKAGE Mechanics
|
|||||||
public:
|
public:
|
||||||
virtual ~Mechanics();
|
virtual ~Mechanics();
|
||||||
|
|
||||||
virtual bool adaptProblem(ESpellCastProblem::ESpellCastProblem source, Problem & target) const = 0;
|
virtual bool adaptProblem(ESpellCastProblem source, Problem & target) const = 0;
|
||||||
virtual bool adaptGenericProblem(Problem & target) const = 0;
|
virtual bool adaptGenericProblem(Problem & target) const = 0;
|
||||||
|
|
||||||
virtual std::vector<BattleHex> rangeInHexes(BattleHex centralHex) const = 0;
|
virtual std::vector<BattleHex> rangeInHexes(BattleHex centralHex) const = 0;
|
||||||
@ -262,7 +262,7 @@ class DLL_LINKAGE BaseMechanics : public Mechanics
|
|||||||
public:
|
public:
|
||||||
virtual ~BaseMechanics();
|
virtual ~BaseMechanics();
|
||||||
|
|
||||||
bool adaptProblem(ESpellCastProblem::ESpellCastProblem source, Problem & target) const override;
|
bool adaptProblem(ESpellCastProblem source, Problem & target) const override;
|
||||||
bool adaptGenericProblem(Problem & target) const override;
|
bool adaptGenericProblem(Problem & target) const override;
|
||||||
|
|
||||||
int32_t getSpellIndex() const override;
|
int32_t getSpellIndex() const override;
|
||||||
|
@ -617,18 +617,18 @@ int BattleActionProcessor::moveStack(int stack, BattleHex dest)
|
|||||||
if (gameHandler->gameState()->curB->tacticDistance > 0 && creSpeed > 0)
|
if (gameHandler->gameState()->curB->tacticDistance > 0 && creSpeed > 0)
|
||||||
creSpeed = GameConstants::BFIELD_SIZE;
|
creSpeed = GameConstants::BFIELD_SIZE;
|
||||||
|
|
||||||
bool hasWideMoat = vstd::contains_if(gameHandler->battleGetAllObstaclesOnPos(BattleHex(ESiegeHex::GATE_BRIDGE), false), [](const std::shared_ptr<const CObstacleInstance> & obst)
|
bool hasWideMoat = vstd::contains_if(gameHandler->battleGetAllObstaclesOnPos(BattleHex(BattleHex::GATE_BRIDGE), false), [](const std::shared_ptr<const CObstacleInstance> & obst)
|
||||||
{
|
{
|
||||||
return obst->obstacleType == CObstacleInstance::MOAT;
|
return obst->obstacleType == CObstacleInstance::MOAT;
|
||||||
});
|
});
|
||||||
|
|
||||||
auto isGateDrawbridgeHex = [&](BattleHex hex) -> bool
|
auto isGateDrawbridgeHex = [&](BattleHex hex) -> bool
|
||||||
{
|
{
|
||||||
if (hasWideMoat && hex == ESiegeHex::GATE_BRIDGE)
|
if (hasWideMoat && hex == BattleHex::GATE_BRIDGE)
|
||||||
return true;
|
return true;
|
||||||
if (hex == ESiegeHex::GATE_OUTER)
|
if (hex == BattleHex::GATE_OUTER)
|
||||||
return true;
|
return true;
|
||||||
if (hex == ESiegeHex::GATE_INNER)
|
if (hex == BattleHex::GATE_INNER)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -687,11 +687,11 @@ int BattleActionProcessor::moveStack(int stack, BattleHex dest)
|
|||||||
{
|
{
|
||||||
auto needOpenGates = [&](BattleHex hex) -> bool
|
auto needOpenGates = [&](BattleHex hex) -> bool
|
||||||
{
|
{
|
||||||
if (hasWideMoat && hex == ESiegeHex::GATE_BRIDGE)
|
if (hasWideMoat && hex == BattleHex::GATE_BRIDGE)
|
||||||
return true;
|
return true;
|
||||||
if (hex == ESiegeHex::GATE_BRIDGE && i-1 >= 0 && path.first[i-1] == ESiegeHex::GATE_OUTER)
|
if (hex == BattleHex::GATE_BRIDGE && i-1 >= 0 && path.first[i-1] == BattleHex::GATE_OUTER)
|
||||||
return true;
|
return true;
|
||||||
else if (hex == ESiegeHex::GATE_OUTER || hex == ESiegeHex::GATE_INNER)
|
else if (hex == BattleHex::GATE_OUTER || hex == BattleHex::GATE_INNER)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -719,24 +719,24 @@ int BattleActionProcessor::moveStack(int stack, BattleHex dest)
|
|||||||
|
|
||||||
if (!gateMayCloseAtHex.isValid() && dbState != EGateState::CLOSED)
|
if (!gateMayCloseAtHex.isValid() && dbState != EGateState::CLOSED)
|
||||||
{
|
{
|
||||||
if (hex == ESiegeHex::GATE_INNER && i-1 >= 0 && path.first[i-1] != ESiegeHex::GATE_OUTER)
|
if (hex == BattleHex::GATE_INNER && i-1 >= 0 && path.first[i-1] != BattleHex::GATE_OUTER)
|
||||||
{
|
{
|
||||||
gateMayCloseAtHex = path.first[i-1];
|
gateMayCloseAtHex = path.first[i-1];
|
||||||
}
|
}
|
||||||
if (hasWideMoat)
|
if (hasWideMoat)
|
||||||
{
|
{
|
||||||
if (hex == ESiegeHex::GATE_BRIDGE && i-1 >= 0 && path.first[i-1] != ESiegeHex::GATE_OUTER)
|
if (hex == BattleHex::GATE_BRIDGE && i-1 >= 0 && path.first[i-1] != BattleHex::GATE_OUTER)
|
||||||
{
|
{
|
||||||
gateMayCloseAtHex = path.first[i-1];
|
gateMayCloseAtHex = path.first[i-1];
|
||||||
}
|
}
|
||||||
else if (hex == ESiegeHex::GATE_OUTER && i-1 >= 0 &&
|
else if (hex == BattleHex::GATE_OUTER && i-1 >= 0 &&
|
||||||
path.first[i-1] != ESiegeHex::GATE_INNER &&
|
path.first[i-1] != BattleHex::GATE_INNER &&
|
||||||
path.first[i-1] != ESiegeHex::GATE_BRIDGE)
|
path.first[i-1] != BattleHex::GATE_BRIDGE)
|
||||||
{
|
{
|
||||||
gateMayCloseAtHex = path.first[i-1];
|
gateMayCloseAtHex = path.first[i-1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (hex == ESiegeHex::GATE_OUTER && i-1 >= 0 && path.first[i-1] != ESiegeHex::GATE_INNER)
|
else if (hex == BattleHex::GATE_OUTER && i-1 >= 0 && path.first[i-1] != BattleHex::GATE_INNER)
|
||||||
{
|
{
|
||||||
gateMayCloseAtHex = path.first[i-1];
|
gateMayCloseAtHex = path.first[i-1];
|
||||||
}
|
}
|
||||||
|
@ -177,11 +177,11 @@ void BattleProcessor::updateGateState()
|
|||||||
// - if Force Field is cast here, bridge can't open (but can close, in any town)
|
// - if Force Field is cast here, bridge can't open (but can close, in any town)
|
||||||
// - deals moat damage to attacker if bridge is closed (fortress only)
|
// - deals moat damage to attacker if bridge is closed (fortress only)
|
||||||
|
|
||||||
bool hasForceFieldOnBridge = !gameHandler->battleGetAllObstaclesOnPos(BattleHex(ESiegeHex::GATE_BRIDGE), true).empty();
|
bool hasForceFieldOnBridge = !gameHandler->battleGetAllObstaclesOnPos(BattleHex(BattleHex::GATE_BRIDGE), true).empty();
|
||||||
bool hasStackAtGateInner = gameHandler->gameState()->curB->battleGetUnitByPos(BattleHex(ESiegeHex::GATE_INNER), false) != nullptr;
|
bool hasStackAtGateInner = gameHandler->gameState()->curB->battleGetUnitByPos(BattleHex(BattleHex::GATE_INNER), false) != nullptr;
|
||||||
bool hasStackAtGateOuter = gameHandler->gameState()->curB->battleGetUnitByPos(BattleHex(ESiegeHex::GATE_OUTER), false) != nullptr;
|
bool hasStackAtGateOuter = gameHandler->gameState()->curB->battleGetUnitByPos(BattleHex(BattleHex::GATE_OUTER), false) != nullptr;
|
||||||
bool hasStackAtGateBridge = gameHandler->gameState()->curB->battleGetUnitByPos(BattleHex(ESiegeHex::GATE_BRIDGE), false) != nullptr;
|
bool hasStackAtGateBridge = gameHandler->gameState()->curB->battleGetUnitByPos(BattleHex(BattleHex::GATE_BRIDGE), false) != nullptr;
|
||||||
bool hasWideMoat = vstd::contains_if(gameHandler->battleGetAllObstaclesOnPos(BattleHex(ESiegeHex::GATE_BRIDGE), false), [](const std::shared_ptr<const CObstacleInstance> & obst)
|
bool hasWideMoat = vstd::contains_if(gameHandler->battleGetAllObstaclesOnPos(BattleHex(BattleHex::GATE_BRIDGE), false), [](const std::shared_ptr<const CObstacleInstance> & obst)
|
||||||
{
|
{
|
||||||
return obst->obstacleType == CObstacleInstance::MOAT;
|
return obst->obstacleType == CObstacleInstance::MOAT;
|
||||||
});
|
});
|
||||||
|
@ -16,7 +16,7 @@ class IGameInfoCallbackMock : public IGameInfoCallback
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//various
|
//various
|
||||||
MOCK_CONST_METHOD1(getDate, int(Date::EDateType));
|
MOCK_CONST_METHOD1(getDate, int(Date));
|
||||||
MOCK_CONST_METHOD2(isAllowed, bool(int32_t, int32_t));
|
MOCK_CONST_METHOD2(isAllowed, bool(int32_t, int32_t));
|
||||||
|
|
||||||
//player
|
//player
|
||||||
|
@ -18,7 +18,7 @@ namespace spells
|
|||||||
class MechanicsMock : public Mechanics
|
class MechanicsMock : public Mechanics
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MOCK_CONST_METHOD2(adaptProblem, bool(ESpellCastProblem::ESpellCastProblem, Problem &));
|
MOCK_CONST_METHOD2(adaptProblem, bool(ESpellCastProblem, Problem &));
|
||||||
MOCK_CONST_METHOD1(adaptGenericProblem, bool(Problem &));
|
MOCK_CONST_METHOD1(adaptGenericProblem, bool(Problem &));
|
||||||
|
|
||||||
MOCK_CONST_METHOD1(rangeInHexes, std::vector<BattleHex>(BattleHex));
|
MOCK_CONST_METHOD1(rangeInHexes, std::vector<BattleHex>(BattleHex));
|
||||||
|
Loading…
Reference in New Issue
Block a user