(svn r13773) -Codechange: disable autoclean for protected/unprotected companies when the timeout is set to 0. Based on an idea by Thomas.

This commit is contained in:
rubidium 2008-07-21 13:05:43 +00:00
parent e6a1f1c012
commit aafd8393cc
2 changed files with 4 additions and 4 deletions

View File

@ -1440,13 +1440,13 @@ static void NetworkAutoCleanCompanies()
_network_player_info[p->index].months_empty++; _network_player_info[p->index].months_empty++;
/* Is the company empty for autoclean_unprotected-months, and is there no protection? */ /* Is the company empty for autoclean_unprotected-months, and is there no protection? */
if (_network_player_info[p->index].months_empty > _settings_client.network.autoclean_unprotected && _network_player_info[p->index].password[0] == '\0') { if (_settings_client.network.autoclean_unprotected != 0 && _network_player_info[p->index].months_empty > _settings_client.network.autoclean_unprotected && _network_player_info[p->index].password[0] == '\0') {
/* Shut the company down */ /* Shut the company down */
DoCommandP(0, 2, p->index, NULL, CMD_PLAYER_CTRL); DoCommandP(0, 2, p->index, NULL, CMD_PLAYER_CTRL);
IConsolePrintF(CC_DEFAULT, "Auto-cleaned company #%d", p->index + 1); IConsolePrintF(CC_DEFAULT, "Auto-cleaned company #%d", p->index + 1);
} }
/* Is the compnay empty for autoclean_protected-months, and there is a protection? */ /* Is the compnay empty for autoclean_protected-months, and there is a protection? */
if (_network_player_info[p->index].months_empty > _settings_client.network.autoclean_protected && _network_player_info[p->index].password[0] != '\0') { if (_settings_client.network.autoclean_protected != 0 && _network_player_info[p->index].months_empty > _settings_client.network.autoclean_protected && _network_player_info[p->index].password[0] != '\0') {
/* Unprotect the company */ /* Unprotect the company */
_network_player_info[p->index].password[0] = '\0'; _network_player_info[p->index].password[0] = '\0';
IConsolePrintF(CC_DEFAULT, "Auto-removed protection from company #%d", p->index+1); IConsolePrintF(CC_DEFAULT, "Auto-removed protection from company #%d", p->index+1);

View File

@ -1806,8 +1806,8 @@ const SettingDesc _patch_settings[] = {
SDTC_STR(network.connect_to_ip, SLE_STRB, S, 0, NULL, STR_NULL, NULL), SDTC_STR(network.connect_to_ip, SLE_STRB, S, 0, NULL, STR_NULL, NULL),
SDTC_STR(network.network_id, SLE_STRB, S, NO, NULL, STR_NULL, NULL), SDTC_STR(network.network_id, SLE_STRB, S, NO, NULL, STR_NULL, NULL),
SDTC_BOOL(network.autoclean_companies, S, NO, false, STR_NULL, NULL), SDTC_BOOL(network.autoclean_companies, S, NO, false, STR_NULL, NULL),
SDTC_VAR(network.autoclean_unprotected, SLE_UINT8, S, NO, 12, 0, 60, 0, STR_NULL, NULL), SDTC_VAR(network.autoclean_unprotected, SLE_UINT8, S,D0|NO, 12, 0, 240, 0, STR_NULL, NULL),
SDTC_VAR(network.autoclean_protected, SLE_UINT8, S, NO, 36, 0, 180, 0, STR_NULL, NULL), SDTC_VAR(network.autoclean_protected, SLE_UINT8, S,D0|NO, 36, 0, 240, 0, STR_NULL, NULL),
SDTC_VAR(network.max_companies, SLE_UINT8, S, NO, 8, 1, MAX_PLAYERS, 0, STR_NULL, NULL), SDTC_VAR(network.max_companies, SLE_UINT8, S, NO, 8, 1, MAX_PLAYERS, 0, STR_NULL, NULL),
SDTC_VAR(network.max_clients, SLE_UINT8, S, NO, 10, 2, MAX_CLIENTS, 0, STR_NULL, NULL), SDTC_VAR(network.max_clients, SLE_UINT8, S, NO, 10, 2, MAX_CLIENTS, 0, STR_NULL, NULL),
SDTC_VAR(network.max_spectators, SLE_UINT8, S, NO, 10, 0, MAX_CLIENTS, 0, STR_NULL, NULL), SDTC_VAR(network.max_spectators, SLE_UINT8, S, NO, 10, 0, MAX_CLIENTS, 0, STR_NULL, NULL),