Changeset - r25647:654b04e21150
[Not reviewed]
master
0 1 0
TELK - 3 years ago 2021-06-13 08:06:50
telk5093@gmail.com
Fix #9362: Hover in online players window was slightly too big (#9364)

This causes graphical glitches at the bottom of the window.
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/network/network_gui.cpp
Show inline comments
 
@@ -2328,49 +2328,49 @@ public:
 
				if (player_icon != 0) {
 
					Dimension d2 = GetSpriteSize(player_icon);
 
					uint offset_x = CLIENT_OFFSET_LEFT - 3;
 
					int offset_y = std::max(0, ((int)(this->line_height + 1) - (int)d2.height) / 2);
 
					DrawSprite(player_icon, PALETTE_TO_GREY, rtl ? text_right - offset_x : text_left + offset_x - d2.width, y + offset_y);
 
				}
 

	
 
				SetDParamStr(0, ci->client_name);
 
				DrawString(rtl ? x : text_left + CLIENT_OFFSET_LEFT, rtl ? text_right - CLIENT_OFFSET_LEFT : x, y + text_y_offset, STR_JUST_RAW_STRING, TC_BLACK);
 
			}
 

	
 
			y += this->line_height;
 
			line++;
 
		}
 
	}
 

	
 
	void DrawWidget(const Rect &r, int widget) const override
 
	{
 
		switch (widget) {
 
			case WID_CL_MATRIX: {
 
				uint line = 0;
 

	
 
				if (this->hover_index >= 0) {
 
					uint offset = this->hover_index * this->line_height;
 
					GfxFillRect(r.left + 2, r.top + offset, r.right - 1, r.top + offset + this->line_height - 1, GREY_SCALE(9));
 
					GfxFillRect(r.left + 2, r.top + offset, r.right - 1, r.top + offset + this->line_height - 2, GREY_SCALE(9));
 
				}
 

	
 
				NetworkClientInfo *own_ci = NetworkClientInfo::GetByClientID(_network_own_client_id);
 
				if (own_ci->client_playas == COMPANY_SPECTATOR && !NetworkMaxCompaniesReached()) {
 
					this->DrawCompany(COMPANY_NEW_COMPANY, r.left, r.right, r.top, line);
 
				}
 

	
 
				if (own_ci->client_playas != COMPANY_SPECTATOR) {
 
					this->DrawCompany(own_ci->client_playas, r.left, r.right, r.top, line);
 
				}
 

	
 
				for (const Company *c : Company::Iterate()) {
 
					if (own_ci->client_playas == c->index) continue;
 
					this->DrawCompany(c->index, r.left, r.right, r.top, line);
 
				}
 

	
 
				/* Specators */
 
				this->DrawCompany(COMPANY_SPECTATOR, r.left, r.right, r.top, line);
 

	
 
				break;
 
			}
 
		}
 
	}
 

	
0 comments (0 inline, 0 general)