(svn r1252) -Add: [Network] With 'set restart_game_date' you can set the date for in
which year the server must restart hisself. (0 = disabled, default value)
This commit is contained in:
@@ -1259,6 +1259,23 @@ void NetworkUpdateClientInfo(uint16 client_index)
|
||||
}
|
||||
}
|
||||
|
||||
extern void SwitchMode(int new_mode);
|
||||
|
||||
/* Check if we want to restart the map */
|
||||
static void NetworkCheckRestartMap()
|
||||
{
|
||||
if (_network_restart_game_date != 0 && _cur_year + 1920 >= _network_restart_game_date) {
|
||||
_docommand_recursive = 0;
|
||||
|
||||
DEBUG(net, 0)("Auto-restarting map. Year %d reached.", _cur_year + 1920);
|
||||
|
||||
_random_seeds[0][0] = Random();
|
||||
_random_seeds[0][1] = InteractiveRandom();
|
||||
|
||||
SwitchMode(SM_NEWGAME);
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if the server has autoclean_companies activated
|
||||
Two things happen:
|
||||
1) If a company is not protected, it is closed after 1 year (for example)
|
||||
@@ -1477,6 +1494,11 @@ void NetworkServer_Tick(void)
|
||||
NetworkUDPAdvertise();
|
||||
}
|
||||
|
||||
void NetworkServerYearlyLoop(void)
|
||||
{
|
||||
NetworkCheckRestartMap();
|
||||
}
|
||||
|
||||
void NetworkServerMonthlyLoop(void)
|
||||
{
|
||||
NetworkAutoCleanCompanies();
|
||||
|
Reference in New Issue
Block a user