From 033af999ba419afadfa1830d288b021e7d9bc1f5 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Fri, 21 Dec 2012 12:21:20 +0000 Subject: Reworked the IsA() / GetClass() framework to actually be useful. Added GetParentClass(). git-svn-id: http://mc-server.googlecode.com/svn/trunk@1090 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Mobs/Bat.cpp | 10 ---------- source/Mobs/Bat.h | 2 +- source/Mobs/Blaze.cpp | 9 --------- source/Mobs/Blaze.h | 4 ++-- source/Mobs/Cavespider.cpp | 10 +--------- source/Mobs/Cavespider.h | 2 +- source/Mobs/Chicken.cpp | 9 --------- source/Mobs/Chicken.h | 2 +- source/Mobs/Cow.cpp | 9 --------- source/Mobs/Cow.h | 2 +- source/Mobs/Creeper.cpp | 9 --------- source/Mobs/Creeper.h | 2 +- source/Mobs/Enderman.cpp | 9 --------- source/Mobs/Enderman.h | 2 +- source/Mobs/Ghast.cpp | 9 --------- source/Mobs/Ghast.h | 2 +- source/Mobs/Magmacube.cpp | 9 --------- source/Mobs/Magmacube.h | 2 +- source/Mobs/Monster.cpp | 19 ------------------- source/Mobs/Monster.h | 5 ++--- source/Mobs/Mooshroom.cpp | 9 --------- source/Mobs/Mooshroom.h | 2 +- source/Mobs/Ocelot.cpp | 10 ---------- source/Mobs/Ocelot.h | 2 +- source/Mobs/Pig.cpp | 9 --------- source/Mobs/Pig.h | 2 +- source/Mobs/Sheep.cpp | 9 --------- source/Mobs/Sheep.h | 2 +- source/Mobs/Silverfish.cpp | 11 ++--------- source/Mobs/Silverfish.h | 21 ++++++++++++++++----- source/Mobs/Skeleton.cpp | 9 --------- source/Mobs/Skeleton.h | 2 +- source/Mobs/Slime.cpp | 9 --------- source/Mobs/Slime.h | 8 ++++++-- source/Mobs/Spider.cpp | 9 --------- source/Mobs/Spider.h | 4 ++-- source/Mobs/Squid.cpp | 9 --------- source/Mobs/Squid.h | 3 ++- source/Mobs/Villager.cpp | 9 --------- source/Mobs/Villager.h | 2 +- source/Mobs/Witch.cpp | 9 --------- source/Mobs/Witch.h | 2 +- source/Mobs/Wolf.cpp | 16 +++++++--------- source/Mobs/Wolf.h | 21 ++++++++++++++++----- source/Mobs/Zombie.cpp | 9 --------- source/Mobs/Zombie.h | 4 ++-- source/Mobs/Zombiepigman.cpp | 9 --------- source/Mobs/Zombiepigman.h | 4 ++-- 48 files changed, 75 insertions(+), 267 deletions(-) (limited to 'source/Mobs') diff --git a/source/Mobs/Bat.cpp b/source/Mobs/Bat.cpp index 24ce88184..e77cfd46d 100644 --- a/source/Mobs/Bat.cpp +++ b/source/Mobs/Bat.cpp @@ -16,13 +16,3 @@ cBat::cBat(void) - -bool cBat::IsA(const char * a_EntityType) -{ - return ((strcmp(a_EntityType, "cBat") == 0) || super::IsA(a_EntityType)); -} - - - - - diff --git a/source/Mobs/Bat.h b/source/Mobs/Bat.h index 7965072fc..91279889f 100644 --- a/source/Mobs/Bat.h +++ b/source/Mobs/Bat.h @@ -15,7 +15,7 @@ class cBat : public: cBat(void); - virtual bool IsA(const char * a_EntityType) override; + CLASS_PROTODEF(cBat); } ; diff --git a/source/Mobs/Blaze.cpp b/source/Mobs/Blaze.cpp index e53cbb44d..c3a1fbabf 100644 --- a/source/Mobs/Blaze.cpp +++ b/source/Mobs/Blaze.cpp @@ -17,15 +17,6 @@ cBlaze::cBlaze(void) -bool cBlaze::IsA(const char * a_EntityType) -{ - return ((strcmp(a_EntityType, "cBlaze") == 0) || super::IsA(a_EntityType)); -} - - - - - void cBlaze::GetDrops(cItems & a_Drops, cPawn * a_Killer) { AddRandomDropItem(a_Drops, 0, 1, E_ITEM_BLAZE_ROD); diff --git a/source/Mobs/Blaze.h b/source/Mobs/Blaze.h index 6dca7fed0..a897d7e8a 100644 --- a/source/Mobs/Blaze.h +++ b/source/Mobs/Blaze.h @@ -15,8 +15,8 @@ class cBlaze : public: cBlaze(void); - virtual bool IsA(const char * a_EntityType) override; - + CLASS_PROTODEF(cBlaze); + virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override; } ; diff --git a/source/Mobs/Cavespider.cpp b/source/Mobs/Cavespider.cpp index 9336f8f5b..94eadf12d 100644 --- a/source/Mobs/Cavespider.cpp +++ b/source/Mobs/Cavespider.cpp @@ -17,18 +17,10 @@ cCavespider::cCavespider(void) -bool cCavespider::IsA(const char * a_EntityType) -{ - return ((strcmp(a_EntityType, "cCaveSpider") == 0) || super::IsA(a_EntityType)); -} - - - - - void cCavespider::Tick(float a_Dt) { super::Tick(a_Dt); + // TODO: Check vanilla if cavespiders really get passive during the day m_EMPersonality = (GetWorld()->GetTimeOfDay() < (12000 + 1000)) ? PASSIVE : AGGRESSIVE; } diff --git a/source/Mobs/Cavespider.h b/source/Mobs/Cavespider.h index 10b462bea..33f67b6f5 100644 --- a/source/Mobs/Cavespider.h +++ b/source/Mobs/Cavespider.h @@ -15,7 +15,7 @@ class cCavespider : public: cCavespider(void); - virtual bool IsA(const char * a_EntityType) override; + CLASS_PROTODEF(cCaveSpider); virtual void Tick(float a_Dt) override; virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override; diff --git a/source/Mobs/Chicken.cpp b/source/Mobs/Chicken.cpp index cd282f5ed..fe6526d76 100644 --- a/source/Mobs/Chicken.cpp +++ b/source/Mobs/Chicken.cpp @@ -23,15 +23,6 @@ cChicken::cChicken(void) -bool cChicken::IsA(const char * a_EntityType) -{ - return ((strcmp(a_EntityType, "cChicken") == 0) || super::IsA(a_EntityType)); -} - - - - - void cChicken::GetDrops(cItems & a_Drops, cPawn * a_Killer) { AddRandomDropItem(a_Drops, 0, 2, E_ITEM_FEATHER); diff --git a/source/Mobs/Chicken.h b/source/Mobs/Chicken.h index 49c88a059..ed36df4d5 100644 --- a/source/Mobs/Chicken.h +++ b/source/Mobs/Chicken.h @@ -15,7 +15,7 @@ class cChicken : public: cChicken(void); - virtual bool IsA(const char * a_EntityType) override; + CLASS_PROTODEF(cChicken); virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override; } ; diff --git a/source/Mobs/Cow.cpp b/source/Mobs/Cow.cpp index 8e1837434..f6ae5b7da 100644 --- a/source/Mobs/Cow.cpp +++ b/source/Mobs/Cow.cpp @@ -23,15 +23,6 @@ cCow::cCow(void) -bool cCow::IsA(const char * a_EntityType) -{ - return ((strcmp(a_EntityType, "cCow") == 0) || super::IsA(a_EntityType)); -} - - - - - void cCow::GetDrops(cItems & a_Drops, cPawn * a_Killer) { AddRandomDropItem(a_Drops, 0, 2, E_ITEM_LEATHER); diff --git a/source/Mobs/Cow.h b/source/Mobs/Cow.h index cc7db7af9..d50c8df08 100644 --- a/source/Mobs/Cow.h +++ b/source/Mobs/Cow.h @@ -15,7 +15,7 @@ class cCow : public: cCow(); - virtual bool IsA(const char * a_EntityType) override; + CLASS_PROTODEF(cCow); virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override; } ; diff --git a/source/Mobs/Creeper.cpp b/source/Mobs/Creeper.cpp index d247df96c..e3610198f 100644 --- a/source/Mobs/Creeper.cpp +++ b/source/Mobs/Creeper.cpp @@ -17,15 +17,6 @@ cCreeper::cCreeper(void) -bool cCreeper::IsA(const char * a_EntityType) -{ - return ((strcmp(a_EntityType, "cCreeper") == 0) || super::IsA(a_EntityType)); -} - - - - - void cCreeper::GetDrops(cItems & a_Drops, cPawn * a_Killer) { AddRandomDropItem(a_Drops, 0, 2, E_ITEM_GUNPOWDER); diff --git a/source/Mobs/Creeper.h b/source/Mobs/Creeper.h index bd6b1e992..721847cb5 100644 --- a/source/Mobs/Creeper.h +++ b/source/Mobs/Creeper.h @@ -15,7 +15,7 @@ class cCreeper : public: cCreeper(void); - virtual bool IsA(const char * a_EntityType) override; + CLASS_PROTODEF(cCreeper); virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override; } ; diff --git a/source/Mobs/Enderman.cpp b/source/Mobs/Enderman.cpp index b41f8f405..2739265f1 100644 --- a/source/Mobs/Enderman.cpp +++ b/source/Mobs/Enderman.cpp @@ -17,15 +17,6 @@ cEnderman::cEnderman(void) -bool cEnderman::IsA(const char * a_EntityType) -{ - return ((strcmp(a_EntityType, "cEnderman") == 0) || super::IsA(a_EntityType)); -} - - - - - void cEnderman::Tick(float a_Dt) { cMonster::Tick(a_Dt); diff --git a/source/Mobs/Enderman.h b/source/Mobs/Enderman.h index b175e8b1b..adcbe3b4b 100644 --- a/source/Mobs/Enderman.h +++ b/source/Mobs/Enderman.h @@ -15,7 +15,7 @@ class cEnderman : public: cEnderman(void); - virtual bool IsA(const char * a_EntityType) override; + CLASS_PROTODEF(cEnderman); virtual void Tick(float a_Dt) override; virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override; diff --git a/source/Mobs/Ghast.cpp b/source/Mobs/Ghast.cpp index 3bcb5e4ab..0e1656b95 100644 --- a/source/Mobs/Ghast.cpp +++ b/source/Mobs/Ghast.cpp @@ -17,15 +17,6 @@ cGhast::cGhast(void) -bool cGhast::IsA(const char * a_EntityType) -{ - return ((strcmp(a_EntityType, "cGhast") == 0) || super::IsA(a_EntityType)); -} - - - - - void cGhast::GetDrops(cItems & a_Drops, cPawn * a_Killer) { AddRandomDropItem(a_Drops, 0, 2, E_ITEM_GUNPOWDER); diff --git a/source/Mobs/Ghast.h b/source/Mobs/Ghast.h index e6248b656..b560d6907 100644 --- a/source/Mobs/Ghast.h +++ b/source/Mobs/Ghast.h @@ -15,7 +15,7 @@ class cGhast : public: cGhast(void); - virtual bool IsA(const char * a_EntityType) override; + CLASS_PROTODEF(cGhast); virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override; } ; diff --git a/source/Mobs/Magmacube.cpp b/source/Mobs/Magmacube.cpp index 21c6f17b3..a71463928 100644 --- a/source/Mobs/Magmacube.cpp +++ b/source/Mobs/Magmacube.cpp @@ -17,15 +17,6 @@ cMagmacube::cMagmacube() -bool cMagmacube::IsA(const char * a_EntityType) -{ - return ((strcmp(a_EntityType, "cMagmacube") == 0) || super::IsA(a_EntityType)); -} - - - - - void cMagmacube::GetDrops(cItems & a_Drops, cPawn * a_Killer) { AddRandomDropItem(a_Drops, 0, 1, E_ITEM_MAGMA_CREAM); diff --git a/source/Mobs/Magmacube.h b/source/Mobs/Magmacube.h index 8c61a7853..863ba7072 100644 --- a/source/Mobs/Magmacube.h +++ b/source/Mobs/Magmacube.h @@ -15,7 +15,7 @@ class cMagmacube : public: cMagmacube(); - virtual bool IsA(const char * a_EntityType) override; + CLASS_PROTODEF(cMagmacube); virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override; } ; diff --git a/source/Mobs/Monster.cpp b/source/Mobs/Monster.cpp index 88cfcd992..e79e6c00f 100644 --- a/source/Mobs/Monster.cpp +++ b/source/Mobs/Monster.cpp @@ -58,25 +58,6 @@ cMonster::cMonster(void) -cMonster::~cMonster() -{ - LOGD("cMonster::~cMonster()"); -} - - - - - -bool cMonster::IsA( const char* a_EntityType ) -{ - if( strcmp( a_EntityType, "cMonster" ) == 0 ) return true; - return cPawn::IsA( a_EntityType ); -} - - - - - void cMonster::SpawnOn(cClientHandle & a_Client) { a_Client.SendSpawnMob(*this); diff --git a/source/Mobs/Monster.h b/source/Mobs/Monster.h index 6d3d1d775..051477162 100644 --- a/source/Mobs/Monster.h +++ b/source/Mobs/Monster.h @@ -26,10 +26,9 @@ public: // tolua_end cMonster(void); - virtual ~cMonster(); - - virtual bool IsA(const char * a_EntityType); + CLASS_PROTODEF(cMonster); + virtual void SpawnOn(cClientHandle & a_ClientHandle) override; virtual void Tick(float a_Dt) override; diff --git a/source/Mobs/Mooshroom.cpp b/source/Mobs/Mooshroom.cpp index 0732b3fea..aca32873f 100644 --- a/source/Mobs/Mooshroom.cpp +++ b/source/Mobs/Mooshroom.cpp @@ -23,15 +23,6 @@ cMooshroom::cMooshroom(void) -bool cMooshroom::IsA(const char * a_EntityType) -{ - return ((strcmp(a_EntityType, "cMooshroom") == 0) || super::IsA(a_EntityType)); -} - - - - - void cMooshroom::GetDrops(cItems & a_Drops, cPawn * a_Killer) { AddRandomDropItem(a_Drops, 0, 2, E_ITEM_LEATHER); diff --git a/source/Mobs/Mooshroom.h b/source/Mobs/Mooshroom.h index b15bfc76f..c50c04ed8 100644 --- a/source/Mobs/Mooshroom.h +++ b/source/Mobs/Mooshroom.h @@ -15,7 +15,7 @@ class cMooshroom : public: cMooshroom(void); - virtual bool IsA(const char * a_EntityType); + CLASS_PROTODEF(cMooshroom); virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override; } ; diff --git a/source/Mobs/Ocelot.cpp b/source/Mobs/Ocelot.cpp index 374161bde..02d5ccc37 100644 --- a/source/Mobs/Ocelot.cpp +++ b/source/Mobs/Ocelot.cpp @@ -16,13 +16,3 @@ cOcelot::cOcelot() - -bool cOcelot::IsA(const char * a_EntityType) -{ - return ((strcmp(a_EntityType, "cOcelot") == 0) || super::IsA(a_EntityType)); -} - - - - - diff --git a/source/Mobs/Ocelot.h b/source/Mobs/Ocelot.h index 07095c660..acda6a1e6 100644 --- a/source/Mobs/Ocelot.h +++ b/source/Mobs/Ocelot.h @@ -15,7 +15,7 @@ class cOcelot : public: cOcelot(); - virtual bool IsA(const char * a_EntityType) override; + CLASS_PROTODEF(cOcelot); } ; diff --git a/source/Mobs/Pig.cpp b/source/Mobs/Pig.cpp index 8abd0a10e..0e0d4e875 100644 --- a/source/Mobs/Pig.cpp +++ b/source/Mobs/Pig.cpp @@ -17,15 +17,6 @@ cPig::cPig(void) -bool cPig::IsA(const char * a_EntityType) -{ - return ((strcmp(a_EntityType, "cPig") == 0) || super::IsA(a_EntityType)); -} - - - - - void cPig::GetDrops(cItems & a_Drops, cPawn * a_Killer) { AddRandomDropItem(a_Drops, 1, 3, (GetMetaData() == BURNING) ? E_ITEM_COOKED_PORKCHOP : E_ITEM_RAW_MEAT); diff --git a/source/Mobs/Pig.h b/source/Mobs/Pig.h index 018477778..995f2a593 100644 --- a/source/Mobs/Pig.h +++ b/source/Mobs/Pig.h @@ -15,7 +15,7 @@ class cPig : public: cPig(void); - virtual bool IsA(const char * a_EntityType) override; + CLASS_PROTODEF(cPig); virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override; } ; diff --git a/source/Mobs/Sheep.cpp b/source/Mobs/Sheep.cpp index 9c67aba29..997184dcf 100644 --- a/source/Mobs/Sheep.cpp +++ b/source/Mobs/Sheep.cpp @@ -20,15 +20,6 @@ cSheep::cSheep(void) : -bool cSheep::IsA(const char * a_EntityType) -{ - return ((strcmp(a_EntityType, "cSheep") == 0) || super::IsA(a_EntityType)); -} - - - - - void cSheep::GetDrops(cItems & a_Drops, cPawn * a_Killer) { if (!m_IsSheared) diff --git a/source/Mobs/Sheep.h b/source/Mobs/Sheep.h index ea43537cc..801cf97d7 100644 --- a/source/Mobs/Sheep.h +++ b/source/Mobs/Sheep.h @@ -18,7 +18,7 @@ public: bool m_IsSheared; NIBBLETYPE m_WoolColor; // Uses E_META_WOOL_ constants for colors - virtual bool IsA(const char * a_EntityType) override; + CLASS_PROTODEF(cSheep); virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override; } ; diff --git a/source/Mobs/Silverfish.cpp b/source/Mobs/Silverfish.cpp index 1525966c4..a8ced0b6b 100644 --- a/source/Mobs/Silverfish.cpp +++ b/source/Mobs/Silverfish.cpp @@ -7,19 +7,12 @@ -cSilverfish::cSilverfish() +cSilverfish::cSilverfish(void) { m_MobType = 60; GetMonsterConfig("Silverfish"); } -cSilverfish::~cSilverfish() -{ -} -bool cSilverfish::IsA( const char* a_EntityType ) -{ - if( strcmp( a_EntityType, "cSilverfish" ) == 0 ) return true; - return cMonster::IsA( a_EntityType ); -} + diff --git a/source/Mobs/Silverfish.h b/source/Mobs/Silverfish.h index 453995ec6..4e4fbd11c 100644 --- a/source/Mobs/Silverfish.h +++ b/source/Mobs/Silverfish.h @@ -1,12 +1,23 @@ + #pragma once #include "AggressiveMonster.h" -class cSilverfish : public cAggressiveMonster + + + + +class cSilverfish : + public cAggressiveMonster { + typedef cAggressiveMonster super; + public: - cSilverfish(); - ~cSilverfish(); + cSilverfish(void); + + CLASS_PROTODEF(cSilverfish); +} ; + + + - virtual bool IsA(const char * a_EntityType); -}; diff --git a/source/Mobs/Skeleton.cpp b/source/Mobs/Skeleton.cpp index f219713e0..684e1e13d 100644 --- a/source/Mobs/Skeleton.cpp +++ b/source/Mobs/Skeleton.cpp @@ -17,15 +17,6 @@ cSkeleton::cSkeleton(void) -bool cSkeleton::IsA( const char* a_EntityType ) -{ - return ((strcmp(a_EntityType, "cSkeleton") == 0) || super::IsA(a_EntityType)); -} - - - - - void cSkeleton::Tick(float a_Dt) { cMonster::Tick(a_Dt); diff --git a/source/Mobs/Skeleton.h b/source/Mobs/Skeleton.h index 101358f18..476b438e5 100644 --- a/source/Mobs/Skeleton.h +++ b/source/Mobs/Skeleton.h @@ -15,7 +15,7 @@ class cSkeleton : public: cSkeleton(); - virtual bool IsA(const char * a_EntityType) override; + CLASS_PROTODEF(cSkeleton); virtual void Tick(float a_Dt) override; virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override; diff --git a/source/Mobs/Slime.cpp b/source/Mobs/Slime.cpp index d85b97c97..5df887934 100644 --- a/source/Mobs/Slime.cpp +++ b/source/Mobs/Slime.cpp @@ -19,15 +19,6 @@ cSlime::cSlime(void) -bool cSlime::IsA(const char * a_EntityType) -{ - return ((strcmp(a_EntityType, "cSlime") == 0) || super::IsA(a_EntityType)); -} - - - - - void cSlime::GetDrops(cItems & a_Drops, cPawn * a_Killer) { // TODO: only when tiny diff --git a/source/Mobs/Slime.h b/source/Mobs/Slime.h index 1f155e6f8..17bf0807a 100644 --- a/source/Mobs/Slime.h +++ b/source/Mobs/Slime.h @@ -3,15 +3,19 @@ #include "AggressiveMonster.h" + + + + class cSlime : public cAggressiveMonster { typedef cAggressiveMonster super; public: - cSlime(); + cSlime(void); - virtual bool IsA(const char * a_EntityType) override; + CLASS_PROTODEF(cSlime); virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override; } ; diff --git a/source/Mobs/Spider.cpp b/source/Mobs/Spider.cpp index 82a24f9b3..1e1338b58 100644 --- a/source/Mobs/Spider.cpp +++ b/source/Mobs/Spider.cpp @@ -17,15 +17,6 @@ cSpider::cSpider() -bool cSpider::IsA(const char * a_EntityType) -{ - return ((strcmp(a_EntityType, "cSpider") == 0) || super::IsA(a_EntityType)); -} - - - - - void cSpider::GetDrops(cItems & a_Drops, cPawn * a_Killer) { AddRandomDropItem(a_Drops, 0, 2, E_ITEM_STRING); diff --git a/source/Mobs/Spider.h b/source/Mobs/Spider.h index c375df593..17a954a02 100644 --- a/source/Mobs/Spider.h +++ b/source/Mobs/Spider.h @@ -13,9 +13,9 @@ class cSpider : typedef cAggressiveMonster super; public: - cSpider(); + cSpider(void); - virtual bool IsA(const char * a_EntityType) override; + CLASS_PROTODEF(cSpider); virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override; } ; diff --git a/source/Mobs/Squid.cpp b/source/Mobs/Squid.cpp index 720eb05e5..b3df8711a 100644 --- a/source/Mobs/Squid.cpp +++ b/source/Mobs/Squid.cpp @@ -18,15 +18,6 @@ cSquid::cSquid() -bool cSquid::IsA(const char * a_EntityType) -{ - return ((strcmp(a_EntityType, "cSquid") == 0) || super::IsA(a_EntityType)); -} - - - - - void cSquid::GetDrops(cItems & a_Drops, cPawn * a_Killer) { // Drops 0-3 Ink Sacs diff --git a/source/Mobs/Squid.h b/source/Mobs/Squid.h index 6500a3fea..4a8de4d28 100644 --- a/source/Mobs/Squid.h +++ b/source/Mobs/Squid.h @@ -17,7 +17,8 @@ public: virtual void Tick(float a_Dt) override; - virtual bool IsA(const char * a_EntityType) override; + CLASS_PROTODEF(cSquid); + virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override; } ; diff --git a/source/Mobs/Villager.cpp b/source/Mobs/Villager.cpp index 0e6d364d7..c97bb714f 100644 --- a/source/Mobs/Villager.cpp +++ b/source/Mobs/Villager.cpp @@ -16,12 +16,3 @@ cVillager::cVillager() - -bool cVillager::IsA(const char * a_EntityType) -{ - return ((strcmp(a_EntityType, "cVillager") == 0) || super::IsA(a_EntityType)); -} - - - - diff --git a/source/Mobs/Villager.h b/source/Mobs/Villager.h index 74a6af868..4b50ed35e 100644 --- a/source/Mobs/Villager.h +++ b/source/Mobs/Villager.h @@ -15,7 +15,7 @@ class cVillager : public: cVillager(); - virtual bool IsA(const char * a_EntityType) override; + CLASS_PROTODEF(cVillager); } ; diff --git a/source/Mobs/Witch.cpp b/source/Mobs/Witch.cpp index 5077f0cdd..2bbe5b94b 100644 --- a/source/Mobs/Witch.cpp +++ b/source/Mobs/Witch.cpp @@ -17,15 +17,6 @@ cWitch::cWitch() -bool cWitch::IsA(const char * a_EntityType) -{ - return ((strcmp(a_EntityType, "cWitch") == 0) || super::IsA(a_EntityType)); -} - - - - - void cWitch::GetDrops(cItems & a_Drops, cPawn * a_Killer) { AddRandomDropItem(a_Drops, 0, 6, E_ITEM_GLASS_BOTTLE); diff --git a/source/Mobs/Witch.h b/source/Mobs/Witch.h index 2d21037bb..5b8c7ba4f 100644 --- a/source/Mobs/Witch.h +++ b/source/Mobs/Witch.h @@ -15,7 +15,7 @@ class cWitch : public: cWitch(); - virtual bool IsA(const char* a_EntityType) override; + CLASS_PROTODEF(cWitch); virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override; } ; diff --git a/source/Mobs/Wolf.cpp b/source/Mobs/Wolf.cpp index bd7fa213b..5a8ceabbc 100644 --- a/source/Mobs/Wolf.cpp +++ b/source/Mobs/Wolf.cpp @@ -3,18 +3,16 @@ #include "Wolf.h" -cWolf::cWolf() + + + + +cWolf::cWolf(void) { m_MobType = 95; GetMonsterConfig("Wolf"); } -cWolf::~cWolf() -{ -} -bool cWolf::IsA( const char* a_EntityType ) -{ - if( strcmp( a_EntityType, "cWolf" ) == 0 ) return true; - return cMonster::IsA( a_EntityType ); -} + + diff --git a/source/Mobs/Wolf.h b/source/Mobs/Wolf.h index bde5b9d32..5dd7065a7 100644 --- a/source/Mobs/Wolf.h +++ b/source/Mobs/Wolf.h @@ -1,12 +1,23 @@ + #pragma once #include "PassiveAggressiveMonster.h" -class cWolf : public cPassiveAggressiveMonster + + + + +class cWolf : + public cPassiveAggressiveMonster { + typedef cPassiveAggressiveMonster super; + public: - cWolf(); - ~cWolf(); + cWolf(void); + + CLASS_PROTODEF(cWolf); +} ; + + + - virtual bool IsA( const char* a_EntityType ); -}; diff --git a/source/Mobs/Zombie.cpp b/source/Mobs/Zombie.cpp index 5d753c4f8..15e99734b 100644 --- a/source/Mobs/Zombie.cpp +++ b/source/Mobs/Zombie.cpp @@ -17,15 +17,6 @@ cZombie::cZombie() -bool cZombie::IsA(const char * a_EntityType) -{ - return ((strcmp(a_EntityType, "cZombie") == 0) || super::IsA(a_EntityType)); -} - - - - - void cZombie::Tick(float a_Dt) { super::Tick(a_Dt); diff --git a/source/Mobs/Zombie.h b/source/Mobs/Zombie.h index 8256c040a..06bd9244a 100644 --- a/source/Mobs/Zombie.h +++ b/source/Mobs/Zombie.h @@ -14,8 +14,8 @@ class cZombie : public: cZombie(); - virtual bool IsA(const char * a_EntityType) override; - + CLASS_PROTODEF(cZombie); + virtual void Tick(float a_Dt) override; virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override; } ; diff --git a/source/Mobs/Zombiepigman.cpp b/source/Mobs/Zombiepigman.cpp index 9d3106829..e917da979 100644 --- a/source/Mobs/Zombiepigman.cpp +++ b/source/Mobs/Zombiepigman.cpp @@ -17,15 +17,6 @@ cZombiepigman::cZombiepigman() -bool cZombiepigman::IsA(const char * a_EntityType) -{ - return ((strcmp(a_EntityType, "cZombiepigman") == 0) || super::IsA(a_EntityType)); -} - - - - - void cZombiepigman::Tick(float a_Dt) { super::Tick(a_Dt); diff --git a/source/Mobs/Zombiepigman.h b/source/Mobs/Zombiepigman.h index 02ad21562..929d03241 100644 --- a/source/Mobs/Zombiepigman.h +++ b/source/Mobs/Zombiepigman.h @@ -13,9 +13,9 @@ class cZombiepigman : typedef cPassiveAggressiveMonster super; public: - cZombiepigman(); + cZombiepigman(void); - virtual bool IsA(const char * a_EntityType) override; + CLASS_PROTODEF(cZombiepigman); virtual void Tick(float a_Dt) override; virtual void GetDrops(cItems & a_Drops, cPawn * a_Killer = NULL) override; -- cgit v1.2.3