summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-11-22 13:22:53 +0000
committeralberth <alberth@openttd.org>2009-11-22 13:22:53 +0000
commitbf93372ca26375e392ff62a91db4de4c126dff38 (patch)
treeb09443cc8800ee93a79bb1df23f79283e8ddebbf
parent2332034822a9e2c9b1ed58e7f243a48cb8d630a6 (diff)
downloadopenttd-bf93372ca26375e392ff62a91db4de4c126dff38.tar.xz
(svn r18220) -Codechange: Reduce number of nested widget dynamic casts.
-rw-r--r--src/ai/ai_gui.cpp15
-rw-r--r--src/autoreplace_gui.cpp2
-rw-r--r--src/build_vehicle_gui.cpp9
-rw-r--r--src/cheat_gui.cpp2
-rw-r--r--src/company_gui.cpp2
-rw-r--r--src/depot_gui.cpp11
-rw-r--r--src/genworld_gui.cpp2
-rw-r--r--src/graph_gui.cpp2
-rw-r--r--src/industry_gui.cpp4
-rw-r--r--src/network/network_content_gui.cpp8
-rw-r--r--src/network/network_gui.cpp18
-rw-r--r--src/newgrf_gui.cpp5
-rw-r--r--src/settings_gui.cpp4
-rw-r--r--src/smallmap_gui.cpp6
14 files changed, 48 insertions, 42 deletions
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index 18de747df..4f43e58fc 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -203,8 +203,9 @@ struct AIListWindow : public Window {
virtual void OnResize()
{
- this->vscroll.SetCapacity(this->GetWidget<NWidgetCore>(AIL_WIDGET_LIST)->current_y / this->line_height);
- this->GetWidget<NWidgetCore>(AIL_WIDGET_LIST)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
+ NWidgetCore *nwi = this->GetWidget<NWidgetCore>(AIL_WIDGET_LIST);
+ this->vscroll.SetCapacity(nwi->current_y / this->line_height);
+ nwi->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
}
};
@@ -408,8 +409,9 @@ struct AISettingsWindow : public Window {
virtual void OnResize()
{
- this->vscroll.SetCapacity(this->GetWidget<NWidgetCore>(AIS_WIDGET_BACKGROUND)->current_y / this->line_height);
- this->GetWidget<NWidgetCore>(AIS_WIDGET_BACKGROUND)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
+ NWidgetCore *nwi = this->GetWidget<NWidgetCore>(AIS_WIDGET_BACKGROUND);
+ this->vscroll.SetCapacity(nwi->current_y / this->line_height);
+ nwi->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
}
virtual void OnTick()
@@ -520,9 +522,10 @@ struct AIConfigWindow : public Window {
{
this->InitNested(&_ai_config_desc); // Initializes 'this->line_height' as a side effect.
this->selected_slot = INVALID_COMPANY;
- this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(AIC_WIDGET_LIST)->current_y / this->line_height);
+ NWidgetCore *nwi = this->GetWidget<NWidgetCore>(AIC_WIDGET_LIST);
+ this->vscroll.SetCapacity(nwi->current_y / this->line_height);
this->vscroll.SetCount(MAX_COMPANIES);
- this->GetWidget<NWidgetCore>(AIC_WIDGET_LIST)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
+ nwi->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
this->OnInvalidateData(0);
}
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index 1b5dacadb..2c48feade 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -376,7 +376,7 @@ public:
/* Draw details panels. */
for (int side = 0; side < 2; side++) {
if (this->sel_engine[side] != INVALID_ENGINE) {
- NWidgetCore *nwi = this->GetWidget<NWidgetCore>(side == 0 ? RVW_WIDGET_LEFT_DETAILS : RVW_WIDGET_RIGHT_DETAILS);
+ NWidgetBase *nwi = this->GetWidget<NWidgetBase>(side == 0 ? RVW_WIDGET_LEFT_DETAILS : RVW_WIDGET_RIGHT_DETAILS);
int text_end = DrawVehiclePurchaseInfo(nwi->pos_x + WD_FRAMETEXT_LEFT, nwi->pos_x + nwi->current_x - WD_FRAMETEXT_RIGHT,
nwi->pos_y + WD_FRAMERECT_TOP, this->sel_engine[side]);
needed_height = max(needed_height, text_end - (int)nwi->pos_y + WD_FRAMERECT_BOTTOM);
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index 53b4d638a..52861c6dd 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -1017,7 +1017,7 @@ struct BuildVehicleWindow : Window {
break;
case BUILD_VEHICLE_WIDGET_LIST: {
- uint i = (pt.y - this->GetWidget<NWidgetCore>(BUILD_VEHICLE_WIDGET_LIST)->pos_y) / this->resize.step_height + this->vscroll.GetPosition();
+ uint i = (pt.y - this->GetWidget<NWidgetBase>(BUILD_VEHICLE_WIDGET_LIST)->pos_y) / this->resize.step_height + this->vscroll.GetPosition();
size_t num_items = this->eng_list.Length();
this->sel_engine = (i < num_items) ? this->eng_list[i] : INVALID_ENGINE;
this->SetDirty();
@@ -1124,7 +1124,7 @@ struct BuildVehicleWindow : Window {
/* Draw details panels. */
for (int side = 0; side < 2; side++) {
if (this->sel_engine != INVALID_ENGINE) {
- NWidgetCore *nwi = this->GetWidget<NWidgetCore>(BUILD_VEHICLE_WIDGET_PANEL);
+ NWidgetBase *nwi = this->GetWidget<NWidgetBase>(BUILD_VEHICLE_WIDGET_PANEL);
int text_end = DrawVehiclePurchaseInfo(nwi->pos_x + WD_FRAMETEXT_LEFT, nwi->pos_x + nwi->current_x - WD_FRAMETEXT_RIGHT,
nwi->pos_y + WD_FRAMERECT_TOP, this->sel_engine);
needed_height = max(needed_height, text_end - (int)nwi->pos_y + WD_FRAMERECT_BOTTOM);
@@ -1178,8 +1178,9 @@ struct BuildVehicleWindow : Window {
virtual void OnResize()
{
- this->vscroll.SetCapacity((this->GetWidget<NWidgetCore>(BUILD_VEHICLE_WIDGET_LIST)->current_y) / this->resize.step_height);
- this->GetWidget<NWidgetCore>(BUILD_VEHICLE_WIDGET_LIST)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
+ NWidgetCore *nwi = this->GetWidget<NWidgetCore>(BUILD_VEHICLE_WIDGET_LIST);
+ this->vscroll.SetCapacity(nwi->current_y / this->resize.step_height);
+ nwi->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
}
};
diff --git a/src/cheat_gui.cpp b/src/cheat_gui.cpp
index 6184aa3de..74bd21faf 100644
--- a/src/cheat_gui.cpp
+++ b/src/cheat_gui.cpp
@@ -273,7 +273,7 @@ struct CheatWindow : Window {
virtual void OnClick(Point pt, int widget)
{
- const NWidgetCore *wid = this->GetWidget<NWidgetCore>(CW_PANEL);
+ const NWidgetBase *wid = this->GetWidget<NWidgetBase>(CW_PANEL);
uint btn = (pt.y - wid->pos_y - WD_FRAMERECT_TOP - this->header_height) / (FONT_HEIGHT_NORMAL + WD_PAR_VSEP_NORMAL);
uint x = pt.x - wid->pos_x;
bool rtl = _dynlang.text_dir == TD_RTL;
diff --git a/src/company_gui.cpp b/src/company_gui.cpp
index 0100e2ec1..7e5b5f57c 100644
--- a/src/company_gui.cpp
+++ b/src/company_gui.cpp
@@ -413,7 +413,7 @@ struct CompanyFinancesWindow : Window {
if (!small) {
/* Check that the expenses panel height matches the height needed for the layout. */
int type = _settings_client.gui.expenses_layout;
- if (_expenses_list_types[type].GetHeight() != this->GetWidget<NWidgetCore>(CFW_EXPS_CATEGORY)->current_y) {
+ if (_expenses_list_types[type].GetHeight() != this->GetWidget<NWidgetBase>(CFW_EXPS_CATEGORY)->current_y) {
this->SetupWidgets();
this->ReInit();
return;
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index 41d0e2de2..434e69272 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -942,13 +942,14 @@ struct DepotWindow : Window {
virtual void OnResize()
{
- this->vscroll.SetCapacity(this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX)->current_y / (int)this->resize.step_height);
+ NWidgetCore *nwi = this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX);
+ this->vscroll.SetCapacity(nwi->current_y / (int)this->resize.step_height);
if (this->type == VEH_TRAIN) {
- this->hscroll.SetCapacity(this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX)->current_x - this->header_width - this->count_width);
- this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
+ this->hscroll.SetCapacity(nwi->current_x - this->header_width - this->count_width);
+ nwi->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
} else {
- this->hscroll.SetCapacity(this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX)->current_x / (int)this->resize.step_width);
- this->GetWidget<NWidgetCore>(DEPOT_WIDGET_MATRIX)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (this->hscroll.GetCapacity() << MAT_COL_START);
+ this->hscroll.SetCapacity(nwi->current_x / (int)this->resize.step_width);
+ nwi->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (this->hscroll.GetCapacity() << MAT_COL_START);
}
}
diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp
index 4239283f7..5728c9ff2 100644
--- a/src/genworld_gui.cpp
+++ b/src/genworld_gui.cpp
@@ -481,7 +481,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
* spaced without doing much magic. The space we can draw on is
* covered by both the spacer and text widgets, so take their
* outer most boundaries (left and right) as draw locations. */
- const NWidgetCore *nwi_spacer = this->GetWidget<NWidgetCore>(GLAND_HEIGHTMAP_NAME_SPACER);
+ const NWidgetBase *nwi_spacer = this->GetWidget<NWidgetBase>(GLAND_HEIGHTMAP_NAME_SPACER);
DrawString(min(r.left, nwi_spacer->pos_x), max<int>(r.right, nwi_spacer->pos_x + nwi_spacer->current_x), r.top, this->name, TC_ORANGE);
} break;
}
diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp
index 08b1290cb..21093803e 100644
--- a/src/graph_gui.cpp
+++ b/src/graph_gui.cpp
@@ -465,7 +465,7 @@ public:
{
this->DrawWidgets();
- NWidgetCore *nwid = this->GetWidget<NWidgetCore>(this->graph_widget);
+ NWidgetBase *nwid = this->GetWidget<NWidgetBase>(this->graph_widget);
Rect r;
r.left = nwid->pos_x;
r.right = nwid->pos_x + nwid->current_x - 1;
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 107b209bc..b42f17dfa 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -594,7 +594,7 @@ public:
{
this->DrawWidgets();
- NWidgetCore *nwi = this->GetWidget<NWidgetCore>(IVW_INFO);
+ NWidgetBase *nwi = this->GetWidget<NWidgetBase>(IVW_INFO);
uint expected = this->DrawInfo(nwi->pos_x, nwi->pos_x + nwi->current_x - 1, nwi->pos_y) - nwi->pos_y;
if (expected > nwi->current_y - 1) {
this->info_height = expected + 1;
@@ -720,7 +720,7 @@ public:
uint x = pt.x;
int line = (pt.y - this->production_offset_y) / FONT_HEIGHT_NORMAL;
if (pt.y >= this->production_offset_y && IsInsideMM(line, 0, 2) && i->produced_cargo[line] != CT_INVALID) {
- NWidgetCore *nwi = this->GetWidget<NWidgetCore>(widget);
+ NWidgetBase *nwi = this->GetWidget<NWidgetBase>(widget);
uint left = nwi->pos_x + WD_FRAMETEXT_LEFT;
uint right = nwi->pos_x + nwi->current_x - 1 - WD_FRAMERECT_RIGHT;
if (IsInsideMM(x, left, left + 20) ) {
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<NWidgetCore>(NCLWW_CHECKBOX);
- const NWidgetCore *nwi_name = this->GetWidget<NWidgetCore>(NCLWW_NAME);
- const NWidgetCore *nwi_type = this->GetWidget<NWidgetCore>(NCLWW_TYPE);
+ const NWidgetBase *nwi_checkbox = this->GetWidget<NWidgetBase>(NCLWW_CHECKBOX);
+ const NWidgetBase *nwi_name = this->GetWidget<NWidgetBase>(NCLWW_NAME);
+ const NWidgetBase *nwi_type = this->GetWidget<NWidgetBase>(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<NWidgetCore>(NCLWW_CHECKBOX)->pos_y + this->GetWidget<NWidgetCore>(NCLWW_CHECKBOX)->current_y)) {
+ if (pt.x <= (int)(this->GetWidget<NWidgetBase>(NCLWW_CHECKBOX)->pos_y + this->GetWidget<NWidgetBase>(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<NWidgetCore>(NGWW_NAME);
- const NWidgetCore *nwi_info = this->GetWidget<NWidgetCore>(NGWW_INFO);
+ const NWidgetBase *nwi_name = this->GetWidget<NWidgetBase>(NGWW_NAME);
+ const NWidgetBase *nwi_info = this->GetWidget<NWidgetBase>(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<NWidgetServerListHeader>(NGWW_HEADER);
if (nwi_header->IsWidgetVisible(NGWW_CLIENTS)) {
- const NWidgetCore *nwi_clients = this->GetWidget<NWidgetCore>(NGWW_CLIENTS);
+ const NWidgetBase *nwi_clients = this->GetWidget<NWidgetBase>(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<NWidgetCore>(NGWW_MAPSIZE);
+ const NWidgetBase *nwi_mapsize = this->GetWidget<NWidgetBase>(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<NWidgetCore>(NGWW_DATE);
+ const NWidgetBase *nwi_date = this->GetWidget<NWidgetBase>(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<NWidgetCore>(NGWW_YEARS);
+ const NWidgetBase *nwi_years = this->GetWidget<NWidgetBase>(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<NWidgetCore>(NGWW_MATRIX)->pos_y) / this->resize.step_height;
+ uint32 id_v = (pt.y - this->GetWidget<NWidgetBase>(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<NWidgetCore>(NSSW_SELMAP)->pos_y - WD_FRAMERECT_TOP) / FONT_HEIGHT_NORMAL;
+ int y = (pt.y - this->GetWidget<NWidgetBase>(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<NWidgetCore>(NLWW_MATRIX)->pos_y) / this->resize.step_height;
+ uint32 id_v = (pt.y - this->GetWidget<NWidgetBase>(NLWW_MATRIX)->pos_y) / this->resize.step_height;
if (id_v >= this->vscroll.GetCapacity()) break;
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index 52e83463c..779f78621 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -609,8 +609,9 @@ struct NewGRFWindow : public Window {
virtual void OnResize()
{
- this->vscroll.SetCapacity(this->GetWidget<NWidgetCore>(SNGRFS_FILE_LIST)->current_y / this->resize.step_height);
- this->GetWidget<NWidgetCore>(SNGRFS_FILE_LIST)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
+ NWidgetCore *nwi = this->GetWidget<NWidgetCore>(SNGRFS_FILE_LIST);
+ this->vscroll.SetCapacity(nwi->current_y / this->resize.step_height);
+ nwi->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
}
virtual void SetStringParameters(int widget) const
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 2669addf2..bcd73cd13 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -1504,7 +1504,7 @@ struct GameSettingsWindow : Window {
{
if (widget != SETTINGSEL_OPTIONSPANEL) return;
- int y = pt.y - this->GetWidget<NWidgetCore>(widget)->pos_y - SETTINGTREE_TOP_OFFSET; // Shift y coordinate
+ int y = pt.y - this->GetWidget<NWidgetBase>(widget)->pos_y - SETTINGTREE_TOP_OFFSET; // Shift y coordinate
if (y < 0) return; // Clicked above first entry
byte btn = this->vscroll.GetPosition() + y / this->resize.step_height; // Compute which setting is selected
@@ -1767,7 +1767,7 @@ struct CustomCurrencyWindow : Window {
case CUSTCURR_SEPARATOR_EDIT:
case CUSTCURR_PREFIX_EDIT:
case CUSTCURR_SUFFIX_EDIT:
- size->width = this->GetWidget<NWidgetCore>(CUSTCURR_RATE_DOWN)->smallest_x + this->GetWidget<NWidgetCore>(CUSTCURR_RATE_UP)->smallest_x;
+ size->width = this->GetWidget<NWidgetBase>(CUSTCURR_RATE_DOWN)->smallest_x + this->GetWidget<NWidgetBase>(CUSTCURR_RATE_UP)->smallest_x;
break;
/* Make sure the window is wide enough for the widest exchange rate */
diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp
index ca6949285..7b76d056e 100644
--- a/src/smallmap_gui.cpp
+++ b/src/smallmap_gui.cpp
@@ -1016,7 +1016,7 @@ public:
/* If industry type small map*/
if (this->map_type == SMT_INDUSTRY) {
/* If click on industries label, find right industry type and enable/disable it */
- const NWidgetCore *wi = this->GetWidget<NWidgetCore>(SM_WIDGET_LEGEND); // Label panel
+ const NWidgetBase *wi = this->GetWidget<NWidgetBase>(SM_WIDGET_LEGEND); // Label panel
uint line = (pt.y - wi->pos_y - WD_FRAMERECT_TOP) / FONT_HEIGHT_SMALL;
if (line >= this->number_of_rows) break;
@@ -1103,7 +1103,7 @@ public:
}
}
- const NWidgetCore *wi = this->GetWidget<NWidgetCore>(SM_WIDGET_MAP);
+ const NWidgetBase *wi = this->GetWidget<NWidgetBase>(SM_WIDGET_MAP);
int hx = wi->current_x / 2;
int hy = wi->current_y / 2;
int hvx = hx * -4 + hy * 8;
@@ -1135,7 +1135,7 @@ public:
void SmallMapCenterOnCurrentPos()
{
const ViewPort *vp = FindWindowById(WC_MAIN_WINDOW, 0)->viewport;
- const NWidgetCore *wi = this->GetWidget<NWidgetCore>(SM_WIDGET_MAP);
+ const NWidgetBase *wi = this->GetWidget<NWidgetBase>(SM_WIDGET_MAP);
int x = ((vp->virtual_width - (int)wi->current_x * TILE_SIZE) / 2 + vp->virtual_left) / 4;
int y = ((vp->virtual_height - (int)wi->current_y * TILE_SIZE) / 2 + vp->virtual_top ) / 2 - TILE_SIZE * 2;