mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +02:00
vcmi: specialize native terrain entity
Specialize native terrain entity for all object that have native terrain. Allow creatures to take global bonuses into account when checking for native terrain.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vcmi/Entity.h>
|
||||
#include <vcmi/spells/Caster.h>
|
||||
|
||||
#include "../HeroBonus.h"
|
||||
@@ -40,7 +41,7 @@ namespace BattlePhases
|
||||
|
||||
class CUnitState;
|
||||
|
||||
class DLL_LINKAGE Unit : public IUnitInfo, public spells::Caster, public virtual IBonusBearer
|
||||
class DLL_LINKAGE Unit : public IUnitInfo, public spells::Caster, public virtual IBonusBearer, public WithBonuses, public WithNativeTerrain
|
||||
{
|
||||
public:
|
||||
virtual ~Unit();
|
||||
@@ -126,6 +127,11 @@ public:
|
||||
|
||||
int getRawSurrenderCost() const;
|
||||
|
||||
//WithBonuses
|
||||
const IBonusBearer* getBonusBearer() const override;
|
||||
//WithNativeTerrain
|
||||
TerrainId getNativeTerrain() const override;
|
||||
|
||||
//NOTE: save could possibly be const, but this requires heavy changes to Json serialization,
|
||||
//also this method should be called only after modifying object
|
||||
virtual void save(JsonNode & data) = 0;
|
||||
|
||||
Reference in New Issue
Block a user