summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-12-22 18:20:28 +0000
committerrubidium <rubidium@openttd.org>2008-12-22 18:20:28 +0000
commite6e32bad4d160c67f1c589edd25af423529845c2 (patch)
tree881bcba98f09ad7b96e83dffa28fbb2f9f225a4e /src/network
parent887869c771f9f210afb75b1b8e4f875eea3b9954 (diff)
downloadopenttd-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/network')
-rw-r--r--src/network/network_client.cpp10
-rw-r--r--src/network/network_func.h2
2 files changed, 5 insertions, 7 deletions
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp
index 5098a8f64..6e6006d57 100644
--- a/src/network/network_client.cpp
+++ b/src/network/network_client.cpp
@@ -79,14 +79,12 @@ static const char *GenerateCompanyPasswordHash(const char *password)
/**
* Hash the current company password; used when the server 'company' sets his/her password.
*/
-void HashCurrentCompanyPassword()
+void HashCurrentCompanyPassword(const char *password)
{
- if (StrEmpty(_network_company_info[_local_company].password)) return;
-
_password_game_seed = _settings_game.game_creation.generation_seed;
strecpy(_password_server_unique_id, _settings_client.network.network_id, lastof(_password_server_unique_id));
- const char *new_pw = GenerateCompanyPasswordHash(_network_company_info[_local_company].password);
+ const char *new_pw = GenerateCompanyPasswordHash(password);
strecpy(_network_company_info[_local_company].password, new_pw, lastof(_network_company_info[_local_company].password));
}
@@ -950,9 +948,9 @@ void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const
SEND_COMMAND(PACKET_CLIENT_CHAT)(action, type, dest, msg);
}
-void NetworkClientSetPassword()
+void NetworkClientSetPassword(const char *password)
{
- SEND_COMMAND(PACKET_CLIENT_SET_PASSWORD)(_network_company_info[_local_company].password);
+ SEND_COMMAND(PACKET_CLIENT_SET_PASSWORD)(password);
}
#endif /* ENABLE_NETWORK */
diff --git a/src/network/network_func.h b/src/network/network_func.h
index cacf643f6..688015263 100644
--- a/src/network/network_func.h
+++ b/src/network/network_func.h
@@ -40,7 +40,7 @@ void NetworkUpdateClientInfo(ClientID client_id);
bool NetworkClientConnectGame(const char *host, uint16 port);
void NetworkClientSendRcon(const char *password, const char *command);
void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const char *msg);
-void NetworkClientSetPassword();
+void NetworkClientSetPassword(const char *password);
/*** Commands ran by the server ***/
void NetworkServerMonthlyLoop();