diff --git a/source/MobTypesManager.h b/source/MobTypesManager.h index a1b2dfdd..941dac72 100644 --- a/source/MobTypesManager.h +++ b/source/MobTypesManager.h @@ -23,7 +23,7 @@ protected : static tMobTypes2Names& m_MobsTypes2Names(); static tMobTypes2Names MobTypes2NamesInitializerBeforeCx11(); - typedef const std::map tMobType2Family; //MG TODO : this is redundancy with cMonster::getFamily() methods. But almost all the management of MobType is redundancy in this project. Maybe is it optimization, or just historical TODO : understand and do something about it. + typedef const std::map tMobType2Family; static tMobType2Family& m_MobsType2Family(); static tMobType2Family MobType2FamilyInitializerBeforeCx11(); diff --git a/source/Mobs/AggressiveMonster.cpp b/source/Mobs/AggressiveMonster.cpp index d4852337..93dba6d7 100644 --- a/source/Mobs/AggressiveMonster.cpp +++ b/source/Mobs/AggressiveMonster.cpp @@ -95,12 +95,3 @@ void cAggressiveMonster::Tick(float a_Dt, cChunk & a_Chunk) } -cMonster::eFamily cAggressiveMonster::GetMobFamily() const -{ - return mfHostile; -} - - - - - diff --git a/source/Mobs/AggressiveMonster.h b/source/Mobs/AggressiveMonster.h index c1641954..f22ed5b8 100644 --- a/source/Mobs/AggressiveMonster.h +++ b/source/Mobs/AggressiveMonster.h @@ -20,7 +20,6 @@ public: virtual void EventSeePlayer(cEntity *) override; - virtual eFamily GetMobFamily(void) const override; protected: float m_ChaseTime; diff --git a/source/Mobs/Bat.cpp b/source/Mobs/Bat.cpp index ff86f413..715f2548 100644 --- a/source/Mobs/Bat.cpp +++ b/source/Mobs/Bat.cpp @@ -13,7 +13,3 @@ cBat::cBat(void) : } -cMonster::eFamily cBat::GetMobFamily() const -{ - return mfAmbient; -} diff --git a/source/Mobs/Bat.h b/source/Mobs/Bat.h index e0afb574..fd3e00a0 100644 --- a/source/Mobs/Bat.h +++ b/source/Mobs/Bat.h @@ -17,7 +17,6 @@ public: CLASS_PROTODEF(cBat); - virtual eFamily GetMobFamily(void) const override; } ; diff --git a/source/Mobs/Monster.cpp b/source/Mobs/Monster.cpp index a42ae30e..b378b2bc 100644 --- a/source/Mobs/Monster.cpp +++ b/source/Mobs/Monster.cpp @@ -9,6 +9,7 @@ #include "../Entities/Player.h" #include "../Defines.h" #include "../MonsterConfig.h" +#include "../MobTypesManager.h" #include "../MersenneTwister.h" #include "../Vector3f.h" @@ -17,6 +18,7 @@ #include "../Tracer.h" #include "../Chunk.h" + // #include "../../iniFile/iniFile.h" @@ -510,3 +512,7 @@ void cMonster::HandleDaylightBurning(cChunk & a_Chunk) +cMonster::eFamily cMonster::GetMobFamily(void) const +{ + return cMobTypesManager::getFamilyFromType(GetMobTypeAsEnum()); +} diff --git a/source/Mobs/Monster.h b/source/Mobs/Monster.h index ef7904e8..e08fd518 100644 --- a/source/Mobs/Monster.h +++ b/source/Mobs/Monster.h @@ -94,7 +94,8 @@ public: char GetMobType(void) const {return m_MobType; } // MG TODO : see if we can delete this one. eType GetMobTypeAsEnum(void) const {return (eType)m_MobType; } // MG TODO : see if we should store m_MobType as enum instead of char. - virtual eFamily GetMobFamily(void) const = 0; + eFamily GetMobFamily(void) const; + const char * GetState(); void SetState(const AString & str); diff --git a/source/Mobs/PassiveMonster.cpp b/source/Mobs/PassiveMonster.cpp index 3d7b8c8a..8c69c805 100644 --- a/source/Mobs/PassiveMonster.cpp +++ b/source/Mobs/PassiveMonster.cpp @@ -55,11 +55,5 @@ void cPassiveMonster::Tick(float a_Dt, cChunk & a_Chunk) -cMonster::eFamily cPassiveMonster::GetMobFamily() const -{ - return mfPassive; -} - - diff --git a/source/Mobs/PassiveMonster.h b/source/Mobs/PassiveMonster.h index 9d355772..908bb0ce 100644 --- a/source/Mobs/PassiveMonster.h +++ b/source/Mobs/PassiveMonster.h @@ -20,7 +20,6 @@ public: /// When hit by someone, run away virtual void DoTakeDamage(TakeDamageInfo & a_TDI) override; - virtual eFamily GetMobFamily(void) const override; } ; diff --git a/source/Mobs/Squid.cpp b/source/Mobs/Squid.cpp index 50265aea..e6a44079 100644 --- a/source/Mobs/Squid.cpp +++ b/source/Mobs/Squid.cpp @@ -54,7 +54,3 @@ void cSquid::Tick(float a_Dt, cChunk & a_Chunk) -cMonster::eFamily cSquid::GetMobFamily() const -{ - return mfWater; -} diff --git a/source/Mobs/Squid.h b/source/Mobs/Squid.h index d5f3a74d..ad299b95 100644 --- a/source/Mobs/Squid.h +++ b/source/Mobs/Squid.h @@ -21,7 +21,6 @@ public: virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = NULL) override; - virtual eFamily GetMobFamily(void) const override; } ;