From c22ea2f169f58e765fc699fcd71bfd3a3cd4f859 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Thu, 22 Apr 2010 07:15:35 -0600 Subject: Add an Actor class to replace the Sprite class The Actor class manages the Map reference, position vector, and alpha float. These are the common parts from it's children. --- src/being.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'src/being.cpp') diff --git a/src/being.cpp b/src/being.cpp index 5c737c0c..40a6befd 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -78,13 +78,11 @@ Being::Being(int id, int subtype, Map *map): mId(id), mDirection(DOWN), mSpriteDirection(DIRECTION_DOWN), - mMap(NULL), mDispName(0), mShowName(false), mEquippedWeapon(NULL), mText(0), mStunMode(0), - mAlpha(1.0f), mStatusParticleEffects(&mStunParticleEffects, false), mChildParticleEffects(&mStatusParticleEffects, false), mMustResetParticles(false), @@ -109,8 +107,6 @@ Being::~Being() if (player_node && player_node->getTarget() == this) player_node->setTarget(NULL); - setMap(NULL); - delete mSpeechBubble; delete mDispName; delete mText; @@ -118,7 +114,7 @@ Being::~Being() void Being::setPosition(const Vector &pos) { - mPos = pos; + Actor::setPosition(pos); updateCoords(); @@ -362,15 +358,7 @@ void Being::setGuildPos(const std::string &pos) void Being::setMap(Map *map) { - // Remove sprite from potential previous map - if (mMap) - mMap->removeSprite(mMapSprite); - - mMap = map; - - // Add sprite to potential new map - if (mMap) - mMapSprite = mMap->addSprite(this); + Actor::setMap(map); // Clear particle effect list because child particles became invalid mChildParticleEffects.clear(); -- cgit v1.2.3-70-g09d2