summaryrefslogtreecommitdiff
path: root/console_cmds.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2004-12-16 13:59:23 +0000
committertruelight <truelight@openttd.org>2004-12-16 13:59:23 +0000
commit5e28fb8f97f7f57be4f62676fd96bd7b97103419 (patch)
tree4e45f952d8f16c9ddc3ac358df5ad8668d9a599a /console_cmds.c
parent89fd12692f1999b1535d70589bab7366a9eee0f3 (diff)
downloadopenttd-5e28fb8f97f7f57be4f62676fd96bd7b97103419.tar.xz
(svn r1131) -Add: [Network] Autoclean_companies (set it with 'set autoclean_companies on/off').
When enabled, empty companies (companies with no active clients) with no password are declared bankrupt after 1 year of emptyness. For empty companies with password, the password is removed after 3 years of emptyness. The delay of removing company/password can be configured via: - 'set autoclean_protected <months>' - 'set autoclean_unprotected <months>'
Diffstat (limited to 'console_cmds.c')
-rw-r--r--console_cmds.c62
1 files changed, 58 insertions, 4 deletions
diff --git a/console_cmds.c b/console_cmds.c
index 3c2a8e0c9..9724c2f63 100644
--- a/console_cmds.c
+++ b/console_cmds.c
@@ -790,6 +790,57 @@ DEF_CONSOLE_CMD(ConSet) {
return NULL;
}
+ // setting the server autoclean on/off
+ if (strcmp(argv[1],"autoclean_companies") == 0) {
+ if (!_network_server) {
+ IConsolePrintF(_iconsole_color_error, "You are not the server");
+ return NULL;
+ }
+ if (argc == 3) {
+ if (strcmp(argv[2], "on") == 0 || atoi(argv[2]) == 1)
+ _network_autoclean_companies = true;
+ else
+ _network_autoclean_companies = false;
+ IConsolePrintF(_iconsole_color_warning, "Autoclean-companies changed to '%s'", (_network_autoclean_companies)?"on":"off");
+ } else {
+ IConsolePrintF(_iconsole_color_default, "Current autoclean-companies is '%s'", (_network_autoclean_companies)?"on":"off");
+ IConsolePrint(_iconsole_color_warning, "Usage: set autoclean_companies on/off.");
+ }
+ return NULL;
+ }
+
+ // setting the server autoclean protected
+ if (strcmp(argv[1],"autoclean_protected") == 0) {
+ if (!_network_server) {
+ IConsolePrintF(_iconsole_color_error, "You are not the server");
+ return NULL;
+ }
+ if (argc == 3) {
+ _network_autoclean_protected = atoi(argv[2]);
+ IConsolePrintF(_iconsole_color_warning, "Autoclean-protected changed to '%d'", _network_autoclean_protected);
+ } else {
+ IConsolePrintF(_iconsole_color_default, "Current autoclean-protected is '%d'", _network_autoclean_protected);
+ IConsolePrint(_iconsole_color_warning, "Usage: set autoclean_protected <months>.");
+ }
+ return NULL;
+ }
+
+ // setting the server autoclean protected
+ if (strcmp(argv[1],"autoclean_unprotected") == 0) {
+ if (!_network_server) {
+ IConsolePrintF(_iconsole_color_error, "You are not the server");
+ return NULL;
+ }
+ if (argc == 3) {
+ _network_autoclean_unprotected = atoi(argv[2]);
+ IConsolePrintF(_iconsole_color_warning, "Autoclean-unprotected changed to '%d'", _network_autoclean_unprotected);
+ } else {
+ IConsolePrintF(_iconsole_color_default, "Current autoclean-unprotected is '%d'", _network_autoclean_unprotected);
+ IConsolePrint(_iconsole_color_warning, "Usage: set autoclean_unprotected <months>.");
+ }
+ return NULL;
+ }
+
#endif /* ENABLE_NETWORK */
// Patch-options
@@ -811,13 +862,16 @@ DEF_CONSOLE_CMD(ConSet) {
IConsolePrint(_iconsole_color_error, "Unknown setting");
IConsolePrint(_iconsole_color_error, "Known settings are:");
#ifdef ENABLE_NETWORK
- IConsolePrint(_iconsole_color_error, " - server_pw \"<password>\"");
+ IConsolePrint(_iconsole_color_error, " - autoclean_companies on/off");
+ IConsolePrint(_iconsole_color_error, " - autoclean_protected <months>");
+ IConsolePrint(_iconsole_color_error, " - autoclean_unprotected <months>");
IConsolePrint(_iconsole_color_error, " - company_pw \"<password>\"");
IConsolePrint(_iconsole_color_error, " - name \"<playername>\"");
- IConsolePrint(_iconsole_color_error, " - servername \"<name>\"");
- IConsolePrint(_iconsole_color_error, " - server_port <port>");
- IConsolePrint(_iconsole_color_error, " - server_bind_ip <ip>");
+ IConsolePrint(_iconsole_color_error, " - server_name \"<name>\"");
IConsolePrint(_iconsole_color_error, " - server_advertise on/off");
+ IConsolePrint(_iconsole_color_error, " - server_bind_ip <ip>");
+ IConsolePrint(_iconsole_color_error, " - server_port <port>");
+ IConsolePrint(_iconsole_color_error, " - server_pw \"<password>\"");
#endif /* ENABLE_NETWORK */
IConsolePrint(_iconsole_color_error, " - patch <patch_name> [<value>]");