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

Fix getting battlefield crash

This commit is contained in:
Andrii Danylchenko 2022-07-09 19:00:03 +03:00
parent 4b4cc3cf4b
commit 665bd4346e
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; 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' int3 CGHeroInstance::getPosition(bool h3m) const //h3m=true - returns position of hero object; h3m=false - returns position of hero 'manifestation'
{ {
if (h3m) if (h3m)

View File

@ -270,6 +270,8 @@ public:
void afterAddToMap(CMap * map) override; void afterAddToMap(CMap * map) override;
void updateFrom(const JsonNode & data) override; void updateFrom(const JsonNode & data) override;
BattleField getBattlefield() const override;
protected: protected:
void setPropertyDer(ui8 what, ui32 val) override;//synchr void setPropertyDer(ui8 what, ui32 val) override;//synchr
///common part of hero instance and hero definition ///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 std::set<int3> getBlockedOffsets() const; //returns set of relative positions blocked by this object
bool isVisitable() const; //returns true if object is visitable bool isVisitable() const; //returns true if object is visitable
BattleField getBattlefield() const; virtual BattleField getBattlefield() const;
virtual bool isTile2Terrain() const { return false; } virtual bool isTile2Terrain() const { return false; }

View File

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

View File

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