File diff r17886:18d13f57e663 → r17887:8dfb20a2d652
src/network/network_gui.cpp
Show inline comments
 
@@ -868,48 +868,53 @@ public:
 
			return state;
 
		}
 

	
 
		if (this->HandleEditBoxKey(NGWW_CLIENT, key, keycode, state) == HEBR_CONFIRM) return state;
 

	
 
		/* The name is only allowed when it starts with a letter! */
 
		if (!StrEmpty(this->edit_str_buf) && this->edit_str_buf[0] != ' ') {
 
			strecpy(_settings_client.network.client_name, this->edit_str_buf, lastof(_settings_client.network.client_name));
 
		} else {
 
			strecpy(_settings_client.network.client_name, "Player", lastof(_settings_client.network.client_name));
 
		}
 
		return state;
 
	}
 

	
 
	virtual void OnQueryTextFinished(char *str)
 
	{
 
		if (!StrEmpty(str)) NetworkAddServer(str);
 
	}
 

	
 
	virtual void OnResize()
 
	{
 
		this->vscroll->SetCapacityFromWidget(this, NGWW_MATRIX);
 
		this->GetWidget<NWidgetCore>(NGWW_MATRIX)->widget_data = (this->vscroll->GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
 
	}
 

	
 
	virtual void OnTick()
 
	{
 
		NetworkGameListRequery();
 
	}
 
};
 

	
 
Listing NetworkGameWindow::last_sorting = {false, 5};
 
GUIGameServerList::SortFunction * const NetworkGameWindow::sorter_funcs[] = {
 
	&NGameNameSorter,
 
	&NGameClientSorter,
 
	&NGameMapSizeSorter,
 
	&NGameDateSorter,
 
	&NGameYearsSorter,
 
	&NGameAllowedSorter
 
};
 

	
 
static NWidgetBase *MakeResizableHeader(int *biggest_index)
 
{
 
	*biggest_index = max<int>(*biggest_index, NGWW_INFO);
 
	return new NWidgetServerListHeader();
 
}
 

	
 
static const NWidgetPart _nested_network_game_widgets[] = {
 
	/* TOP */
 
	NWidget(NWID_HORIZONTAL),
 
		NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE),
 
		NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE), SetDataTip(STR_NETWORK_SERVER_LIST_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
 
	EndContainer(),