diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index 781a93f8cc..c9bfa9fde9 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -1829,13 +1829,6 @@ DEF_CONSOLE_CMD(ConCompanies) SetDParam(0, c->index); std::string company_name = GetString(STR_COMPANY_NAME); - const char *password_state = ""; - if (c->is_ai) { - password_state = "AI"; - } else if (_network_server) { - password_state = _network_company_states[c->index].password.empty() ? "unprotected" : "protected"; - } - std::string colour = GetString(STR_COLOUR_DARK_BLUE + _company_colours[c->index]); IConsolePrint(CC_INFO, "#:{}({}) Company Name: '{}' Year Founded: {} Money: {} Loan: {} Value: {} (T:{}, R:{}, P:{}, S:{}) {}", c->index + 1, colour, company_name, @@ -1844,7 +1837,7 @@ DEF_CONSOLE_CMD(ConCompanies) c->group_all[VEH_ROAD].num_vehicle, c->group_all[VEH_AIRCRAFT].num_vehicle, c->group_all[VEH_SHIP].num_vehicle, - password_state); + c->is_ai ? "AI" : ""); } return true; @@ -2828,7 +2821,6 @@ void IConsoleStdLibRegister() IConsole::AliasRegister("pause_on_join", "setting pause_on_join %+"); IConsole::AliasRegister("autoclean_companies", "setting autoclean_companies %+"); IConsole::AliasRegister("autoclean_protected", "setting autoclean_protected %+"); - IConsole::AliasRegister("autoclean_unprotected", "setting autoclean_unprotected %+"); IConsole::AliasRegister("restart_game_year", "setting restart_game_year %+"); IConsole::AliasRegister("min_players", "setting min_active_clients %+"); IConsole::AliasRegister("reload_cfg", "setting reload_cfg %+"); diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp index c1bfdde98c..3e7bafb0c3 100644 --- a/src/network/network_server.cpp +++ b/src/network/network_server.cpp @@ -1633,11 +1633,10 @@ void NetworkUpdateClientInfo(ClientID client_id) NetworkAdminClientUpdate(ci); } -/** 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) - * 2) If a company is protected, protection is disabled after 3 years (for example) - * (and item 1. happens a year later) +/** + * Remove companies that have not been used depending on the \c autoclean_companies setting + * and values for \c autoclean_protected, which removes any company, and + * \c autoclean_novehicles, which removes companies without vehicles. */ static void NetworkAutoCleanCompanies() { @@ -1672,19 +1671,11 @@ static void NetworkAutoCleanCompanies() /* The company is empty for one month more */ if (c->months_empty != std::numeric_limitsmonths_empty)>::max()) c->months_empty++; - /* Is the company empty for autoclean_unprotected-months, and is there no protection? */ - if (_settings_client.network.autoclean_unprotected != 0 && c->months_empty > _settings_client.network.autoclean_unprotected && _network_company_states[c->index].password.empty()) { + /* Is the company empty for autoclean_protected-months? */ + if (_settings_client.network.autoclean_protected != 0 && c->months_empty > _settings_client.network.autoclean_protected) { /* Shut the company down */ Command::Post(CCA_DELETE, c->index, CRR_AUTOCLEAN, INVALID_CLIENT_ID); - IConsolePrint(CC_INFO, "Auto-cleaned company #{} with no password.", c->index + 1); - } - /* Is the company empty for autoclean_protected-months, and there is a protection? */ - if (_settings_client.network.autoclean_protected != 0 && c->months_empty > _settings_client.network.autoclean_protected && !_network_company_states[c->index].password.empty()) { - /* Unprotect the company */ - _network_company_states[c->index].password.clear(); - IConsolePrint(CC_INFO, "Auto-removed protection from company #{}.", c->index + 1); - c->months_empty = 0; - NetworkServerUpdateCompanyPassworded(c->index, false); + IConsolePrint(CC_INFO, "Auto-cleaned company #{}.", c->index + 1); } /* Is the company empty for autoclean_novehicles-months, and has no vehicles? */ if (_settings_client.network.autoclean_novehicles != 0 && c->months_empty > _settings_client.network.autoclean_novehicles && !HasBit(has_vehicles, c->index)) { diff --git a/src/settings_type.h b/src/settings_type.h index 017a74664e..cfc6ad7c33 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -324,8 +324,7 @@ struct NetworkSettings { std::string connect_to_ip; ///< default for the "Add server" query std::string network_id; ///< network ID for servers bool autoclean_companies; ///< automatically remove companies that are not in use - uint8_t autoclean_unprotected; ///< remove passwordless companies after this many months - uint8_t autoclean_protected; ///< remove the password from passworded companies after this many months + uint8_t autoclean_protected; ///< Remove companies after this many months. uint8_t autoclean_novehicles; ///< remove companies with no vehicles after this many months uint8_t max_companies; ///< maximum amount of companies uint8_t max_clients; ///< maximum amount of clients diff --git a/src/table/settings/network_settings.ini b/src/table/settings/network_settings.ini index 52a02853bb..12afbd534e 100644 --- a/src/table/settings/network_settings.ini +++ b/src/table/settings/network_settings.ini @@ -193,14 +193,6 @@ var = network.autoclean_companies flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_NETWORK_ONLY def = false -[SDTC_VAR] -var = network.autoclean_unprotected -type = SLE_UINT8 -flags = SF_NOT_IN_SAVE | SF_NO_NETWORK_SYNC | SF_GUI_0_IS_SPECIAL | SF_NETWORK_ONLY -def = 12 -min = 0 -max = 240 - [SDTC_VAR] var = network.autoclean_protected type = SLE_UINT8