1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-19 10:22:39 +01:00

Codechange: Drop default widget strings for network windows.

This commit is contained in:
Peter Nelson
2025-03-03 18:48:59 +00:00
committed by Peter Nelson
parent d7963f6eb7
commit ab0d6e8b95
2 changed files with 28 additions and 30 deletions

View File

@@ -315,15 +315,7 @@ struct NetworkChatWindow : public Window {
this->message_editbox.cancel_button = WID_NC_CLOSE;
this->message_editbox.ok_button = WID_NC_SENDBUTTON;
static const StringID chat_captions[] = {
STR_NETWORK_CHAT_ALL_CAPTION,
STR_NETWORK_CHAT_COMPANY_CAPTION,
STR_NETWORK_CHAT_CLIENT_CAPTION
};
assert((uint)this->dtype < lengthof(chat_captions));
this->CreateNestedTree();
this->GetWidget<NWidgetCore>(WID_NC_DESTINATION)->SetString(chat_captions[this->dtype]);
this->FinishInitNested(type);
this->SetFocusedWidget(WID_NC_TEXTBOX);
@@ -363,11 +355,18 @@ struct NetworkChatWindow : public Window {
{
if (widget != WID_NC_DESTINATION) return this->Window::GetWidgetString(widget, stringid);
static const StringID chat_captions[] = {
STR_NETWORK_CHAT_ALL_CAPTION,
STR_NETWORK_CHAT_COMPANY_CAPTION,
STR_NETWORK_CHAT_CLIENT_CAPTION
};
assert((uint)this->dtype < lengthof(chat_captions));
if (this->dtype == DESTTYPE_CLIENT) {
return GetString(stringid, NetworkClientInfo::GetByClientID((ClientID)this->dest)->client_name);
return GetString(STR_NETWORK_CHAT_CLIENT_CAPTION, NetworkClientInfo::GetByClientID((ClientID)this->dest)->client_name);
}
return GetString(stringid);
return GetString(chat_captions[this->dtype]);
}
void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override