mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
vcmi: add getNativeTerrain method to factions
This commit is contained in:
parent
e0715a76c8
commit
b7d6270272
@ -15,12 +15,14 @@
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
class FactionID;
|
||||
enum class ETerrainId;
|
||||
template<typename T> class Identifier;
|
||||
|
||||
class DLL_LINKAGE Faction : public EntityT<FactionID>
|
||||
{
|
||||
public:
|
||||
virtual bool hasTown() const = 0;
|
||||
|
||||
virtual Identifier<ETerrainId> getNativeTerrain() const = 0;
|
||||
};
|
||||
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
@ -335,7 +335,7 @@ TerrainId CCreature::getNativeTerrain() const
|
||||
//and in the CGHeroInstance::getNativeTerrain() to setup movement bonuses or/and penalties.
|
||||
return hasBonus(selectorNoTerrainPenalty, cachingStringNoTerrainPenalty)
|
||||
? TerrainId(ETerrainId::ANY_TERRAIN)
|
||||
: (*VLC->townh)[faction]->nativeTerrain;
|
||||
: VLC->factions()->getByIndex(faction)->getNativeTerrain();
|
||||
}
|
||||
|
||||
void CCreature::updateFrom(const JsonNode & data)
|
||||
|
@ -161,6 +161,11 @@ bool CFaction::hasTown() const
|
||||
return town != nullptr;
|
||||
}
|
||||
|
||||
TerrainId CFaction::getNativeTerrain() const
|
||||
{
|
||||
return nativeTerrain;
|
||||
}
|
||||
|
||||
void CFaction::updateFrom(const JsonNode & data)
|
||||
{
|
||||
|
||||
|
@ -217,6 +217,7 @@ public:
|
||||
std::string getNameTextID() const override;
|
||||
|
||||
bool hasTown() const override;
|
||||
TerrainId getNativeTerrain() const override;
|
||||
|
||||
void updateFrom(const JsonNode & data);
|
||||
void serializeJson(JsonSerializeFormat & handler);
|
||||
|
Loading…
Reference in New Issue
Block a user