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 | |
| parent | ee105f1cfd701fa411319d6f14c28c7d675afe7a (diff) | |
| download | zcatch-f055f15ae7ef67069d51251b43c8bda22622018d.tar.gz zcatch-f055f15ae7ef67069d51251b43c8bda22622018d.zip | |
added warmup
Diffstat (limited to 'src/game/server')
| -rw-r--r-- | src/game/server/game_server.cpp | 6 | ||||
| -rw-r--r-- | src/game/server/srv_common.cpp | 19 | ||||
| -rw-r--r-- | src/game/server/srv_common.h | 3 |
3 files changed, 27 insertions, 1 deletions
diff --git a/src/game/server/game_server.cpp b/src/game/server/game_server.cpp index 1d2f4324..d1620193 100644 --- a/src/game/server/game_server.cpp +++ b/src/game/server/game_server.cpp @@ -1309,7 +1309,11 @@ void mods_tick() if(config.restart) { - gameobj->startround(); + if(config.restart > 1) + gameobj->do_warmup(config.restart); + else + gameobj->startround(); + config.restart = 0; } } 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]; } diff --git a/src/game/server/srv_common.h b/src/game/server/srv_common.h index 21941f06..103e4a01 100644 --- a/src/game/server/srv_common.h +++ b/src/game/server/srv_common.h @@ -118,12 +118,15 @@ protected: int teamscore[2]; + int warmup; int round_count; public: int gametype; gameobject(); + void do_warmup(int seconds); + void startround(); void endround(); |