From 57c47659930c5e01ae5d3e8cef51c06d28d20508 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Thu, 17 Jan 2008 23:09:49 +0000 Subject: editor update and other stuff --- src/game/server/gs_game.cpp | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'src/game/server/gs_game.cpp') diff --git a/src/game/server/gs_game.cpp b/src/game/server/gs_game.cpp index bae964ab..2d44a499 100644 --- a/src/game/server/gs_game.cpp +++ b/src/game/server/gs_game.cpp @@ -289,7 +289,40 @@ int gameobject::getteam(int notthisid) return numplayers[0] > numplayers[1] ? 1 : 0; } -void gameobject::do_team_wincheck() +void gameobject::do_player_score_wincheck() +{ + if(game_over_tick == -1 && !warmup) + { + // gather some stats + int topscore = 0; + int topscore_count = 0; + for(int i = 0; i < MAX_CLIENTS; i++) + { + if(players[i].client_id != -1) + { + if(players[i].score > topscore) + { + topscore = players[i].score; + topscore_count = 1; + } + else if(players[i].score == topscore) + topscore_count++; + } + } + + // check score win condition + if((config.sv_scorelimit > 0 && topscore >= config.sv_scorelimit) || + (config.sv_timelimit > 0 && (server_tick()-round_start_tick) >= config.sv_timelimit*server_tickspeed()*60)) + { + if(topscore_count == 1) + endround(); + else + sudden_death = 1; + } + } +} + +void gameobject::do_team_score_wincheck() { if(game_over_tick == -1 && !warmup) { -- cgit 1.4.1