summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTELK <telk5093@gmail.com>2021-06-29 01:42:23 +0900
committerGitHub <noreply@github.com>2021-06-28 18:42:23 +0200
commitf9b4a3a5e69bbf7ac7a353d2b1bb5061be96158b (patch)
treed1e0269cd15e7c02f8a32087a59d3562a04f17be
parent883e4ea325886e5cee88b34c2d9e069f12697c96 (diff)
downloadopenttd-f9b4a3a5e69bbf7ac7a353d2b1bb5061be96158b.tar.xz
Add: Show the number of clients and companies in the online players window (#9376)
-rw-r--r--src/lang/english.txt1
-rw-r--r--src/network/network_gui.cpp10
-rw-r--r--src/widgets/network_widget.h1
3 files changed, 11 insertions, 1 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 206cc212f..bd5cff8d3 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -2152,6 +2152,7 @@ STR_NETWORK_CLIENT_LIST_NEW_COMPANY :(New company)
STR_NETWORK_CLIENT_LIST_NEW_COMPANY_TOOLTIP :{BLACK}Create a new company and join it
STR_NETWORK_CLIENT_LIST_PLAYER_ICON_SELF_TOOLTIP :{BLACK}This is you
STR_NETWORK_CLIENT_LIST_PLAYER_ICON_HOST_TOOLTIP :{BLACK}This is the host of the game
+STR_NETWORK_CLIENT_LIST_CLIENT_COMPANY_COUNT :{BLACK}{NUM} client{P "" s} / {NUM} compan{P y ies}
STR_NETWORK_CLIENT_LIST_ADMIN_CLIENT_KICK :Kick
STR_NETWORK_CLIENT_LIST_ADMIN_CLIENT_BAN :Ban
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index 52819660d..e3e05db92 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -1627,7 +1627,10 @@ static const NWidgetPart _nested_client_list_widgets[] = {
EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL),
- NWidget(WWT_MATRIX, COLOUR_GREY, WID_CL_MATRIX), SetMinimalSize(180, 0), SetResize(1, 1), SetFill(1, 1), SetMatrixDataTip(1, 0, STR_NULL), SetScrollbar(WID_CL_SCROLLBAR),
+ NWidget(NWID_VERTICAL),
+ NWidget(WWT_MATRIX, COLOUR_GREY, WID_CL_MATRIX), SetMinimalSize(180, 0), SetResize(1, 1), SetFill(1, 1), SetMatrixDataTip(1, 0, STR_NULL), SetScrollbar(WID_CL_SCROLLBAR),
+ NWidget(WWT_TEXT, COLOUR_GREY, WID_CL_CLIENT_COMPANY_COUNT), SetFill(1, 0), SetMinimalTextLines(1, 0), SetResize(1, 0), SetPadding(2, 1, 2, 1), SetAlignment(SA_CENTER), SetDataTip(STR_NETWORK_CLIENT_LIST_CLIENT_COMPANY_COUNT, STR_NULL),
+ EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_CL_SCROLLBAR),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
@@ -2050,6 +2053,11 @@ public:
case WID_CL_CLIENT_NAME:
SetDParamStr(0, _settings_client.network.client_name);
break;
+
+ case WID_CL_CLIENT_COMPANY_COUNT:
+ SetDParam(0, NetworkClientInfo::GetNumItems());
+ SetDParam(1, Company::GetNumItems());
+ break;
}
}
diff --git a/src/widgets/network_widget.h b/src/widgets/network_widget.h
index 2ed94d284..a96a56fa8 100644
--- a/src/widgets/network_widget.h
+++ b/src/widgets/network_widget.h
@@ -106,6 +106,7 @@ enum ClientListWidgets {
WID_CL_MATRIX, ///< Company/client list.
WID_CL_SCROLLBAR, ///< Scrollbar for company/client list.
WID_CL_COMPANY_JOIN, ///< Used for QueryWindow when a company has a password.
+ WID_CL_CLIENT_COMPANY_COUNT, ///< Count of clients and companies.
};
/** Widgets of the #NetworkJoinStatusWindow class. */