From bf93372ca26375e392ff62a91db4de4c126dff38 Mon Sep 17 00:00:00 2001 From: alberth Date: Sun, 22 Nov 2009 13:22:53 +0000 Subject: (svn r18220) -Codechange: Reduce number of nested widget dynamic casts. --- src/network/network_content_gui.cpp | 8 ++++---- src/network/network_gui.cpp | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src/network') diff --git a/src/network/network_content_gui.cpp b/src/network/network_content_gui.cpp index dc24eaee3..2953ba468 100644 --- a/src/network/network_content_gui.cpp +++ b/src/network/network_content_gui.cpp @@ -439,9 +439,9 @@ public: void DrawMatrix(const Rect &r) const { - const NWidgetCore *nwi_checkbox = this->GetWidget(NCLWW_CHECKBOX); - const NWidgetCore *nwi_name = this->GetWidget(NCLWW_NAME); - const NWidgetCore *nwi_type = this->GetWidget(NCLWW_TYPE); + const NWidgetBase *nwi_checkbox = this->GetWidget(NCLWW_CHECKBOX); + const NWidgetBase *nwi_name = this->GetWidget(NCLWW_NAME); + const NWidgetBase *nwi_type = this->GetWidget(NCLWW_TYPE); /* Fill the matrix with the information */ @@ -608,7 +608,7 @@ public: this->selected = *this->content.Get(id_v); this->list_pos = id_v; - if (pt.x <= (int)(this->GetWidget(NCLWW_CHECKBOX)->pos_y + this->GetWidget(NCLWW_CHECKBOX)->current_y)) { + if (pt.x <= (int)(this->GetWidget(NCLWW_CHECKBOX)->pos_y + this->GetWidget(NCLWW_CHECKBOX)->current_y)) { _network_content_client.ToggleSelectedState(this->selected); this->content.ForceResort(); } diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index d494921b9..908615850 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -368,8 +368,8 @@ protected: */ void DrawServerLine(const NetworkGameList *cur_item, uint y, bool highlight) const { - const NWidgetCore *nwi_name = this->GetWidget(NGWW_NAME); - const NWidgetCore *nwi_info = this->GetWidget(NGWW_INFO); + const NWidgetBase *nwi_name = this->GetWidget(NGWW_NAME); + const NWidgetBase *nwi_info = this->GetWidget(NGWW_INFO); /* show highlighted item with a different colour */ if (highlight) GfxFillRect(nwi_name->pos_x + 1, y - 2, nwi_info->pos_x + nwi_info->current_x - 2, y + FONT_HEIGHT_NORMAL - 1, 10); @@ -381,7 +381,7 @@ protected: const NWidgetServerListHeader *nwi_header = this->GetWidget(NGWW_HEADER); if (nwi_header->IsWidgetVisible(NGWW_CLIENTS)) { - const NWidgetCore *nwi_clients = this->GetWidget(NGWW_CLIENTS); + const NWidgetBase *nwi_clients = this->GetWidget(NGWW_CLIENTS); SetDParam(0, cur_item->info.clients_on); SetDParam(1, cur_item->info.clients_max); SetDParam(2, cur_item->info.companies_on); @@ -391,7 +391,7 @@ protected: if (nwi_header->IsWidgetVisible(NGWW_MAPSIZE)) { /* map size */ - const NWidgetCore *nwi_mapsize = this->GetWidget(NGWW_MAPSIZE); + const NWidgetBase *nwi_mapsize = this->GetWidget(NGWW_MAPSIZE); SetDParam(0, cur_item->info.map_width); SetDParam(1, cur_item->info.map_height); DrawString(nwi_mapsize->pos_x, nwi_mapsize->pos_x + nwi_mapsize->current_x - 1, y, STR_NETWORK_SERVER_LIST_MAP_SIZE_SHORT, TC_FROMSTRING, SA_CENTER); @@ -399,7 +399,7 @@ protected: if (nwi_header->IsWidgetVisible(NGWW_DATE)) { /* current date */ - const NWidgetCore *nwi_date = this->GetWidget(NGWW_DATE); + const NWidgetBase *nwi_date = this->GetWidget(NGWW_DATE); YearMonthDay ymd; ConvertDateToYMD(cur_item->info.game_date, &ymd); SetDParam(0, ymd.year); @@ -408,7 +408,7 @@ protected: if (nwi_header->IsWidgetVisible(NGWW_YEARS)) { /* number of years the game is running */ - const NWidgetCore *nwi_years = this->GetWidget(NGWW_YEARS); + const NWidgetBase *nwi_years = this->GetWidget(NGWW_YEARS); YearMonthDay ymd_cur, ymd_start; ConvertDateToYMD(cur_item->info.game_date, &ymd_cur); ConvertDateToYMD(cur_item->info.start_date, &ymd_start); @@ -694,7 +694,7 @@ public: break; case NGWW_MATRIX: { // Matrix to show networkgames - uint32 id_v = (pt.y - this->GetWidget(NGWW_MATRIX)->pos_y) / this->resize.step_height; + uint32 id_v = (pt.y - this->GetWidget(NGWW_MATRIX)->pos_y) / this->resize.step_height; if (id_v >= this->vscroll.GetCapacity()) return; // click out of bounds id_v += this->vscroll.GetPosition(); @@ -1185,7 +1185,7 @@ struct NetworkStartServerWindow : public QueryStringBaseWindow { break; case NSSW_SELMAP: { // Select map - int y = (pt.y - this->GetWidget(NSSW_SELMAP)->pos_y - WD_FRAMERECT_TOP) / FONT_HEIGHT_NORMAL; + int y = (pt.y - this->GetWidget(NSSW_SELMAP)->pos_y - WD_FRAMERECT_TOP) / FONT_HEIGHT_NORMAL; y += this->vscroll.GetPosition(); if (y >= this->vscroll.GetCount()) return; @@ -1645,7 +1645,7 @@ struct NetworkLobbyWindow : public Window { break; case NLWW_MATRIX: { // Company list - uint32 id_v = (pt.y - this->GetWidget(NLWW_MATRIX)->pos_y) / this->resize.step_height; + uint32 id_v = (pt.y - this->GetWidget(NLWW_MATRIX)->pos_y) / this->resize.step_height; if (id_v >= this->vscroll.GetCapacity()) break; -- cgit v1.2.3-70-g09d2