src/network/network_gui.cpp
changeset 9273 35e0224ea8f1
parent 9269 599675909c2f
child 9274 42b67e65f1c2
equal deleted inserted replaced
9272:e64b518a7b54 9273:35e0224ea8f1
   316 				!sel->online ||
   316 				!sel->online ||
   317 				sel->info.grfconfig == NULL);
   317 				sel->info.grfconfig == NULL);
   318 
   318 
   319 		SetDParam(0, 0x00);
   319 		SetDParam(0, 0x00);
   320 		SetDParam(1, _lan_internet_types_dropdown[_network_lan_internet]);
   320 		SetDParam(1, _lan_internet_types_dropdown[_network_lan_internet]);
   321 		DrawWindowWidgets(this);
   321 		this->DrawWidgets();
   322 
   322 
   323 		/* Edit box to set player name */
   323 		/* Edit box to set player name */
   324 		this->DrawEditBox(NGWW_PLAYER);
   324 		this->DrawEditBox(NGWW_PLAYER);
   325 
   325 
   326 		DrawString(this->widget[NGWW_PLAYER].left - 100, 23, STR_NETWORK_PLAYER_NAME, TC_GOLD);
   326 		DrawString(this->widget[NGWW_PLAYER].left - 100, 23, STR_NETWORK_PLAYER_NAME, TC_GOLD);
   327 
   327 
   328 		/* Sort based on widgets: name, clients, compatibility */
   328 		/* Sort based on widgets: name, clients, compatibility */
   329 		switch (this->servers.sort_type) {
   329 		switch (this->servers.sort_type) {
   330 			case NGWW_NAME    - NGWW_NAME: DrawSortButtonState(this, NGWW_NAME,    arrow); break;
   330 			case NGWW_NAME    - NGWW_NAME: this->DrawSortButtonState(NGWW_NAME,    arrow); break;
   331 			case NGWW_CLIENTS - NGWW_NAME: DrawSortButtonState(this, NGWW_CLIENTS, arrow); break;
   331 			case NGWW_CLIENTS - NGWW_NAME: this->DrawSortButtonState(NGWW_CLIENTS, arrow); break;
   332 			case NGWW_INFO    - NGWW_NAME: DrawSortButtonState(this, NGWW_INFO,    arrow); break;
   332 			case NGWW_INFO    - NGWW_NAME: this->DrawSortButtonState(NGWW_INFO,    arrow); break;
   333 		}
   333 		}
   334 
   334 
   335 		uint16 y = NET_PRC__OFFSET_TOP_WIDGET + 3;
   335 		uint16 y = NET_PRC__OFFSET_TOP_WIDGET + 3;
   336 		int32 n = 0;
   336 		int32 n = 0;
   337 		int32 pos = this->vscroll.pos;
   337 		int32 pos = this->vscroll.pos;
   725 		SetDParam(1, _connection_types_dropdown[_network_advertise]);
   725 		SetDParam(1, _connection_types_dropdown[_network_advertise]);
   726 		SetDParam(2, _network_game_info.clients_max);
   726 		SetDParam(2, _network_game_info.clients_max);
   727 		SetDParam(3, _network_game_info.companies_max);
   727 		SetDParam(3, _network_game_info.companies_max);
   728 		SetDParam(4, _network_game_info.spectators_max);
   728 		SetDParam(4, _network_game_info.spectators_max);
   729 		SetDParam(5, STR_NETWORK_LANG_ANY + _network_game_info.server_lang);
   729 		SetDParam(5, STR_NETWORK_LANG_ANY + _network_game_info.server_lang);
   730 		DrawWindowWidgets(this);
   730 		this->DrawWidgets();
   731 
   731 
   732 		/* editbox to set game name */
   732 		/* editbox to set game name */
   733 		this->DrawEditBox(NSSW_GAMENAME);
   733 		this->DrawEditBox(NSSW_GAMENAME);
   734 
   734 
   735 		/* if password is set, draw red '*' next to 'Set password' button */
   735 		/* if password is set, draw red '*' next to 'Set password' button */
  1034 		/* Cannot spectate if there are too many spectators */
  1034 		/* Cannot spectate if there are too many spectators */
  1035 		this->SetWidgetDisabledState(NLWW_SPECTATE, gi->spectators_on >= gi->spectators_max);
  1035 		this->SetWidgetDisabledState(NLWW_SPECTATE, gi->spectators_on >= gi->spectators_max);
  1036 
  1036 
  1037 		/* Draw window widgets */
  1037 		/* Draw window widgets */
  1038 		SetDParamStr(0, gi->server_name);
  1038 		SetDParamStr(0, gi->server_name);
  1039 		DrawWindowWidgets(this);
  1039 		this->DrawWidgets();
  1040 
  1040 
  1041 		/* Draw company list */
  1041 		/* Draw company list */
  1042 		pos = this->vscroll.pos;
  1042 		pos = this->vscroll.pos;
  1043 		while (pos < gi->companies_on) {
  1043 		while (pos < gi->companies_on) {
  1044 			byte company = NetworkLobbyFindCompanyIndex(pos);
  1044 			byte company = NetworkLobbyFindCompanyIndex(pos);
  1408 	}
  1408 	}
  1409 
  1409 
  1410 
  1410 
  1411 	virtual void OnPaint()
  1411 	virtual void OnPaint()
  1412 	{
  1412 	{
  1413 		DrawWindowWidgets(this);
  1413 		this->DrawWidgets();
  1414 
  1414 
  1415 		/* Draw the actions */
  1415 		/* Draw the actions */
  1416 		int sel = this->sel_index;
  1416 		int sel = this->sel_index;
  1417 		int y = 1;
  1417 		int y = 1;
  1418 		for (int i = 0; i < MAX_CLIENTLIST_ACTION; i++, y += CLNWND_ROWSIZE) {
  1418 		for (int i = 0; i < MAX_CLIENTLIST_ACTION; i++, y += CLNWND_ROWSIZE) {
  1512 		int i = 0;
  1512 		int i = 0;
  1513 
  1513 
  1514 		/* Check if we need to reset the height */
  1514 		/* Check if we need to reset the height */
  1515 		if (!this->CheckClientListHeight()) return;
  1515 		if (!this->CheckClientListHeight()) return;
  1516 
  1516 
  1517 		DrawWindowWidgets(this);
  1517 		this->DrawWidgets();
  1518 
  1518 
  1519 		int y = CLNWND_OFFSET;
  1519 		int y = CLNWND_OFFSET;
  1520 
  1520 
  1521 		FOR_ALL_ACTIVE_CLIENT_INFOS(ci) {
  1521 		FOR_ALL_ACTIVE_CLIENT_INFOS(ci) {
  1522 			TextColour colour;
  1522 			TextColour colour;
  1604 	}
  1604 	}
  1605 
  1605 
  1606 	virtual void OnPaint()
  1606 	virtual void OnPaint()
  1607 	{
  1607 	{
  1608 		uint8 progress; // used for progress bar
  1608 		uint8 progress; // used for progress bar
  1609 		DrawWindowWidgets(this);
  1609 		this->DrawWidgets();
  1610 
  1610 
  1611 		DrawStringCentered(125, 35, STR_NETWORK_CONNECTING_1 + _network_join_status, TC_GREY);
  1611 		DrawStringCentered(125, 35, STR_NETWORK_CONNECTING_1 + _network_join_status, TC_GREY);
  1612 		switch (_network_join_status) {
  1612 		switch (_network_join_status) {
  1613 			case NETWORK_JOIN_STATUS_CONNECTING: case NETWORK_JOIN_STATUS_AUTHORIZING:
  1613 			case NETWORK_JOIN_STATUS_CONNECTING: case NETWORK_JOIN_STATUS_AUTHORIZING:
  1614 			case NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO:
  1614 			case NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO:
  1849 			STR_NETWORK_CHAT_ALL_CAPTION,
  1849 			STR_NETWORK_CHAT_ALL_CAPTION,
  1850 			STR_NETWORK_CHAT_COMPANY_CAPTION,
  1850 			STR_NETWORK_CHAT_COMPANY_CAPTION,
  1851 			STR_NETWORK_CHAT_CLIENT_CAPTION
  1851 			STR_NETWORK_CHAT_CLIENT_CAPTION
  1852 		};
  1852 		};
  1853 
  1853 
  1854 		DrawWindowWidgets(this);
  1854 		this->DrawWidgets();
  1855 
  1855 
  1856 		assert((uint)this->dtype < lengthof(chat_captions));
  1856 		assert((uint)this->dtype < lengthof(chat_captions));
  1857 		DrawStringRightAligned(this->widget[2].left - 2, this->widget[2].top + 1, chat_captions[this->dtype], TC_BLACK);
  1857 		DrawStringRightAligned(this->widget[2].left - 2, this->widget[2].top + 1, chat_captions[this->dtype], TC_BLACK);
  1858 		this->DrawEditBox(2);
  1858 		this->DrawEditBox(2);
  1859 	}
  1859 	}
  1951 		NetworkChangeCompanyPassword(1, &password);
  1951 		NetworkChangeCompanyPassword(1, &password);
  1952 	}
  1952 	}
  1953 
  1953 
  1954 	virtual void OnPaint()
  1954 	virtual void OnPaint()
  1955 	{
  1955 	{
  1956 		DrawWindowWidgets(this);
  1956 		this->DrawWidgets();
  1957 		this->DrawEditBox(4);
  1957 		this->DrawEditBox(4);
  1958 	}
  1958 	}
  1959 
  1959 
  1960 	virtual void OnClick(Point pt, int widget)
  1960 	virtual void OnClick(Point pt, int widget)
  1961 	{
  1961 	{