network_server.c
changeset 4300 687a17c9c557
parent 4293 2c24234a7aec
child 4321 b763b7007162
equal deleted inserted replaced
4299:b86602eaaff1 4300:687a17c9c557
    19 #include "gfx.h"
    19 #include "gfx.h"
    20 #include "saveload.h"
    20 #include "saveload.h"
    21 #include "vehicle.h"
    21 #include "vehicle.h"
    22 #include "station.h"
    22 #include "station.h"
    23 #include "variables.h"
    23 #include "variables.h"
       
    24 #include "genworld.h"
    24 
    25 
    25 // This file handles all the server-commands
    26 // This file handles all the server-commands
    26 
    27 
    27 static void NetworkHandleCommandQueue(NetworkClientState* cs);
    28 static void NetworkHandleCommandQueue(NetworkClientState* cs);
    28 void NetworkPopulateCompanyInfo(void);
    29 void NetworkPopulateCompanyInfo(void);
  1306 	FOR_ALL_CLIENTS(cs) {
  1307 	FOR_ALL_CLIENTS(cs) {
  1307 		SEND_COMMAND(PACKET_SERVER_CLIENT_INFO)(cs, ci);
  1308 		SEND_COMMAND(PACKET_SERVER_CLIENT_INFO)(cs, ci);
  1308 	}
  1309 	}
  1309 }
  1310 }
  1310 
  1311 
  1311 extern void SwitchMode(int new_mode);
       
  1312 
       
  1313 /* Check if we want to restart the map */
  1312 /* Check if we want to restart the map */
  1314 static void NetworkCheckRestartMap(void)
  1313 static void NetworkCheckRestartMap(void)
  1315 {
  1314 {
  1316 	if (_network_restart_game_year != 0 && _cur_year >= _network_restart_game_year) {
  1315 	if (_network_restart_game_year != 0 && _cur_year >= _network_restart_game_year) {
  1317 		DEBUG(net, 0)("Auto-restarting map. Year %d reached.", _cur_year);
  1316 		DEBUG(net, 0)("Auto-restarting map. Year %d reached.", _cur_year);
  1318 
  1317 
  1319 		_random_seeds[0][0] = Random();
  1318 		StartNewGameWithoutGUI(GENERATE_NEW_SEED);
  1320 		_random_seeds[0][1] = InteractiveRandom();
       
  1321 
       
  1322 		SwitchMode(SM_NEWGAME);
       
  1323 	}
  1319 	}
  1324 }
  1320 }
  1325 
  1321 
  1326 /* Check if the server has autoclean_companies activated
  1322 /* Check if the server has autoclean_companies activated
  1327     Two things happen:
  1323     Two things happen: