mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
Cleanup: remove UI for changing the password
This commit is contained in:
parent
9dc1fdc385
commit
a9318cf653
@ -890,8 +890,6 @@ CommandCost CmdCompanyCtrl(DoCommandFlag flags, CompanyCtrlAction cca, CompanyID
|
||||
break;
|
||||
}
|
||||
|
||||
/* Send new companies, before potentially setting the password. Otherwise,
|
||||
* the password update could be sent when the company is not yet known. */
|
||||
NetworkAdminCompanyNew(c);
|
||||
NetworkServerNewCompany(c, ci);
|
||||
|
||||
@ -899,9 +897,6 @@ CommandCost CmdCompanyCtrl(DoCommandFlag flags, CompanyCtrlAction cca, CompanyID
|
||||
if (client_id == _network_own_client_id) {
|
||||
assert(_local_company == COMPANY_SPECTATOR);
|
||||
SetLocalCompany(c->index);
|
||||
if (!_settings_client.network.default_company_pass.empty()) {
|
||||
NetworkChangeCompanyPassword(_local_company, _settings_client.network.default_company_pass);
|
||||
}
|
||||
|
||||
/* In network games, we need to try setting the company manager face here to sync it to all clients.
|
||||
* If a favorite company manager face is selected, choose it. Otherwise, use a random face. */
|
||||
|
@ -2147,9 +2147,6 @@ static constexpr NWidgetPart _nested_company_widgets[] = {
|
||||
|
||||
/* Multi player buttons. */
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(0, WidgetDimensions::unscaled.hsep_normal, 0), SetPIPRatio(1, 0, 0),
|
||||
NWidget(NWID_VERTICAL), SetPIPRatio(1, 0, 0),
|
||||
NWidget(WWT_EMPTY, COLOUR_GREY, WID_C_HAS_PASSWORD), SetFill(0, 0),
|
||||
EndContainer(),
|
||||
NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_normal, 0),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_C_SELECT_HOSTILE_TAKEOVER),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_HOSTILE_TAKEOVER), SetDataTip(STR_COMPANY_VIEW_HOSTILE_TAKEOVER_BUTTON, STR_COMPANY_VIEW_HOSTILE_TAKEOVER_TOOLTIP),
|
||||
@ -2158,7 +2155,6 @@ static constexpr NWidgetPart _nested_company_widgets[] = {
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_GIVE_MONEY), SetDataTip(STR_COMPANY_VIEW_GIVE_MONEY_BUTTON, STR_COMPANY_VIEW_GIVE_MONEY_TOOLTIP),
|
||||
EndContainer(),
|
||||
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_C_SELECT_MULTIPLAYER),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_COMPANY_PASSWORD), SetDataTip(STR_COMPANY_VIEW_PASSWORD, STR_COMPANY_VIEW_PASSWORD_TOOLTIP),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_C_COMPANY_JOIN), SetDataTip(STR_COMPANY_VIEW_JOIN, STR_COMPANY_VIEW_JOIN_TOOLTIP),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
@ -2191,10 +2187,6 @@ struct CompanyWindow : Window
|
||||
|
||||
/** Display planes in the company window. */
|
||||
enum CompanyWindowPlanes {
|
||||
/* Display planes of the #WID_C_SELECT_MULTIPLAYER selection widget. */
|
||||
CWP_MP_C_PWD = 0, ///< Display the company password button.
|
||||
CWP_MP_C_JOIN, ///< Display the join company button.
|
||||
|
||||
/* Display planes of the #WID_C_SELECT_VIEW_BUILD_HQ selection widget. */
|
||||
CWP_VB_VIEW = 0, ///< Display the view button
|
||||
CWP_VB_BUILD, ///< Display the build button
|
||||
@ -2235,7 +2227,7 @@ struct CompanyWindow : Window
|
||||
reinit |= this->GetWidget<NWidgetStacked>(WID_C_SELECT_HOSTILE_TAKEOVER)->SetDisplayedPlane((local || _local_company == COMPANY_SPECTATOR || !c->is_ai || _networking) ? SZSP_NONE : 0);
|
||||
|
||||
/* Multiplayer buttons. */
|
||||
reinit |= this->GetWidget<NWidgetStacked>(WID_C_SELECT_MULTIPLAYER)->SetDisplayedPlane((!_networking) ? (int)SZSP_NONE : (int)(local ? CWP_MP_C_PWD : CWP_MP_C_JOIN));
|
||||
reinit |= this->GetWidget<NWidgetStacked>(WID_C_SELECT_MULTIPLAYER)->SetDisplayedPlane((!_networking || !NetworkCanJoinCompany(c->index) || _local_company == c->index) ? (int)SZSP_NONE : 0);
|
||||
|
||||
this->SetWidgetDisabledState(WID_C_COMPANY_JOIN, c->is_ai);
|
||||
|
||||
@ -2293,7 +2285,6 @@ struct CompanyWindow : Window
|
||||
case WID_C_VIEW_INFRASTRUCTURE:
|
||||
case WID_C_GIVE_MONEY:
|
||||
case WID_C_HOSTILE_TAKEOVER:
|
||||
case WID_C_COMPANY_PASSWORD:
|
||||
case WID_C_COMPANY_JOIN:
|
||||
size.width = GetStringBoundingBox(STR_COMPANY_VIEW_VIEW_HQ_BUTTON).width;
|
||||
size.width = std::max(size.width, GetStringBoundingBox(STR_COMPANY_VIEW_BUILD_HQ_BUTTON).width);
|
||||
@ -2301,14 +2292,9 @@ struct CompanyWindow : Window
|
||||
size.width = std::max(size.width, GetStringBoundingBox(STR_COMPANY_VIEW_INFRASTRUCTURE_BUTTON).width);
|
||||
size.width = std::max(size.width, GetStringBoundingBox(STR_COMPANY_VIEW_GIVE_MONEY_BUTTON).width);
|
||||
size.width = std::max(size.width, GetStringBoundingBox(STR_COMPANY_VIEW_HOSTILE_TAKEOVER_BUTTON).width);
|
||||
size.width = std::max(size.width, GetStringBoundingBox(STR_COMPANY_VIEW_PASSWORD).width);
|
||||
size.width = std::max(size.width, GetStringBoundingBox(STR_COMPANY_VIEW_JOIN).width);
|
||||
size.width += padding.width;
|
||||
break;
|
||||
|
||||
case WID_C_HAS_PASSWORD:
|
||||
if (_networking) size = maxdim(size, GetSpriteSize(SPR_LOCK));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2403,12 +2389,6 @@ struct CompanyWindow : Window
|
||||
case WID_C_DESC_INFRASTRUCTURE_COUNTS:
|
||||
DrawInfrastructureCountsWidget(r, c);
|
||||
break;
|
||||
|
||||
case WID_C_HAS_PASSWORD:
|
||||
if (_networking && NetworkCompanyIsPassworded(c->index)) {
|
||||
DrawSprite(SPR_LOCK, PAL_NONE, r.left, r.top);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2507,10 +2487,6 @@ struct CompanyWindow : Window
|
||||
ShowBuyCompanyDialog((CompanyID)this->window_number, true);
|
||||
break;
|
||||
|
||||
case WID_C_COMPANY_PASSWORD:
|
||||
if (this->window_number == _local_company) ShowNetworkCompanyPasswordWindow(this);
|
||||
break;
|
||||
|
||||
case WID_C_COMPANY_JOIN: {
|
||||
this->query_widget = WID_C_COMPANY_JOIN;
|
||||
CompanyID company = (CompanyID)this->window_number;
|
||||
|
@ -1907,53 +1907,6 @@ DEF_CONSOLE_CMD(ConSayClient)
|
||||
return true;
|
||||
}
|
||||
|
||||
DEF_CONSOLE_CMD(ConCompanyPassword)
|
||||
{
|
||||
if (argc == 0) {
|
||||
if (_network_dedicated) {
|
||||
IConsolePrint(CC_HELP, "Change the password of a company. Usage: 'company_pw <company-no> \"<password>\".");
|
||||
} else if (_network_server) {
|
||||
IConsolePrint(CC_HELP, "Change the password of your or any other company. Usage: 'company_pw [<company-no>] \"<password>\"'.");
|
||||
} else {
|
||||
IConsolePrint(CC_HELP, "Change the password of your company. Usage: 'company_pw \"<password>\"'.");
|
||||
}
|
||||
|
||||
IConsolePrint(CC_HELP, "Use \"*\" to disable the password.");
|
||||
return true;
|
||||
}
|
||||
|
||||
CompanyID company_id;
|
||||
std::string password;
|
||||
const char *errormsg;
|
||||
|
||||
if (argc == 2) {
|
||||
company_id = _local_company;
|
||||
password = argv[1];
|
||||
errormsg = "You have to own a company to make use of this command.";
|
||||
} else if (argc == 3 && _network_server) {
|
||||
company_id = (CompanyID)(atoi(argv[1]) - 1);
|
||||
password = argv[2];
|
||||
errormsg = "You have to specify the ID of a valid human controlled company.";
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Company::IsValidHumanID(company_id)) {
|
||||
IConsolePrint(CC_ERROR, errormsg);
|
||||
return false;
|
||||
}
|
||||
|
||||
password = NetworkChangeCompanyPassword(company_id, password);
|
||||
|
||||
if (password.empty()) {
|
||||
IConsolePrint(CC_INFO, "Company password cleared.");
|
||||
} else {
|
||||
IConsolePrint(CC_INFO, "Company password changed to '{}'.", password);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** All the known authorized keys with their name. */
|
||||
static std::vector<std::pair<std::string_view, NetworkAuthorizedKeys *>> _console_cmd_authorized_keys{
|
||||
{ "rcon", &_settings_client.network.rcon_authorized_keys },
|
||||
@ -2802,9 +2755,6 @@ void IConsoleStdLibRegister()
|
||||
IConsole::CmdRegister("authorized_key", ConNetworkAuthorizedKey, ConHookServerOnly);
|
||||
IConsole::AliasRegister("ak", "authorized_key %+");
|
||||
|
||||
IConsole::CmdRegister("company_pw", ConCompanyPassword, ConHookNeedNetwork);
|
||||
IConsole::AliasRegister("company_password", "company_pw %+");
|
||||
|
||||
IConsole::AliasRegister("net_frame_freq", "setting frame_freq %+");
|
||||
IConsole::AliasRegister("net_sync_freq", "setting sync_freq %+");
|
||||
IConsole::AliasRegister("server_pw", "setting server_password %+");
|
||||
|
@ -2510,13 +2510,11 @@ STR_NETWORK_CLIENT_LIST_SERVER_CONNECTION_TYPE_TURN :{BLACK}Via rela
|
||||
STR_NETWORK_CLIENT_LIST_ADMIN_CLIENT_KICK :Kick
|
||||
STR_NETWORK_CLIENT_LIST_ADMIN_CLIENT_BAN :Ban
|
||||
STR_NETWORK_CLIENT_LIST_ADMIN_COMPANY_RESET :Delete
|
||||
STR_NETWORK_CLIENT_LIST_ADMIN_COMPANY_UNLOCK :Password unlock
|
||||
|
||||
STR_NETWORK_CLIENT_LIST_ASK_CAPTION :{WHITE}Admin action
|
||||
STR_NETWORK_CLIENT_LIST_ASK_CLIENT_KICK :{YELLOW}Are you sure you want to kick player '{RAW_STRING}'?
|
||||
STR_NETWORK_CLIENT_LIST_ASK_CLIENT_BAN :{YELLOW}Are you sure you want to ban player '{RAW_STRING}'?
|
||||
STR_NETWORK_CLIENT_LIST_ASK_COMPANY_RESET :{YELLOW}Are you sure you want to delete company '{COMPANY}'?
|
||||
STR_NETWORK_CLIENT_LIST_ASK_COMPANY_UNLOCK :{YELLOW}Are you sure you want to reset the password of company '{COMPANY}'?
|
||||
|
||||
STR_NETWORK_ASK_RELAY_CAPTION :{WHITE}Use relay?
|
||||
STR_NETWORK_ASK_RELAY_TEXT :{YELLOW}Failed to establish a connection between you and server '{RAW_STRING}'.{}Would you like to relay this session via '{RAW_STRING}'?
|
||||
@ -2533,19 +2531,9 @@ STR_NETWORK_ASK_SURVEY_YES :Yes
|
||||
|
||||
STR_NETWORK_SPECTATORS :Spectators
|
||||
|
||||
# Network set password
|
||||
STR_COMPANY_PASSWORD_CANCEL :{BLACK}Do not save the entered password
|
||||
STR_COMPANY_PASSWORD_OK :{BLACK}Give the company the new password
|
||||
STR_COMPANY_PASSWORD_CAPTION :{WHITE}Company password
|
||||
STR_COMPANY_PASSWORD_MAKE_DEFAULT :{BLACK}Default company password
|
||||
STR_COMPANY_PASSWORD_MAKE_DEFAULT_TOOLTIP :{BLACK}Use this company password as default for new companies
|
||||
|
||||
# Network company info join/password
|
||||
STR_COMPANY_VIEW_JOIN :{BLACK}Join
|
||||
STR_COMPANY_VIEW_JOIN_TOOLTIP :{BLACK}Join and play as this company
|
||||
STR_COMPANY_VIEW_PASSWORD :{BLACK}Password
|
||||
STR_COMPANY_VIEW_PASSWORD_TOOLTIP :{BLACK}Password-protect your company to prevent unauthorised users from joining
|
||||
STR_COMPANY_VIEW_SET_PASSWORD :{BLACK}Set company password
|
||||
|
||||
# Network chat
|
||||
STR_NETWORK_CHAT_SEND :{BLACK}Send
|
||||
|
@ -227,25 +227,6 @@ uint8_t NetworkSpectatorCount()
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
std::string NetworkChangeCompanyPassword(CompanyID company_id, std::string password)
|
||||
{
|
||||
if (password.compare("*") == 0) password = "";
|
||||
|
||||
if (_network_server) {
|
||||
NetworkServerSetCompanyPassword(company_id, password, false);
|
||||
} else {
|
||||
NetworkClientSetCompanyPassword(password);
|
||||
}
|
||||
|
||||
return password;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hash the given password using server ID and game seed.
|
||||
* @param password Password to hash.
|
||||
|
@ -1362,14 +1362,6 @@ void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const
|
||||
MyClient::SendChat(action, type, dest, msg, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set/Reset company password on the client side.
|
||||
* @param password Password to be set.
|
||||
*/
|
||||
void NetworkClientSetCompanyPassword([[maybe_unused]] const std::string &password)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell whether the client has team members who they can chat to.
|
||||
* @param cio client to check members of.
|
||||
|
@ -104,7 +104,6 @@ public:
|
||||
typedef ClientNetworkGameSocketHandler MyClient;
|
||||
|
||||
void NetworkClient_Connected();
|
||||
void NetworkClientSetCompanyPassword(const std::string &password);
|
||||
|
||||
/** Information required to join a server. */
|
||||
struct NetworkJoinInfo {
|
||||
|
@ -39,7 +39,6 @@ bool NetworkValidateServerName(std::string &server_name);
|
||||
void NetworkUpdateClientName(const std::string &client_name);
|
||||
void NetworkUpdateServerGameType();
|
||||
bool NetworkCompanyHasClients(CompanyID company);
|
||||
std::string NetworkChangeCompanyPassword(CompanyID company_id, std::string password);
|
||||
void NetworkReboot();
|
||||
void NetworkDisconnect(bool close_admins = true);
|
||||
void NetworkGameLoop();
|
||||
|
@ -1311,7 +1311,6 @@ enum DropDownAdmin {
|
||||
DD_CLIENT_ADMIN_KICK,
|
||||
DD_CLIENT_ADMIN_BAN,
|
||||
DD_COMPANY_ADMIN_RESET,
|
||||
DD_COMPANY_ADMIN_UNLOCK,
|
||||
};
|
||||
|
||||
/**
|
||||
@ -1344,15 +1343,6 @@ static void AdminCompanyResetCallback(Window *, bool confirmed)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback function for admin command to unlock company.
|
||||
* @param confirmed Iff the user pressed Yes.
|
||||
*/
|
||||
static void AdminCompanyUnlockCallback(Window *, bool confirmed)
|
||||
{
|
||||
if (confirmed) NetworkServerSetCompanyPassword(_admin_company_id, "", false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Button shown for either a company or client in the client-list.
|
||||
*
|
||||
@ -1509,7 +1499,6 @@ private:
|
||||
{
|
||||
DropDownList list;
|
||||
list.push_back(MakeDropDownListStringItem(STR_NETWORK_CLIENT_LIST_ADMIN_COMPANY_RESET, DD_COMPANY_ADMIN_RESET, NetworkCompanyHasClients(company_id)));
|
||||
list.push_back(MakeDropDownListStringItem(STR_NETWORK_CLIENT_LIST_ADMIN_COMPANY_UNLOCK, DD_COMPANY_ADMIN_UNLOCK, !NetworkCompanyIsPassworded(company_id)));
|
||||
|
||||
Rect wi_rect;
|
||||
wi_rect.left = pt.x;
|
||||
@ -1863,13 +1852,6 @@ public:
|
||||
SetDParam(0, _admin_company_id);
|
||||
break;
|
||||
|
||||
case DD_COMPANY_ADMIN_UNLOCK:
|
||||
_admin_company_id = this->dd_company_id;
|
||||
text = STR_NETWORK_CLIENT_LIST_ASK_COMPANY_UNLOCK;
|
||||
callback = AdminCompanyUnlockCallback;
|
||||
SetDParam(0, _admin_company_id);
|
||||
break;
|
||||
|
||||
default:
|
||||
NOT_REACHED();
|
||||
}
|
||||
@ -2241,114 +2223,6 @@ void ShowNetworkNeedPassword(NetworkPasswordType npt, std::shared_ptr<NetworkAut
|
||||
ShowQueryString(STR_EMPTY, caption, NETWORK_PASSWORD_LENGTH, w, CS_ALPHANUMERAL, QSF_PASSWORD);
|
||||
}
|
||||
|
||||
struct NetworkCompanyPasswordWindow : public Window {
|
||||
QueryString password_editbox; ///< Password editbox.
|
||||
Dimension warning_size; ///< How much space to use for the warning text
|
||||
|
||||
NetworkCompanyPasswordWindow(WindowDesc *desc, Window *parent) : Window(desc), password_editbox(NETWORK_PASSWORD_LENGTH)
|
||||
{
|
||||
this->InitNested(0);
|
||||
this->UpdateWarningStringSize();
|
||||
|
||||
this->parent = parent;
|
||||
this->querystrings[WID_NCP_PASSWORD] = &this->password_editbox;
|
||||
this->password_editbox.cancel_button = WID_NCP_CANCEL;
|
||||
this->password_editbox.ok_button = WID_NCP_OK;
|
||||
this->SetFocusedWidget(WID_NCP_PASSWORD);
|
||||
}
|
||||
|
||||
void UpdateWarningStringSize()
|
||||
{
|
||||
assert(this->nested_root->smallest_x > 0);
|
||||
this->warning_size.width = this->nested_root->current_x - (WidgetDimensions::scaled.framerect.Horizontal()) * 2;
|
||||
this->warning_size.height = GetStringHeight(STR_WARNING_PASSWORD_SECURITY, this->warning_size.width);
|
||||
this->warning_size.height += (WidgetDimensions::scaled.framerect.Vertical()) * 2;
|
||||
|
||||
this->ReInit();
|
||||
}
|
||||
|
||||
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
|
||||
{
|
||||
if (widget == WID_NCP_WARNING) {
|
||||
size = this->warning_size;
|
||||
}
|
||||
}
|
||||
|
||||
void DrawWidget(const Rect &r, WidgetID widget) const override
|
||||
{
|
||||
if (widget != WID_NCP_WARNING) return;
|
||||
|
||||
DrawStringMultiLine(r.Shrink(WidgetDimensions::scaled.framerect),
|
||||
STR_WARNING_PASSWORD_SECURITY, TC_FROMSTRING, SA_CENTER);
|
||||
}
|
||||
|
||||
void OnOk()
|
||||
{
|
||||
if (this->IsWidgetLowered(WID_NCP_SAVE_AS_DEFAULT_PASSWORD)) {
|
||||
_settings_client.network.default_company_pass = this->password_editbox.text.buf;
|
||||
}
|
||||
|
||||
NetworkChangeCompanyPassword(_local_company, this->password_editbox.text.buf);
|
||||
}
|
||||
|
||||
void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_NCP_OK:
|
||||
this->OnOk();
|
||||
[[fallthrough]];
|
||||
|
||||
case WID_NCP_CANCEL:
|
||||
this->Close();
|
||||
break;
|
||||
|
||||
case WID_NCP_SAVE_AS_DEFAULT_PASSWORD:
|
||||
this->ToggleWidgetLoweredState(WID_NCP_SAVE_AS_DEFAULT_PASSWORD);
|
||||
this->SetDirty();
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static constexpr NWidgetPart _nested_network_company_password_window_widgets[] = {
|
||||
NWidget(NWID_HORIZONTAL),
|
||||
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
|
||||
NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_COMPANY_PASSWORD_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_NCP_BACKGROUND),
|
||||
NWidget(NWID_VERTICAL), SetPIP(5, 5, 5),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(5, 5, 5),
|
||||
NWidget(WWT_TEXT, COLOUR_GREY, WID_NCP_LABEL), SetDataTip(STR_COMPANY_VIEW_PASSWORD, STR_NULL),
|
||||
NWidget(WWT_EDITBOX, COLOUR_GREY, WID_NCP_PASSWORD), SetFill(1, 0), SetMinimalSize(194, 12), SetDataTip(STR_COMPANY_VIEW_SET_PASSWORD, STR_NULL),
|
||||
EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL), SetPIP(5, 0, 5),
|
||||
NWidget(NWID_SPACER), SetFill(1, 0),
|
||||
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_NCP_SAVE_AS_DEFAULT_PASSWORD), SetMinimalSize(194, 12),
|
||||
SetDataTip(STR_COMPANY_PASSWORD_MAKE_DEFAULT, STR_COMPANY_PASSWORD_MAKE_DEFAULT_TOOLTIP),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
EndContainer(),
|
||||
NWidget(WWT_PANEL, COLOUR_GREY, WID_NCP_WARNING), EndContainer(),
|
||||
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_NCP_CANCEL), SetFill(1, 0), SetDataTip(STR_BUTTON_CANCEL, STR_COMPANY_PASSWORD_CANCEL),
|
||||
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_NCP_OK), SetFill(1, 0), SetDataTip(STR_BUTTON_OK, STR_COMPANY_PASSWORD_OK),
|
||||
EndContainer(),
|
||||
};
|
||||
|
||||
static WindowDesc _network_company_password_window_desc(
|
||||
WDP_AUTO, nullptr, 0, 0,
|
||||
WC_COMPANY_PASSWORD_WINDOW, WC_NONE,
|
||||
0,
|
||||
std::begin(_nested_network_company_password_window_widgets), std::end(_nested_network_company_password_window_widgets)
|
||||
);
|
||||
|
||||
void ShowNetworkCompanyPasswordWindow(Window *parent)
|
||||
{
|
||||
CloseWindowById(WC_COMPANY_PASSWORD_WINDOW, 0);
|
||||
|
||||
new NetworkCompanyPasswordWindow(&_network_company_password_window_desc, parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Window used for asking the user if he is okay using a relay server.
|
||||
*/
|
||||
|
@ -22,7 +22,6 @@ void ShowNetworkChatQueryWindow(DestType type, int dest);
|
||||
void ShowJoinStatusWindow();
|
||||
void ShowNetworkGameWindow();
|
||||
void ShowClientList();
|
||||
void ShowNetworkCompanyPasswordWindow(Window *parent);
|
||||
void ShowNetworkAskRelay(const std::string &server_connection_string, const std::string &relay_connection_string, const std::string &token);
|
||||
void ShowNetworkAskSurvey();
|
||||
void ShowSurveyResultTextfileWindow();
|
||||
|
@ -1667,16 +1667,6 @@ bool NetworkServerChangeClientName(ClientID client_id, const std::string &new_na
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set/Reset a company password on the server end.
|
||||
* @param company_id ID of the company the password should be changed for.
|
||||
* @param password The new password.
|
||||
* @param already_hashed Is the given password already hashed?
|
||||
*/
|
||||
void NetworkServerSetCompanyPassword([[maybe_unused]] CompanyID company_id, [[maybe_unused]] const std::string &password, [[maybe_unused]] bool already_hashed)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the command-queue of a socket.
|
||||
* @param cs The socket to handle the queue for.
|
||||
@ -1983,20 +1973,6 @@ void NetworkServerUpdateGameInfo()
|
||||
if (_network_server) FillStaticNetworkServerGameInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell that a particular company is (not) passworded.
|
||||
* @param company_id The company that got/removed the password.
|
||||
* @param passworded Whether the password was received or removed.
|
||||
*/
|
||||
void NetworkServerUpdateCompanyPassworded(CompanyID company_id, bool passworded)
|
||||
{
|
||||
if (NetworkCompanyIsPassworded(company_id) == passworded) return;
|
||||
|
||||
SetWindowClassesDirty(WC_COMPANY);
|
||||
|
||||
NetworkAdminCompanyUpdate(Company::GetIfValid(company_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the tid-bits of moving a client from one company to another.
|
||||
* @param client_id id of the client we want to move.
|
||||
|
@ -123,7 +123,5 @@ public:
|
||||
|
||||
void NetworkServer_Tick(bool send_frame);
|
||||
void ChangeNetworkRestartTime(bool reset);
|
||||
void NetworkServerSetCompanyPassword(CompanyID company_id, const std::string &password, bool already_hashed = true);
|
||||
void NetworkServerUpdateCompanyPassworded(CompanyID company_id, bool passworded);
|
||||
|
||||
#endif /* NETWORK_SERVER_H */
|
||||
|
@ -894,12 +894,6 @@ static void MakeNewGameDone()
|
||||
InitializeRailGUI();
|
||||
InitializeRoadGUI();
|
||||
|
||||
/* We are the server, we start a new company (not dedicated),
|
||||
* so set the default password *if* needed. */
|
||||
if (_network_server && !_settings_client.network.default_company_pass.empty()) {
|
||||
NetworkChangeCompanyPassword(_local_company, _settings_client.network.default_company_pass);
|
||||
}
|
||||
|
||||
if (_settings_client.gui.pause_on_newgame) Command<CMD_PAUSE>::Post(PM_PAUSED_NORMAL, true);
|
||||
|
||||
CheckEngines();
|
||||
|
@ -47,9 +47,7 @@ enum CompanyWidgets : WidgetID {
|
||||
WID_C_SELECT_HOSTILE_TAKEOVER, ///< Selection widget for the hostile takeover button.
|
||||
WID_C_HOSTILE_TAKEOVER, ///< Button to hostile takeover another company.
|
||||
|
||||
WID_C_HAS_PASSWORD, ///< Has company password lock.
|
||||
WID_C_SELECT_MULTIPLAYER, ///< Multiplayer selection panel.
|
||||
WID_C_COMPANY_PASSWORD, ///< Button to set company password.
|
||||
WID_C_COMPANY_JOIN, ///< Button to join company.
|
||||
};
|
||||
|
||||
|
@ -96,17 +96,6 @@ enum NetworkJoinStatusWidgets : WidgetID {
|
||||
WID_NJS_CANCELOK, ///< Cancel / OK button.
|
||||
};
|
||||
|
||||
/** Widgets of the #NetworkCompanyPasswordWindow class. */
|
||||
enum NetworkCompanyPasswordWidgets : WidgetID {
|
||||
WID_NCP_BACKGROUND, ///< Background of the window.
|
||||
WID_NCP_LABEL, ///< Label in front of the password field.
|
||||
WID_NCP_PASSWORD, ///< Input field for the password.
|
||||
WID_NCP_SAVE_AS_DEFAULT_PASSWORD, ///< Toggle 'button' for saving the current password as default password.
|
||||
WID_NCP_WARNING, ///< Warning text about password security
|
||||
WID_NCP_CANCEL, ///< Close the window without changing anything.
|
||||
WID_NCP_OK, ///< Safe the password etc.
|
||||
};
|
||||
|
||||
/** Widgets of the #NetworkAskRelayWindow class. */
|
||||
enum NetworkAskRelayWidgets : WidgetID {
|
||||
WID_NAR_CAPTION, ///< Caption of the window.
|
||||
|
@ -502,13 +502,6 @@ enum WindowClass {
|
||||
*/
|
||||
WC_SEND_NETWORK_MSG,
|
||||
|
||||
/**
|
||||
* Company password query; %Window numbers:
|
||||
* - 0 = #NetworkCompanyPasswordWidgets
|
||||
*/
|
||||
WC_COMPANY_PASSWORD_WINDOW,
|
||||
|
||||
|
||||
/**
|
||||
* Industry cargoes chain; %Window numbers:
|
||||
* - 0 = #IndustryCargoesWidgets
|
||||
|
Loading…
Reference in New Issue
Block a user