summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2019-03-04 07:49:37 +0000
committerMichael Lutz <michi@icosahedron.de>2019-03-24 16:10:04 +0100
commit317f69c1520a3e60335c56d358686609d3decf86 (patch)
treea3432e9e5f433043f3e5431892f49580f1965c73 /src/network
parentaafce475963e2d2df59de9b02242a04856e78f93 (diff)
downloadopenttd-317f69c1520a3e60335c56d358686609d3decf86.tar.xz
Codechange: Use override specifier in Window-derived classes.
Diffstat (limited to 'src/network')
-rw-r--r--src/network/network_chat_gui.cpp16
-rw-r--r--src/network/network_content_gui.cpp26
-rw-r--r--src/network/network_content_gui.h4
-rw-r--r--src/network/network_gui.cpp80
4 files changed, 63 insertions, 63 deletions
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp
index 94e289885..21607e9e8 100644
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -320,7 +320,7 @@ struct NetworkChatWindow : public Window {
InvalidateWindowData(WC_NEWS_WINDOW, 0, 0);
}
- virtual void FindWindowPlacementAndResize(int def_width, int def_height)
+ void FindWindowPlacementAndResize(int def_width, int def_height) override
{
Window::FindWindowPlacementAndResize(_toolbar_width, def_height);
}
@@ -458,13 +458,13 @@ struct NetworkChatWindow : public Window {
free(pre_buf);
}
- virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number)
+ Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) override
{
Point pt = { 0, _screen.height - sm_height - FindWindowById(WC_STATUS_BAR, 0)->height };
return pt;
}
- virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
+ void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
{
if (widget != WID_NC_DESTINATION) return;
@@ -477,7 +477,7 @@ struct NetworkChatWindow : public Window {
*size = maxdim(*size, d);
}
- virtual void DrawWidget(const Rect &r, int widget) const
+ void DrawWidget(const Rect &r, int widget) const override
{
if (widget != WID_NC_DESTINATION) return;
@@ -487,7 +487,7 @@ struct NetworkChatWindow : public Window {
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + WD_FRAMERECT_TOP, this->dest_string, TC_BLACK, SA_RIGHT);
}
- virtual void OnClick(Point pt, int widget, int click_count)
+ void OnClick(Point pt, int widget, int click_count) override
{
switch (widget) {
case WID_NC_SENDBUTTON: /* Send */
@@ -500,7 +500,7 @@ struct NetworkChatWindow : public Window {
}
}
- virtual EventState OnKeyPress(WChar key, uint16 keycode)
+ EventState OnKeyPress(WChar key, uint16 keycode) override
{
EventState state = ES_NOT_HANDLED;
if (keycode == WKC_TAB) {
@@ -510,7 +510,7 @@ struct NetworkChatWindow : public Window {
return state;
}
- virtual void OnEditboxChanged(int wid)
+ void OnEditboxChanged(int wid) override
{
_chat_tab_completion_active = false;
}
@@ -520,7 +520,7 @@ struct NetworkChatWindow : public Window {
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
- virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
+ void OnInvalidateData(int data = 0, bool gui_scope = true) override
{
if (data == this->dest) delete this;
}
diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp
index 321a53bc7..49ecf2b24 100644
--- a/src/network/network_content_gui.cpp
+++ b/src/network/network_content_gui.cpp
@@ -257,7 +257,7 @@ public:
InvalidateWindowData(WC_NETWORK_WINDOW, WN_NETWORK_WINDOW_CONTENT_LIST, 2);
}
- virtual void OnClick(Point pt, int widget, int click_count)
+ void OnClick(Point pt, int widget, int click_count) override
{
if (widget == WID_NCDS_CANCELOK) {
if (this->downloaded_bytes != this->total_bytes) {
@@ -271,7 +271,7 @@ public:
}
}
- virtual void OnDownloadProgress(const ContentInfo *ci, int bytes)
+ void OnDownloadProgress(const ContentInfo *ci, int bytes) override
{
BaseNetworkContentDownloadStatusWindow::OnDownloadProgress(ci, bytes);
this->receivedTypes.Include(ci->type);
@@ -562,7 +562,7 @@ public:
_network_content_client.RemoveCallback(this);
}
- virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
+ void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
{
switch (widget) {
case WID_NCL_FILTER_CAPT:
@@ -590,7 +590,7 @@ public:
}
- virtual void DrawWidget(const Rect &r, int widget) const
+ void DrawWidget(const Rect &r, int widget) const override
{
switch (widget) {
case WID_NCL_FILTER_CAPT:
@@ -607,7 +607,7 @@ public:
}
}
- virtual void OnPaint()
+ void OnPaint() override
{
const SortButtonState arrow = this->content.IsDescSortOrder() ? SBS_DOWN : SBS_UP;
@@ -779,7 +779,7 @@ public:
}
}
- virtual void OnClick(Point pt, int widget, int click_count)
+ void OnClick(Point pt, int widget, int click_count) override
{
if (widget >= WID_NCL_TEXTFILE && widget < WID_NCL_TEXTFILE + TFT_END) {
if (this->selected == NULL || this->selected->state != ContentInfo::ALREADY_HERE) return;
@@ -865,7 +865,7 @@ public:
}
}
- virtual EventState OnKeyPress(WChar key, uint16 keycode)
+ EventState OnKeyPress(WChar key, uint16 keycode) override
{
switch (keycode) {
case WKC_UP:
@@ -937,7 +937,7 @@ public:
return ES_HANDLED;
}
- virtual void OnEditboxChanged(int wid)
+ void OnEditboxChanged(int wid) override
{
if (wid == WID_NCL_FILTER) {
this->filter_data.string_filter.SetFilterTerm(this->filter_editbox.text.buf);
@@ -947,25 +947,25 @@ public:
}
}
- virtual void OnResize()
+ void OnResize() override
{
this->vscroll->SetCapacityFromWidget(this, WID_NCL_MATRIX);
}
- virtual void OnReceiveContentInfo(const ContentInfo *rci)
+ void OnReceiveContentInfo(const ContentInfo *rci) override
{
if (this->auto_select && !rci->IsSelected()) _network_content_client.ToggleSelectedState(rci);
this->content.ForceRebuild();
this->InvalidateData();
}
- virtual void OnDownloadComplete(ContentID cid)
+ void OnDownloadComplete(ContentID cid) override
{
this->content.ForceResort();
this->InvalidateData();
}
- virtual void OnConnect(bool success)
+ void OnConnect(bool success) override
{
if (!success) {
ShowErrorMessage(STR_CONTENT_ERROR_COULD_NOT_CONNECT, INVALID_STRING_ID, WL_ERROR);
@@ -981,7 +981,7 @@ public:
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
- virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
+ void OnInvalidateData(int data = 0, bool gui_scope = true) override
{
if (!gui_scope) return;
if (this->content.NeedRebuild()) this->BuildContentList();
diff --git a/src/network/network_content_gui.h b/src/network/network_content_gui.h
index 139701001..8afd245d7 100644
--- a/src/network/network_content_gui.h
+++ b/src/network/network_content_gui.h
@@ -39,8 +39,8 @@ public:
*/
~BaseNetworkContentDownloadStatusWindow();
- virtual void DrawWidget(const Rect &r, int widget) const;
- virtual void OnDownloadProgress(const ContentInfo *ci, int bytes);
+ void DrawWidget(const Rect &r, int widget) const override;
+ void OnDownloadProgress(const ContentInfo *ci, int bytes) override;
};
void BuildContentTypeStringList();
diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp
index f90370312..b12aaa823 100644
--- a/src/network/network_gui.cpp
+++ b/src/network/network_gui.cpp
@@ -494,7 +494,7 @@ public:
this->last_sorting = this->servers.GetListing();
}
- virtual void SetStringParameters(int widget) const
+ void SetStringParameters(int widget) const override
{
switch (widget) {
case WID_NG_CONN_BTN:
@@ -503,7 +503,7 @@ public:
}
}
- virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
+ void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
{
switch (widget) {
case WID_NG_CONN_BTN:
@@ -558,7 +558,7 @@ public:
}
}
- virtual void DrawWidget(const Rect &r, int widget) const
+ void DrawWidget(const Rect &r, int widget) const override
{
switch (widget) {
case WID_NG_MATRIX: {
@@ -595,7 +595,7 @@ public:
}
- virtual void OnPaint()
+ void OnPaint() override
{
if (this->servers.NeedRebuild()) {
this->BuildGUINetworkGameList();
@@ -691,7 +691,7 @@ public:
}
}
- virtual void OnClick(Point pt, int widget, int click_count)
+ void OnClick(Point pt, int widget, int click_count) override
{
switch (widget) {
case WID_NG_CANCEL: // Cancel button
@@ -788,7 +788,7 @@ public:
}
}
- virtual void OnDropdownSelect(int widget, int index)
+ void OnDropdownSelect(int widget, int index) override
{
switch (widget) {
case WID_NG_CONN_BTN:
@@ -807,13 +807,13 @@ public:
* @param data Information about the changed data.
* @param gui_scope Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See #InvalidateWindowData() for details.
*/
- virtual void OnInvalidateData(int data = 0, bool gui_scope = true)
+ void OnInvalidateData(int data = 0, bool gui_scope = true) override
{
this->servers.ForceRebuild();
this->SetDirty();
}
- virtual EventState OnKeyPress(WChar key, uint16 keycode)
+ EventState OnKeyPress(WChar key, uint16 keycode) override
{
EventState state = ES_NOT_HANDLED;
@@ -874,7 +874,7 @@ public:
return state;
}
- virtual void OnEditboxChanged(int wid)
+ void OnEditboxChanged(int wid) override
{
switch (wid) {
case WID_NG_FILTER: {
@@ -896,17 +896,17 @@ public:
}
}
- virtual void OnQueryTextFinished(char *str)
+ void OnQueryTextFinished(char *str) override
{
if (!StrEmpty(str)) NetworkAddServer(str);
}
- virtual void OnResize()
+ void OnResize() override
{
this->vscroll->SetCapacityFromWidget(this, WID_NG_MATRIX);
}
- virtual void OnRealtimeTick(uint delta_ms)
+ void OnRealtimeTick(uint delta_ms) override
{
if (!this->requery_timer.Elapsed(delta_ms)) return;
this->requery_timer.SetInterval(MILLISECONDS_PER_TICK);
@@ -1067,7 +1067,7 @@ struct NetworkStartServerWindow : public Window {
this->SetFocusedWidget(WID_NSS_GAMENAME);
}
- virtual void SetStringParameters(int widget) const
+ void SetStringParameters(int widget) const override
{
switch (widget) {
case WID_NSS_CONNTYPE_BTN:
@@ -1092,7 +1092,7 @@ struct NetworkStartServerWindow : public Window {
}
}
- virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
+ void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
{
switch (widget) {
case WID_NSS_CONNTYPE_BTN:
@@ -1103,7 +1103,7 @@ struct NetworkStartServerWindow : public Window {
}
}
- virtual void DrawWidget(const Rect &r, int widget) const
+ void DrawWidget(const Rect &r, int widget) const override
{
switch (widget) {
case WID_NSS_SETPWD:
@@ -1112,7 +1112,7 @@ struct NetworkStartServerWindow : public Window {
}
}
- virtual void OnClick(Point pt, int widget, int click_count)
+ void OnClick(Point pt, int widget, int click_count) override
{
switch (widget) {
case WID_NSS_CANCEL: // Cancel button
@@ -1208,7 +1208,7 @@ struct NetworkStartServerWindow : public Window {
}
}
- virtual void OnDropdownSelect(int widget, int index)
+ void OnDropdownSelect(int widget, int index) override
{
switch (widget) {
case WID_NSS_CONNTYPE_BTN:
@@ -1224,14 +1224,14 @@ struct NetworkStartServerWindow : public Window {
this->SetDirty();
}
- virtual void OnEditboxChanged(int wid)
+ void OnEditboxChanged(int wid) override
{
if (wid == WID_NSS_GAMENAME) {
strecpy(_settings_client.network.server_name, this->name_editbox.text.buf, lastof(_settings_client.network.server_name));
}
}
- virtual void OnTimeout()
+ void OnTimeout() override
{
static const int raise_widgets[] = {WID_NSS_CLIENTS_BTND, WID_NSS_CLIENTS_BTNU, WID_NSS_COMPANIES_BTND, WID_NSS_COMPANIES_BTNU, WID_NSS_SPECTATORS_BTND, WID_NSS_SPECTATORS_BTNU, WIDGET_LIST_END};
for (const int *widget = raise_widgets; *widget != WIDGET_LIST_END; widget++) {
@@ -1242,7 +1242,7 @@ struct NetworkStartServerWindow : public Window {
}
}
- virtual void OnQueryTextFinished(char *str)
+ void OnQueryTextFinished(char *str) override
{
if (str == NULL) return;
@@ -1384,7 +1384,7 @@ struct NetworkLobbyWindow : public Window {
return COMPANY_FIRST;
}
- virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
+ void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
{
switch (widget) {
case WID_NL_HEADER:
@@ -1402,7 +1402,7 @@ struct NetworkLobbyWindow : public Window {
}
}
- virtual void SetStringParameters(int widget) const
+ void SetStringParameters(int widget) const override
{
switch (widget) {
case WID_NL_TEXT:
@@ -1411,7 +1411,7 @@ struct NetworkLobbyWindow : public Window {
}
}
- virtual void DrawWidget(const Rect &r, int widget) const
+ void DrawWidget(const Rect &r, int widget) const override
{
switch (widget) {
case WID_NL_DETAILS:
@@ -1424,7 +1424,7 @@ struct NetworkLobbyWindow : public Window {
}
}
- virtual void OnPaint()
+ void OnPaint() override
{
const NetworkGameInfo *gi = &this->server->info;
@@ -1546,7 +1546,7 @@ struct NetworkLobbyWindow : public Window {
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_GAME_LOBBY_PLAYERS); // players
}
- virtual void OnClick(Point pt, int widget, int click_count)
+ void OnClick(Point pt, int widget, int click_count) override
{
switch (widget) {
case WID_NL_CANCEL: // Cancel button
@@ -1585,7 +1585,7 @@ struct NetworkLobbyWindow : public Window {
}
}
- virtual void OnResize()
+ void OnResize() override
{
this->vscroll->SetCapacityFromWidget(this, WID_NL_MATRIX);
}
@@ -1777,12 +1777,12 @@ struct NetworkClientListPopupWindow : Window {
CLRBITS(this->flags, WF_WHITE_BORDER);
}
- virtual Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number)
+ Point OnInitialPosition(int16 sm_width, int16 sm_height, int window_number) override
{
return this->desired_location;
}
- virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
+ void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
{
Dimension d = *size;
for (const ClientListAction *action = this->actions.Begin(); action != this->actions.End(); action++) {
@@ -1795,7 +1795,7 @@ struct NetworkClientListPopupWindow : Window {
*size = d;
}
- virtual void DrawWidget(const Rect &r, int widget) const
+ void DrawWidget(const Rect &r, int widget) const override
{
/* Draw the actions */
int sel = this->sel_index;
@@ -1813,7 +1813,7 @@ struct NetworkClientListPopupWindow : Window {
}
}
- virtual void OnMouseLoop()
+ void OnMouseLoop() override
{
/* We selected an action */
uint index = (_cursor.pos.y - this->top - WD_FRAMERECT_TOP) / FONT_HEIGHT_NORMAL;
@@ -1904,7 +1904,7 @@ struct NetworkClientListWindow : Window {
return true;
}
- virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
+ void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
{
if (widget != WID_CL_PANEL) return;
@@ -1921,7 +1921,7 @@ struct NetworkClientListWindow : Window {
size->width = WD_FRAMERECT_LEFT + this->server_client_width + this->icon_size.width + WD_FRAMERECT_LEFT + width + WD_FRAMERECT_RIGHT;
}
- virtual void OnPaint()
+ void OnPaint() override
{
/* Check if we need to reset the height */
if (!this->CheckClientListHeight()) return;
@@ -1929,7 +1929,7 @@ struct NetworkClientListWindow : Window {
this->DrawWidgets();
}
- virtual void DrawWidget(const Rect &r, int widget) const
+ void DrawWidget(const Rect &r, int widget) const override
{
if (widget != WID_CL_PANEL) return;
@@ -1975,7 +1975,7 @@ struct NetworkClientListWindow : Window {
}
}
- virtual void OnClick(Point pt, int widget, int click_count)
+ void OnClick(Point pt, int widget, int click_count) override
{
/* Show the popup with option */
if (this->selected_item != -1) {
@@ -1991,7 +1991,7 @@ struct NetworkClientListWindow : Window {
}
}
- virtual void OnMouseOver(Point pt, int widget)
+ void OnMouseOver(Point pt, int widget) override
{
/* -1 means we left the current window */
if (pt.y == -1) {
@@ -2035,7 +2035,7 @@ struct NetworkJoinStatusWindow : Window {
this->InitNested(WN_NETWORK_STATUS_WINDOW_JOIN);
}
- virtual void DrawWidget(const Rect &r, int widget) const
+ void DrawWidget(const Rect &r, int widget) const override
{
if (widget != WID_NJS_BACKGROUND) return;
@@ -2069,7 +2069,7 @@ struct NetworkJoinStatusWindow : Window {
DrawFrameRect(r.left + 20, r.top + 5, (int)((this->width - 20) * progress / 100), r.top + 15, COLOUR_MAUVE, FR_NONE);
}
- virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
+ void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
{
if (widget != WID_NJS_BACKGROUND) return;
@@ -2095,7 +2095,7 @@ struct NetworkJoinStatusWindow : Window {
size->width = width + WD_FRAMERECT_LEFT + WD_FRAMERECT_BOTTOM + 10;
}
- virtual void OnClick(Point pt, int widget, int click_count)
+ void OnClick(Point pt, int widget, int click_count) override
{
if (widget == WID_NJS_CANCELOK) { // Disconnect button
NetworkDisconnect();
@@ -2104,7 +2104,7 @@ struct NetworkJoinStatusWindow : Window {
}
}
- virtual void OnQueryTextFinished(char *str)
+ void OnQueryTextFinished(char *str) override
{
if (StrEmpty(str)) {
NetworkDisconnect();
@@ -2184,7 +2184,7 @@ struct NetworkCompanyPasswordWindow : public Window {
NetworkChangeCompanyPassword(_local_company, this->password_editbox.text.buf);
}
- virtual void OnClick(Point pt, int widget, int click_count)
+ void OnClick(Point pt, int widget, int click_count) override
{
switch (widget) {
case WID_NCP_OK: