From 12655e031954d0e6e896abc636478f202360e7c8 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Sun, 3 Mar 2013 21:33:01 +0100 Subject: [PATCH] Moved corpse dropping to Character::onDeath to allow overloading. --- source/abstract/Character.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/abstract/Character.cpp b/source/abstract/Character.cpp index 85c41e2..f9f6b69 100644 --- a/source/abstract/Character.cpp +++ b/source/abstract/Character.cpp @@ -41,14 +41,12 @@ Character::Character(World& world, Pathfinder& pathfinder, } /** - * Deletes pointer from static variable mCharacterInstances, inserts body into world. + * Deletes pointer from static variable mCharacterInstances. */ Character::~Character() { auto it = std::find(mCharacterInstances.begin(), mCharacterInstances.end(), this); assert(it != mCharacterInstances.end()); mCharacterInstances.erase(it); - - mWorld.insert(std::shared_ptr(new Corpse(getPosition(), Yaml("body.yaml")))); } /** @@ -90,10 +88,12 @@ Character::onThink(float elapsedTime) { } /** - * Called when health reaches zero. Default immplementation does nothing. + * Called when health reaches zero. Default implementation drops a corpse at + * the current position. */ void Character::onDeath() { + mWorld.insert(std::shared_ptr(new Corpse(getPosition(), Yaml("body.yaml")))); } /**