summaryrefslogtreecommitdiff
path: root/console_cmds.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2004-12-13 17:04:41 +0000
committertruelight <truelight@openttd.org>2004-12-13 17:04:41 +0000
commitb153236503f3a93447592ec705a4c29ed4e1120e (patch)
treeeb2905e37feb2c6163f8f2da8d8f68dbf433d607 /console_cmds.c
parent549dafc241682464684a0fbe2ed9fdb907f12e26 (diff)
downloadopenttd-b153236503f3a93447592ec705a4c29ed4e1120e.tar.xz
(svn r1057) -Add: [Network] 'set port <port>' changes the port of the server (after reboot)
-Fix: [Network] Fixed warnings that came with last revision -Cleanup: [Network] Removed an unused var (_network_client_port)
Diffstat (limited to 'console_cmds.c')
-rw-r--r--console_cmds.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/console_cmds.c b/console_cmds.c
index 5891986fb..3f7f57d2b 100644
--- a/console_cmds.c
+++ b/console_cmds.c
@@ -552,6 +552,9 @@ DEF_CONSOLE_CMD(ConSayClient)
/* the "set" command */
/* **************************** */
+extern void ConsoleSetPatchSetting(char *name, char *value);
+extern void ConsoleGetPatchSetting(char *name);
+
DEF_CONSOLE_CMD(ConSet) {
if (argc < 2) {
IConsolePrint(_iconsole_color_warning, "Unknonw usage. Usage: set [setting] [value].");
@@ -562,8 +565,8 @@ DEF_CONSOLE_CMD(ConSet) {
// setting the server password
if ((strcmp(argv[1],"server_pw") == 0) || (strcmp(argv[1],"server_password") == 0)) {
- if (!_networking) {
- IConsolePrintF(_iconsole_color_error,"No network game running");
+ if (!_network_server) {
+ IConsolePrintF(_iconsole_color_error, "You are not the server");
return NULL;
}
if (argc == 3) {
@@ -639,8 +642,8 @@ DEF_CONSOLE_CMD(ConSet) {
// setting the server name
if (strcmp(argv[1],"server_name") == 0) {
- if (!_networking) {
- IConsolePrintF(_iconsole_color_error,"No network game running");
+ if (!_network_server) {
+ IConsolePrintF(_iconsole_color_error, "You are not the server");
return NULL;
}
if (argc == 3) {
@@ -654,6 +657,19 @@ DEF_CONSOLE_CMD(ConSet) {
return NULL;
}
+ // setting the server name
+ if (strcmp(argv[1],"port") == 0) {
+ if (argc == 3 && atoi(argv[2]) != 0) {
+ _network_server_port = atoi(argv[2]);
+ IConsolePrintF(_iconsole_color_warning, "Server-port changed to '%d'", _network_server_port);
+ IConsolePrintF(_iconsole_color_warning, "Changes will take effect the next time you start a server.");
+ } else {
+ IConsolePrintF(_iconsole_color_default, "Current server-port is '%d'", _network_server_port);
+ IConsolePrint(_iconsole_color_warning, "Usage: set server_port <port>.");
+ }
+ return NULL;
+ }
+
#endif
// Patch-options