diff options
author | rubidium <rubidium@openttd.org> | 2008-12-22 18:20:28 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-12-22 18:20:28 +0000 |
commit | e6e32bad4d160c67f1c589edd25af423529845c2 (patch) | |
tree | 881bcba98f09ad7b96e83dffa28fbb2f9f225a4e /src/console_cmds.cpp | |
parent | 887869c771f9f210afb75b1b8e4f875eea3b9954 (diff) | |
download | openttd-e6e32bad4d160c67f1c589edd25af423529845c2.tar.xz |
(svn r14711) -Codechange: don't misuse the _network_company_info password field for changing the password on clients.
Diffstat (limited to 'src/console_cmds.cpp')
-rw-r--r-- | src/console_cmds.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/console_cmds.cpp b/src/console_cmds.cpp index 52193e226..02fe2de72 100644 --- a/src/console_cmds.cpp +++ b/src/console_cmds.cpp @@ -1210,14 +1210,14 @@ DEF_CONSOLE_CMD(ConSayClient) return true; } -extern void HashCurrentCompanyPassword(); +extern void HashCurrentCompanyPassword(const char *password); /* Also use from within company_gui to change the password graphically */ bool NetworkChangeCompanyPassword(byte argc, char *argv[]) { if (argc == 0) { - if (!IsValidCompanyID(_local_company)) return true; // dedicated server - IConsolePrintF(CC_WARNING, "Current value for 'company_pw': %s", _network_company_info[_local_company].password); + IConsoleHelp("Change the password of your company. Usage: 'company_pw \"<password>\"'"); + IConsoleHelp("Use \"*\" to disable the password."); return true; } @@ -1230,15 +1230,13 @@ bool NetworkChangeCompanyPassword(byte argc, char *argv[]) if (strcmp(argv[0], "*") == 0) argv[0][0] = '\0'; - strecpy(_network_company_info[_local_company].password, argv[0], lastof(_network_company_info[_local_company].password)); - if (!_network_server) { - NetworkClientSetPassword(); + NetworkClientSetPassword(argv[0]); } else { - HashCurrentCompanyPassword(); + HashCurrentCompanyPassword(argv[0]); } - IConsolePrintF(CC_WARNING, "'company_pw' changed to: %s", _network_company_info[_local_company].password); + IConsolePrintF(CC_WARNING, "'company_pw' changed to: %s", argv[0]); return true; } |