mirror of https://github.com/OpenTTD/OpenTTD
Cleanup: remove client side password checks when moving to a different company
parent
16639939e9
commit
9dc1fdc385
|
@ -2517,9 +2517,6 @@ struct CompanyWindow : Window
|
||||||
if (_network_server) {
|
if (_network_server) {
|
||||||
NetworkServerDoMove(CLIENT_ID_SERVER, company);
|
NetworkServerDoMove(CLIENT_ID_SERVER, company);
|
||||||
MarkWholeScreenDirty();
|
MarkWholeScreenDirty();
|
||||||
} else if (NetworkCompanyIsPassworded(company)) {
|
|
||||||
/* ask for the password */
|
|
||||||
ShowQueryString(STR_EMPTY, STR_NETWORK_NEED_COMPANY_PASSWORD_CAPTION, NETWORK_PASSWORD_LENGTH, this, CS_ALPHANUMERAL, QSF_PASSWORD);
|
|
||||||
} else {
|
} else {
|
||||||
/* just send the join command */
|
/* just send the join command */
|
||||||
NetworkClientRequestMove(company);
|
NetworkClientRequestMove(company);
|
||||||
|
@ -2567,10 +2564,6 @@ struct CompanyWindow : Window
|
||||||
case WID_C_COMPANY_NAME:
|
case WID_C_COMPANY_NAME:
|
||||||
Command<CMD_RENAME_COMPANY>::Post(STR_ERROR_CAN_T_CHANGE_COMPANY_NAME, str);
|
Command<CMD_RENAME_COMPANY>::Post(STR_ERROR_CAN_T_CHANGE_COMPANY_NAME, str);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WID_C_COMPANY_JOIN:
|
|
||||||
NetworkClientRequestMove((CompanyID)this->window_number, str);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -914,7 +914,7 @@ DEF_CONSOLE_CMD(ConClientNickChange)
|
||||||
DEF_CONSOLE_CMD(ConJoinCompany)
|
DEF_CONSOLE_CMD(ConJoinCompany)
|
||||||
{
|
{
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
IConsolePrint(CC_HELP, "Request joining another company. Usage: 'join <company-id> [<password>]'.");
|
IConsolePrint(CC_HELP, "Request joining another company. Usage: 'join <company-id>'.");
|
||||||
IConsolePrint(CC_HELP, "For valid company-id see company list, use 255 for spectator.");
|
IConsolePrint(CC_HELP, "For valid company-id see company list, use 255 for spectator.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -943,9 +943,8 @@ DEF_CONSOLE_CMD(ConJoinCompany)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the company requires a password */
|
if (!info->CanJoinCompany(company_id)) {
|
||||||
if (NetworkCompanyIsPassworded(company_id) && argc < 3) {
|
IConsolePrint(CC_ERROR, "You are not allowed to join this company.");
|
||||||
IConsolePrint(CC_ERROR, "Company {} requires a password to join.", company_id + 1);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -953,7 +952,7 @@ DEF_CONSOLE_CMD(ConJoinCompany)
|
||||||
if (_network_server) {
|
if (_network_server) {
|
||||||
NetworkServerDoMove(CLIENT_ID_SERVER, company_id);
|
NetworkServerDoMove(CLIENT_ID_SERVER, company_id);
|
||||||
} else {
|
} else {
|
||||||
NetworkClientRequestMove(company_id, NetworkCompanyIsPassworded(company_id) ? argv[2] : "");
|
NetworkClientRequestMove(company_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1249,10 +1249,8 @@ void NetworkClientSendRcon(const std::string &password, const std::string &comma
|
||||||
/**
|
/**
|
||||||
* Notify the server of this client wanting to be moved to another company.
|
* Notify the server of this client wanting to be moved to another company.
|
||||||
* @param company_id id of the company the client wishes to be moved to.
|
* @param company_id id of the company the client wishes to be moved to.
|
||||||
* @param pass the password, is only checked on the server end if a password is needed.
|
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
void NetworkClientRequestMove(CompanyID company_id, [[maybe_unused]] const std::string &pass)
|
void NetworkClientRequestMove(CompanyID company_id)
|
||||||
{
|
{
|
||||||
MyClient::SendMove(company_id);
|
MyClient::SendMove(company_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ void NetworkUpdateClientInfo(ClientID client_id);
|
||||||
void NetworkClientsToSpectators(CompanyID cid);
|
void NetworkClientsToSpectators(CompanyID cid);
|
||||||
bool NetworkClientConnectGame(const std::string &connection_string, CompanyID default_company, const std::string &join_server_password = "");
|
bool NetworkClientConnectGame(const std::string &connection_string, CompanyID default_company, const std::string &join_server_password = "");
|
||||||
void NetworkClientJoinGame();
|
void NetworkClientJoinGame();
|
||||||
void NetworkClientRequestMove(CompanyID company, const std::string &pass = "");
|
void NetworkClientRequestMove(CompanyID company);
|
||||||
void NetworkClientSendRcon(const std::string &password, const std::string &command);
|
void NetworkClientSendRcon(const std::string &password, const std::string &command);
|
||||||
void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const std::string &msg, int64_t data = 0);
|
void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const std::string &msg, int64_t data = 0);
|
||||||
bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio);
|
bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio);
|
||||||
|
|
|
@ -86,7 +86,6 @@ enum ClientListWidgets : WidgetID {
|
||||||
WID_CL_CLIENT_NAME_EDIT, ///< Edit button for client name.
|
WID_CL_CLIENT_NAME_EDIT, ///< Edit button for client name.
|
||||||
WID_CL_MATRIX, ///< Company/client list.
|
WID_CL_MATRIX, ///< Company/client list.
|
||||||
WID_CL_SCROLLBAR, ///< Scrollbar for company/client list.
|
WID_CL_SCROLLBAR, ///< Scrollbar for company/client list.
|
||||||
WID_CL_COMPANY_JOIN, ///< Used for QueryWindow when a company has a password.
|
|
||||||
WID_CL_CLIENT_COMPANY_COUNT, ///< Count of clients and companies.
|
WID_CL_CLIENT_COMPANY_COUNT, ///< Count of clients and companies.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue