From c561c365d70c73b3842709f76a3cafaa553dead0 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Sat, 18 Oct 2008 21:19:49 +0000 Subject: fixed potential crash when players leave and there are projectiles left from them --- src/game/server/entities/character.cpp | 4 ++-- src/game/server/player.hpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src/game/server') diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 88fa3ffa..aa0adcf5 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -802,7 +802,7 @@ bool CHARACTER::take_damage(vec2 force, int dmg, int from, int weapon) damage_taken_tick = server_tick(); // do damage hit sound - if(from >= 0 && from != player->client_id) + if(from >= 0 && from != player->client_id && game.players[from]) game.create_sound(game.players[from]->view_pos, SOUND_HIT, cmask_one(from)); // check for death @@ -811,7 +811,7 @@ bool CHARACTER::take_damage(vec2 force, int dmg, int from, int weapon) die(from, weapon); // set attacker's face to happy (taunt!) - if (from >= 0 && from != player->client_id) + if (from >= 0 && from != player->client_id && game.players[from]) { CHARACTER *chr = game.players[from]->get_character(); if (chr) diff --git a/src/game/server/player.hpp b/src/game/server/player.hpp index a1aed594..92d950c2 100644 --- a/src/game/server/player.hpp +++ b/src/game/server/player.hpp @@ -66,6 +66,7 @@ public: void tick(); void snap(int snapping_client); + void on_character_death(); void on_direct_input(NETOBJ_PLAYER_INPUT *new_input); void on_predicted_input(NETOBJ_PLAYER_INPUT *new_input); void on_disconnect(); -- cgit 1.4.1