From 2c149152a31e8921a93fea9bba2184318ac7e804 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Mon, 26 Nov 2007 19:18:49 +0000 Subject: fixed tdm scoring --- src/game/server/srv_tdm.cpp | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/game/server/srv_tdm.cpp') diff --git a/src/game/server/srv_tdm.cpp b/src/game/server/srv_tdm.cpp index 84738a92..3595a129 100644 --- a/src/game/server/srv_tdm.cpp +++ b/src/game/server/srv_tdm.cpp @@ -8,31 +8,31 @@ gameobject_tdm::gameobject_tdm() is_teamplay = true; } + +int gameobject_tdm::on_player_death(class player *victim, class player *killer, int weapon) +{ + gameobject::on_player_death(victim, killer, weapon); + + if(weapon >= 0) + { + // do team scoring + if(killer == victim) + teamscore[killer->team&1]--; // klant arschel + else + teamscore[killer->team&1]++; // good shit + } + return 0; +} + void gameobject_tdm::tick() { - if(game_over_tick == -1) + if(game_over_tick == -1 && !warmup) { - // game is running - teamscore[0] = 0; - teamscore[1] = 0; - - // gather some stats - int topscore_count = 0; - for(int i = 0; i < MAX_CLIENTS; i++) - { - if(players[i].client_id != -1) - teamscore[players[i].team] += players[i].score; - } - if (teamscore[0] >= config.scorelimit) - topscore_count++; - if (teamscore[1] >= config.scorelimit) - topscore_count++; - // check score win condition if((config.scorelimit > 0 && (teamscore[0] >= config.scorelimit || teamscore[1] >= config.scorelimit)) || (config.timelimit > 0 && (server_tick()-round_start_tick) >= config.timelimit*server_tickspeed()*60)) { - if(topscore_count == 1) + if(teamscore[0] != teamscore[0]) endround(); else sudden_death = 1; -- cgit 1.4.1