Change: Remove the LAN/Internet combobox from the server list in favour of adding two separate search buttons.

pull/217/head
frosch 3 years ago committed by Michael Lutz
parent 7bdfb382a8
commit 2bb691f50e

@ -1947,10 +1947,6 @@ STR_FACE_TIE_EARRING_TOOLTIP :{BLACK}Change t
# Network server list
STR_NETWORK_SERVER_LIST_CAPTION :{WHITE}Multiplayer
STR_NETWORK_SERVER_LIST_ADVERTISED :{BLACK}Advertised
STR_NETWORK_SERVER_LIST_ADVERTISED_TOOLTIP :{BLACK}Choose between an advertised (internet) and a not advertised (Local Area Network, LAN) game
STR_NETWORK_SERVER_LIST_ADVERTISED_NO :No
STR_NETWORK_SERVER_LIST_ADVERTISED_YES :Yes
STR_NETWORK_SERVER_LIST_PLAYER_NAME :{BLACK}Player name:
STR_NETWORK_SERVER_LIST_ENTER_NAME_TOOLTIP :{BLACK}This is the name other players will identify you by
@ -1991,8 +1987,10 @@ STR_NETWORK_SERVER_LIST_JOIN_GAME :{BLACK}Join gam
STR_NETWORK_SERVER_LIST_REFRESH :{BLACK}Refresh server
STR_NETWORK_SERVER_LIST_REFRESH_TOOLTIP :{BLACK}Refresh the server info
STR_NETWORK_SERVER_LIST_FIND_SERVER :{BLACK}Find server
STR_NETWORK_SERVER_LIST_FIND_SERVER_TOOLTIP :{BLACK}Search network for a server
STR_NETWORK_SERVER_LIST_SEARCH_SERVER_INTERNET :{BLACK}Search internet
STR_NETWORK_SERVER_LIST_SEARCH_SERVER_INTERNET_TOOLTIP :{BLACK}Search internet for public servers
STR_NETWORK_SERVER_LIST_SEARCH_SERVER_LAN :{BLACK}Search LAN
STR_NETWORK_SERVER_LIST_SEARCH_SERVER_LAN_TOOLTIP :{BLACK}Search local area network for servers
STR_NETWORK_SERVER_LIST_ADD_SERVER :{BLACK}Add server
STR_NETWORK_SERVER_LIST_ADD_SERVER_TOOLTIP :{BLACK}Adds a server to the list which will always be checked for running games
STR_NETWORK_SERVER_LIST_START_SERVER :{BLACK}Start server
@ -2009,6 +2007,8 @@ STR_NETWORK_START_SERVER_NEW_GAME_NAME_TOOLTIP :{BLACK}The game
STR_NETWORK_START_SERVER_SET_PASSWORD :{BLACK}Set password
STR_NETWORK_START_SERVER_PASSWORD_TOOLTIP :{BLACK}Protect your game with a password if you don't want it to be publicly accessible
STR_NETWORK_SERVER_LIST_ADVERTISED :{BLACK}Advertised
STR_NETWORK_SERVER_LIST_ADVERTISED_TOOLTIP :{BLACK}Choose between an advertised (internet) and a not advertised (Local Area Network, LAN) game
STR_NETWORK_START_SERVER_UNADVERTISED :No
STR_NETWORK_START_SERVER_ADVERTISED :Yes
STR_NETWORK_START_SERVER_CLIENTS_SELECT :{BLACK}{NUM} client{P "" s}

@ -55,15 +55,6 @@ static const StringID _connection_types_dropdown[] = {
INVALID_STRING_ID
};
/**
* Advertisement options in the server list
*/
static const StringID _lan_internet_types_dropdown[] = {
STR_NETWORK_SERVER_LIST_ADVERTISED_NO,
STR_NETWORK_SERVER_LIST_ADVERTISED_YES,
INVALID_STRING_ID
};
static std::vector<StringID> _language_dropdown;
void SortNetworkLanguages()
@ -503,27 +494,12 @@ public:
this->last_sorting = this->servers.GetListing();
}
void SetStringParameters(int widget) const override
{
switch (widget) {
case WID_NG_CONN_BTN:
SetDParam(0, _lan_internet_types_dropdown[_settings_client.network.lan_internet]);
break;
}
}
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
{
switch (widget) {
case WID_NG_CONN_BTN:
*size = maxdim(*size, maxdim(GetStringBoundingBox(_lan_internet_types_dropdown[0]), GetStringBoundingBox(_lan_internet_types_dropdown[1])));
size->width += padding.width;
size->height += padding.height;
break;
case WID_NG_MATRIX:
resize->height = WD_MATRIX_TOP + max(GetSpriteSize(SPR_BLOT).height, (uint)FONT_HEIGHT_NORMAL) + WD_MATRIX_BOTTOM;
size->height = 10 * resize->height;
size->height = 12 * resize->height;
break;
case WID_NG_LASTJOINED:
@ -560,10 +536,6 @@ public:
SetDParamMaxValue(0, 5);
*size = maxdim(*size, GetStringBoundingBox(STR_JUST_INT));
break;
case WID_NG_DETAILS_SPACER:
size->height = 20 + 12 * FONT_HEIGHT_NORMAL;
break;
}
}
@ -627,7 +599,8 @@ public:
this->GetWidget<NWidgetStacked>(WID_NG_NEWGRF_MISSING_SEL)->SetDisplayedPlane(sel == nullptr || !sel->online || sel->info.grfconfig == nullptr || !sel->info.version_compatible || sel->info.compatible);
#ifdef __EMSCRIPTEN__
this->SetWidgetDisabledState(WID_NG_FIND, true);
this->SetWidgetDisabledState(WID_NG_SEARCH_INTERNET, true);
this->SetWidgetDisabledState(WID_NG_SEARCH_LAN, true);
this->SetWidgetDisabledState(WID_NG_ADD, true);
this->SetWidgetDisabledState(WID_NG_START, true);
#endif
@ -715,10 +688,6 @@ public:
DeleteWindowById(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_GAME);
break;
case WID_NG_CONN_BTN: // 'Connection' droplist
ShowDropDownMenu(this, _lan_internet_types_dropdown, _settings_client.network.lan_internet, WID_NG_CONN_BTN, 0, 0); // do it for widget WID_NSS_CONN_BTN
break;
case WID_NG_NAME: // Sort by name
case WID_NG_CLIENTS: // Sort by connected clients
case WID_NG_MAPSIZE: // Sort by map size
@ -763,11 +732,12 @@ public:
break;
}
case WID_NG_FIND: // Find server automatically
switch (_settings_client.network.lan_internet) {
case 0: NetworkUDPSearchGame(); break;
case 1: NetworkUDPQueryMasterServer(); break;
}
case WID_NG_SEARCH_INTERNET:
NetworkUDPQueryMasterServer();
break;
case WID_NG_SEARCH_LAN:
NetworkUDPSearchGame();
break;
case WID_NG_ADD: // Add a server
@ -805,20 +775,6 @@ public:
}
}
void OnDropdownSelect(int widget, int index) override
{
switch (widget) {
case WID_NG_CONN_BTN:
_settings_client.network.lan_internet = index;
break;
default:
NOT_REACHED();
}
this->SetDirty();
}
/**
* Some data on this window has become invalid.
* @param data Information about the changed data.
@ -964,12 +920,6 @@ static const NWidgetPart _nested_network_game_widgets[] = {
NWidget(NWID_HORIZONTAL), SetPIP(10, 7, 10),
/* LEFT SIDE */
NWidget(NWID_VERTICAL), SetPIP(0, 7, 0),
NWidget(NWID_HORIZONTAL), SetPIP(0, 7, 0),
NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NG_CONNECTION), SetDataTip(STR_NETWORK_SERVER_LIST_ADVERTISED, STR_NULL),
NWidget(WWT_DROPDOWN, COLOUR_LIGHT_BLUE, WID_NG_CONN_BTN),
SetDataTip(STR_BLACK_STRING, STR_NETWORK_SERVER_LIST_ADVERTISED_TOOLTIP),
NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0),
EndContainer(),
NWidget(NWID_HORIZONTAL), SetPIP(0, 7, 0),
NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, WID_NG_FILTER_LABEL), SetDataTip(STR_LIST_FILTER_TITLE, STR_NULL),
NWidget(WWT_EDITBOX, COLOUR_LIGHT_BLUE, WID_NG_FILTER), SetMinimalSize(251, 12), SetFill(1, 0), SetResize(1, 0),
@ -1029,7 +979,8 @@ static const NWidgetPart _nested_network_game_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(NWID_VERTICAL),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 7, 4),
NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_FIND), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_FIND_SERVER, STR_NETWORK_SERVER_LIST_FIND_SERVER_TOOLTIP),
NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_SEARCH_INTERNET), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_SEARCH_SERVER_INTERNET, STR_NETWORK_SERVER_LIST_SEARCH_SERVER_INTERNET_TOOLTIP),
NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_SEARCH_LAN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_SEARCH_SERVER_LAN, STR_NETWORK_SERVER_LIST_SEARCH_SERVER_LAN_TOOLTIP),
NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_ADD), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_ADD_SERVER, STR_NETWORK_SERVER_LIST_ADD_SERVER_TOOLTIP),
NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_START), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_START_SERVER, STR_NETWORK_SERVER_LIST_START_SERVER_TOOLTIP),
NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, WID_NG_CANCEL), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BUTTON_CANCEL, STR_NULL),

@ -255,7 +255,6 @@ struct NetworkSettings {
char rcon_password[NETWORK_PASSWORD_LENGTH]; ///< password for rconsole (server side)
char admin_password[NETWORK_PASSWORD_LENGTH]; ///< password for the admin network
bool server_advertise; ///< advertise the server to the masterserver
uint8 lan_internet; ///< search on the LAN or internet for servers
char client_name[NETWORK_CLIENT_NAME_LENGTH]; ///< name of the player (as client)
char default_company_pass[NETWORK_PASSWORD_LENGTH]; ///< default password for new companies in encrypted form
char connect_to_ip[NETWORK_HOSTNAME_LENGTH]; ///< default for the "Add server" query

@ -3801,15 +3801,6 @@ flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
guiflags = SGF_NETWORK_ONLY
def = false
[SDTC_VAR]
var = network.lan_internet
type = SLE_UINT8
flags = SLF_NOT_IN_SAVE | SLF_NO_NETWORK_SYNC
guiflags = SGF_NETWORK_ONLY
def = 1
min = 0
max = 1
[SDTC_STR]
var = network.client_name
type = SLE_STRB

@ -14,8 +14,6 @@
enum NetworkGameWidgets {
WID_NG_MAIN, ///< Main panel.
WID_NG_CONNECTION, ///< Label in front of connection droplist.
WID_NG_CONN_BTN, ///< 'Connection' droplist button.
WID_NG_CLIENT_LABEL, ///< Label in front of client name edit box.
WID_NG_CLIENT, ///< Panel with editbox to set client name.
WID_NG_FILTER_LABEL, ///< Label in front of the filter/search edit box.
@ -45,7 +43,8 @@ enum NetworkGameWidgets {
WID_NG_NEWGRF_MISSING, ///< 'Find missing NewGRF online' button.
WID_NG_NEWGRF_MISSING_SEL, ///< Selection widget for the above button.
WID_NG_FIND, ///< 'Find server' button.
WID_NG_SEARCH_INTERNET, ///< 'Search internet server' button.
WID_NG_SEARCH_LAN, ///< 'Search LAN server' button.
WID_NG_ADD, ///< 'Add server' button.
WID_NG_START, ///< 'Start server' button.
WID_NG_CANCEL, ///< 'Cancel' button.

Loading…
Cancel
Save