From aebe130299a3c3d14a0d89e68195c303ca120c1b Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sat, 22 Dec 2012 09:39:13 +0000 Subject: Reduced most mobs' constructors to oneliners by passing parameters to superclasses git-svn-id: http://mc-server.googlecode.com/svn/trunk@1095 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Mobs/Monster.cpp | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) (limited to 'source/Mobs/Monster.cpp') diff --git a/source/Mobs/Monster.cpp b/source/Mobs/Monster.cpp index 04989caac..49f11ebfd 100644 --- a/source/Mobs/Monster.cpp +++ b/source/Mobs/Monster.cpp @@ -16,19 +16,13 @@ #include "../Vector3d.h" #include "../Tracer.h" -#include "../../iniFile/iniFile.h" +// #include "../../iniFile/iniFile.h" -/* -#ifndef _WIN32 - #include -#endif -*/ - -cMonster::cMonster(void) +cMonster::cMonster(const AString & a_ConfigName, char a_ProtocolMobType, const AString & a_SoundHurt, const AString & a_SoundDeath) : super(etMob) , m_Target(NULL) , m_bMovingToDestination(false) @@ -37,9 +31,9 @@ cMonster::cMonster(void) , m_bOnGround( false ) , m_DestroyTimer( 0 ) , m_Jump(0) - , m_MobType( 0 ) - , m_SoundHurt( "" ) - , m_SoundDeath( "" ) + , m_MobType(a_ProtocolMobType) + , m_SoundHurt(a_SoundHurt) + , m_SoundDeath(a_SoundDeath) , m_EMState(IDLE) , m_SightDistance(25) , m_SeePlayerInterval (0) @@ -50,11 +44,10 @@ cMonster::cMonster(void) , m_AttackRate(3) , idle_interval(0) { - LOGD("cMonster::cMonster()"); - LOGD("In state: %s", GetState()); - - m_bBurnable = true; - m_MetaData = NORMAL; + if (!a_ConfigName.empty()) + { + GetMonsterConfig(a_ConfigName); + } } @@ -520,9 +513,9 @@ cPlayer * cMonster::FindClosestPlayer(void) -void cMonster::GetMonsterConfig(const char* pm_name) +void cMonster::GetMonsterConfig(const AString & a_Name) { - cRoot::Get()->GetMonsterConfig()->AssignAttributes(this, pm_name); + cRoot::Get()->GetMonsterConfig()->AssignAttributes(this, a_Name); } -- cgit v1.2.3