MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetTooltip

Method GetTooltip

src/network/network_gui.cpp:1514–1531  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1512 }
1513
1514 std::optional<EncodedString> GetTooltip(Rect r, const Point &pt) const override
1515 {
1516 bool rtl = _current_text_dir == TD_RTL;
1517 Dimension d = GetScaledSpriteSize(SPR_PLAYER_SELF);
1518
1519 if (r.WithWidth(d.width, rtl).Contains(pt)) {
1520 const NetworkClientInfo *ci = NetworkClientInfo::GetIfValid(this->client_pool_id);
1521 if (ci != nullptr) {
1522 if (ci->client_id == _network_own_client_id) {
1523 return GetEncodedString(STR_NETWORK_CLIENT_LIST_PLAYER_ICON_SELF_TOOLTIP);
1524 } else if (ci->client_id == CLIENT_ID_SERVER) {
1525 return GetEncodedString(STR_NETWORK_CLIENT_LIST_PLAYER_ICON_HOST_TOOLTIP);
1526 }
1527 }
1528 }
1529
1530 return this->ButtonLine::GetTooltip(r, pt);
1531 }
1532
1533private:
1534 ClientPoolID client_pool_id;

Callers

nothing calls this directly

Calls 4

GetScaledSpriteSizeFunction · 0.85
WithWidthMethod · 0.80
GetEncodedStringFunction · 0.50
ContainsMethod · 0.45

Tested by

no test coverage detected