diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-11-26 20:47:49 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-11-26 20:47:49 +0000 |
| commit | ddbb7e0b0ea20a115b556b99577e7de07cd703d4 (patch) | |
| tree | 2c10d2df6fc76bd4eb3288963a109cb02656eecb | |
| parent | 61041e483797e02525547757f75007edceabc0f3 (diff) | |
| download | zcatch-ddbb7e0b0ea20a115b556b99577e7de07cd703d4.tar.gz zcatch-ddbb7e0b0ea20a115b556b99577e7de07cd703d4.zip | |
fixed tdm and ctf scoring
| -rw-r--r-- | src/game/server/srv_common.cpp | 16 | ||||
| -rw-r--r-- | src/game/server/srv_common.h | 1 | ||||
| -rw-r--r-- | src/game/server/srv_ctf.cpp | 2 | ||||
| -rw-r--r-- | src/game/server/srv_tdm.cpp | 13 |
4 files changed, 20 insertions, 12 deletions
diff --git a/src/game/server/srv_common.cpp b/src/game/server/srv_common.cpp index 251d1e70..417c9db7 100644 --- a/src/game/server/srv_common.cpp +++ b/src/game/server/srv_common.cpp @@ -199,4 +199,20 @@ int gameobject::getteam(int notthisid) return numplayers[0] > numplayers[1] ? 1 : 0; } +void gameobject::do_team_wincheck() +{ + if(game_over_tick == -1 && !warmup) + { + // 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(teamscore[0] != teamscore[1]) + endround(); + else + sudden_death = 1; + } + } +} + gameobject *gameobj = 0; diff --git a/src/game/server/srv_common.h b/src/game/server/srv_common.h index c749241a..74fb607c 100644 --- a/src/game/server/srv_common.h +++ b/src/game/server/srv_common.h @@ -128,6 +128,7 @@ public: int gametype; gameobject(); + void do_team_wincheck(); void do_warmup(int seconds); void startround(); diff --git a/src/game/server/srv_ctf.cpp b/src/game/server/srv_ctf.cpp index abdb0efe..e941c804 100644 --- a/src/game/server/srv_ctf.cpp +++ b/src/game/server/srv_ctf.cpp @@ -55,6 +55,8 @@ int gameobject_ctf::on_player_death(class player *victim, class player *killer, void gameobject_ctf::tick() { gameobject::tick(); + + do_team_wincheck(); // do flags for(int fi = 0; fi < 2; fi++) diff --git a/src/game/server/srv_tdm.cpp b/src/game/server/srv_tdm.cpp index 3595a129..bcae397f 100644 --- a/src/game/server/srv_tdm.cpp +++ b/src/game/server/srv_tdm.cpp @@ -26,18 +26,7 @@ int gameobject_tdm::on_player_death(class player *victim, class player *killer, void gameobject_tdm::tick() { - if(game_over_tick == -1 && !warmup) - { - // 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(teamscore[0] != teamscore[0]) - endround(); - else - sudden_death = 1; - } - } + do_team_wincheck(); gameobject::tick(); } |