mirror of https://github.com/OpenTTD/OpenTTD.git
Cleanup: remove client side password checks when moving to a different company
This commit is contained in:
parent
16639939e9
commit
9dc1fdc385
|
@ -2517,9 +2517,6 @@ struct CompanyWindow : Window
|
|||
if (_network_server) {
|
||||
NetworkServerDoMove(CLIENT_ID_SERVER, company);
|
||||
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 {
|
||||
/* just send the join command */
|
||||
NetworkClientRequestMove(company);
|
||||
|
@ -2567,10 +2564,6 @@ struct CompanyWindow : Window
|
|||
case WID_C_COMPANY_NAME:
|
||||
Command<CMD_RENAME_COMPANY>::Post(STR_ERROR_CAN_T_CHANGE_COMPANY_NAME, str);
|
||||
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)
|
||||
{
|
||||
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.");
|
||||
return true;
|
||||
}
|
||||
|
@ -943,9 +943,8 @@ DEF_CONSOLE_CMD(ConJoinCompany)
|
|||
return true;
|
||||
}
|
||||
|
||||
/* Check if the company requires a password */
|
||||
if (NetworkCompanyIsPassworded(company_id) && argc < 3) {
|
||||
IConsolePrint(CC_ERROR, "Company {} requires a password to join.", company_id + 1);
|
||||
if (!info->CanJoinCompany(company_id)) {
|
||||
IConsolePrint(CC_ERROR, "You are not allowed to join this company.");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -953,7 +952,7 @@ DEF_CONSOLE_CMD(ConJoinCompany)
|
|||
if (_network_server) {
|
||||
NetworkServerDoMove(CLIENT_ID_SERVER, company_id);
|
||||
} else {
|
||||
NetworkClientRequestMove(company_id, NetworkCompanyIsPassworded(company_id) ? argv[2] : "");
|
||||
NetworkClientRequestMove(company_id);
|
||||
}
|
||||
|
||||
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.
|
||||
* @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);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ void NetworkUpdateClientInfo(ClientID client_id);
|
|||
void NetworkClientsToSpectators(CompanyID cid);
|
||||
bool NetworkClientConnectGame(const std::string &connection_string, CompanyID default_company, const std::string &join_server_password = "");
|
||||
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 NetworkClientSendChat(NetworkAction action, DestType type, int dest, const std::string &msg, int64_t data = 0);
|
||||
bool NetworkClientPreferTeamChat(const NetworkClientInfo *cio);
|
||||
|
|
|
@ -86,7 +86,6 @@ enum ClientListWidgets : WidgetID {
|
|||
WID_CL_CLIENT_NAME_EDIT, ///< Edit button for client name.
|
||||
WID_CL_MATRIX, ///< 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.
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue