about summary refs log tree commit diff
path: root/src/game/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/server')
-rw-r--r--src/game/server/game_server.cpp6
-rw-r--r--src/game/server/srv_common.cpp19
-rw-r--r--src/game/server/srv_common.h3
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();