src/video/dedicated_v.c
branchcustombridgeheads
changeset 5648 1608018c5ff2
parent 5643 3778051e8095
equal deleted inserted replaced
5647:cbde85c8c878 5648:1608018c5ff2
   221 	IConsoleCmdExec(input_line); // execute command
   221 	IConsoleCmdExec(input_line); // execute command
   222 }
   222 }
   223 
   223 
   224 static void DedicatedVideoMainLoop(void)
   224 static void DedicatedVideoMainLoop(void)
   225 {
   225 {
   226 	uint32 next_tick;
   226 	uint32 cur_ticks = GetTime();
   227 	uint32 cur_ticks;
   227 	uint32 next_tick = cur_ticks + 30;
   228 
       
   229 	next_tick = GetTime() + 30;
       
   230 
   228 
   231 	/* Signal handlers */
   229 	/* Signal handlers */
   232 #ifdef UNIX
   230 #ifdef UNIX
   233 	signal(SIGTERM, DedicatedSignalHandler);
   231 	signal(SIGTERM, DedicatedSignalHandler);
   234 	signal(SIGINT, DedicatedSignalHandler);
   232 	signal(SIGINT, DedicatedSignalHandler);
   266 		DEBUG(net, 0, "Dedicated server could not be started, aborting");
   264 		DEBUG(net, 0, "Dedicated server could not be started, aborting");
   267 		return;
   265 		return;
   268 	}
   266 	}
   269 
   267 
   270 	while (!_exit_game) {
   268 	while (!_exit_game) {
       
   269 		uint32 prev_cur_ticks = cur_ticks; // to check for wrapping
   271 		InteractiveRandom(); // randomness
   270 		InteractiveRandom(); // randomness
   272 
   271 
   273 		if (!_dedicated_forks)
   272 		if (!_dedicated_forks)
   274 			DedicatedHandleKeyInput();
   273 			DedicatedHandleKeyInput();
   275 
   274 
   276 		cur_ticks = GetTime();
   275 		cur_ticks = GetTime();
   277 
   276 		if (cur_ticks >= next_tick || cur_ticks < prev_cur_ticks) {
   278 		if (cur_ticks >= next_tick) {
   277 			next_tick = cur_ticks + 30;
   279 			next_tick += 30;
       
   280 
   278 
   281 			GameLoop();
   279 			GameLoop();
   282 			_screen.dst_ptr = _dedicated_video_mem;
   280 			_screen.dst_ptr = _dedicated_video_mem;
   283 			UpdateWindows();
   281 			UpdateWindows();
   284 		}
   282 		}