1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00

Fix getting battlefield crash

This commit is contained in:
Andrii Danylchenko 2022-07-09 19:00:03 +03:00
parent ac2bd4f79c
commit a454edacea
5 changed files with 15 additions and 1 deletions

View File

@ -151,6 +151,12 @@ int3 CGHeroInstance::convertPosition(int3 src, bool toh3m) //toh3m=true: manifes
return src;
}
}
BattleField CGHeroInstance::getBattlefield() const
{
return BattleField::NONE;
}
int3 CGHeroInstance::getPosition(bool h3m) const //h3m=true - returns position of hero object; h3m=false - returns position of hero 'manifestation'
{
if (h3m)

View File

@ -270,6 +270,8 @@ public:
void afterAddToMap(CMap * map) override;
void updateFrom(const JsonNode & data) override;
BattleField getBattlefield() const override;
protected:
void setPropertyDer(ui8 what, ui32 val) override;//synchr
///common part of hero instance and hero definition

View File

@ -159,7 +159,7 @@ public:
std::set<int3> getBlockedOffsets() const; //returns set of relative positions blocked by this object
bool isVisitable() const; //returns true if object is visitable
BattleField getBattlefield() const;
virtual BattleField getBattlefield() const;
virtual bool isTile2Terrain() const { return false; }

View File

@ -1406,6 +1406,11 @@ void CGArtifact::pick(const CGHeroInstance * h) const
cb->removeObject(this);
}
BattleField CGArtifact::getBattlefield() const
{
return BattleField::NONE;
}
void CGArtifact::battleFinished(const CGHeroInstance *hero, const BattleResult &result) const
{
if(result.winner == 0) //attacker won

View File

@ -201,6 +201,7 @@ public:
void initObj(CRandomGenerator & rand) override;
void afterAddToMap(CMap * map) override;
BattleField getBattlefield() const override;
template <typename Handler> void serialize(Handler &h, const int version)
{