--- a/src/Player.cc Mon Dec 08 17:30:17 2008 +0000
+++ b/src/Player.cc Mon Dec 08 17:39:01 2008 +0000
@@ -114,6 +114,10 @@
}
void LocalPlayer::handleInput (PlayerInput input, TimeMS dt) {
+ // if we are dead, we can't do anything
+ if (!isAlive())
+ return;
+
// Movement force, vertical is always zero
Vector move_force = Vector(0, 0);
@@ -230,16 +234,19 @@
}
void Player::takeDamage (Health damage) {
- this->health -= damage;
+ health -= damage;
- if (this->health <= 0)
- this->disable();
+ if (health <= 0)
+ disable();
Engine::log(DEBUG, "player.take_damage") << this << ": damage=" << damage << ", health=" << health;
}
void Player::draw (Graphics *g, PixelCoordinate camera) {
CL_GraphicContext *gc = g->get_gc();
+
+ if (!isAlive())
+ return;
// animation indexes
int aim_img_idx = (int)((1 - (getAim() + KG_PI / 2) / KG_PI) * img_num_aim);
@@ -290,7 +297,7 @@
Player::draw(g, camera);
// display weapon name?
- if (displayWeapon && getCurrentWeapon()) {
+ if (isAlive() && displayWeapon && getCurrentWeapon()) {
const std::string weaponName = getCurrentWeapon()->getName();
PixelCoordinate pc = getCoordinate() - camera;