From afdd8a03b19c64998adc4a1c0d079de0324b6629 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Thu, 4 Oct 2012 19:30:50 +0200 Subject: [PATCH] Character: Moved setDelete from onDeath to onDamage. This means the default implemenation does not need to be called by implementations. --- source/abstract/Character.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source/abstract/Character.cpp b/source/abstract/Character.cpp index 4a3a3f0..72f1f78 100644 --- a/source/abstract/Character.cpp +++ b/source/abstract/Character.cpp @@ -52,7 +52,8 @@ Character::think(float elapsedTime) { } /** - * Subtracts health from Actor. + * Subtracts health from Actor. Calls onDeath() when health reaches zero and marks + * object for deletion. * * @param damage Amount of health to subtract. */ @@ -62,15 +63,13 @@ Character::onDamage(int damage) { if (mCurrentHealth <= 0) { mCurrentHealth = 0; onDeath(); + setDelete(true); } } /** - * Called when health reaches zero. Marks the object for deletion. - * - * @warning Implementations should call the default implementation. + * Called when health reaches zero. Default immplementation does nothing. */ void Character::onDeath() { - setDelete(true); }