diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-10-06 17:36:24 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-10-06 17:36:24 +0000 |
| commit | f055f15ae7ef67069d51251b43c8bda22622018d (patch) | |
| tree | 0320c5f0aada1626be291cf6b3e3d5227a1bd405 /src/game/server/srv_common.cpp | |
| parent | ee105f1cfd701fa411319d6f14c28c7d675afe7a (diff) | |
| download | zcatch-f055f15ae7ef67069d51251b43c8bda22622018d.tar.gz zcatch-f055f15ae7ef67069d51251b43c8bda22622018d.zip | |
added warmup
Diffstat (limited to 'src/game/server/srv_common.cpp')
| -rw-r--r-- | src/game/server/srv_common.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/game/server/srv_common.cpp b/src/game/server/srv_common.cpp index d7b91178..6d2abf0c 100644 --- a/src/game/server/srv_common.cpp +++ b/src/game/server/srv_common.cpp @@ -23,6 +23,7 @@ gameobject::gameobject() } // + do_warmup(config.warmup); game_over_tick = -1; sudden_death = 0; round_start_tick = server_tick(); @@ -31,6 +32,9 @@ gameobject::gameobject() void gameobject::endround() { + if(warmup) // game can't end when we are running warmup + return; + world->paused = true; game_over_tick = server_tick(); sudden_death = 0; @@ -116,9 +120,22 @@ void gameobject::on_player_death(class player *victim, class player *killer, int killer->score++; // good shit } +void gameobject::do_warmup(int seconds) +{ + warmup = seconds*SERVER_TICK_SPEED; +} + void gameobject::tick() { + // do warmup + if(warmup) + { + warmup--; + if(!warmup) + resetgame(); + } + if(game_over_tick != -1) { // game over.. wait for restart @@ -142,6 +159,8 @@ void gameobject::snap(int snapping_client) game->round_start_tick = round_start_tick; game->gametype = gametype; + game->warmup = warmup; + game->teamscore[0] = teamscore[0]; game->teamscore[1] = teamscore[1]; } |