summaryrefslogtreecommitdiff
path: root/src/network/network.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-01-19 16:47:40 +0000
committerrubidium <rubidium@openttd.org>2011-01-19 16:47:40 +0000
commit795a5283289473185afdedb3133155101e84b0fe (patch)
tree00845d6c66a5a9289173acc4b7e1cb78eeb36c0d /src/network/network.cpp
parente54a1f67213218f52d8e27bce3aeda5d7dc16ad9 (diff)
downloadopenttd-795a5283289473185afdedb3133155101e84b0fe.tar.xz
(svn r21854) -Codechange: refactor the password setting methods to make it possible to change the password of other companies (on the server)
Diffstat (limited to 'src/network/network.cpp')
-rw-r--r--src/network/network.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/network/network.cpp b/src/network/network.cpp
index d29ac023c..0902fcdb0 100644
--- a/src/network/network.cpp
+++ b/src/network/network.cpp
@@ -151,18 +151,19 @@ byte NetworkSpectatorCount()
}
/**
- * Sets/resets company password
- * @param password new password, "" or "*" resets password
- * @return new password
+ * Change the company password of a given company.
+ * @param company_id ID of the company the password should be changed for.
+ * @param password The unhashed password we like to set ('*' or '' resets the password)
+ * @return The password.
*/
-const char *NetworkChangeCompanyPassword(const char *password)
+const char *NetworkChangeCompanyPassword(CompanyID company_id, const char *password, bool already_hashed)
{
if (strcmp(password, "*") == 0) password = "";
- if (!_network_server) {
- NetworkClientSetCompanyPassword(password);
+ if (_network_server) {
+ NetworkServerSetCompanyPassword(company_id, password, already_hashed);
} else {
- HashCurrentCompanyPassword(password);
+ NetworkClientSetCompanyPassword(password);
}
return password;