diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 8b14e89229..ac7cfe09e1 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -2314,7 +2314,7 @@ struct GameSettingsWindow : Window { this->closing_dropdown = false; const NWidgetBase *wid = this->GetWidget(WID_GS_OPTIONSPANEL); - int rel_y = (pt.y - (int)wid->pos_y - WidgetDimensions::scaled.framerect.top) % wid->resize_y; + int rel_y = (pt.y - wid->pos_y - WidgetDimensions::scaled.framerect.top) % wid->resize_y; Rect wi_rect; wi_rect.left = pt.x - (_current_text_dir == TD_RTL ? SETTING_BUTTON_WIDTH - 1 - x : x); diff --git a/src/widget.cpp b/src/widget.cpp index debfd79e88..23924c2895 100644 --- a/src/widget.cpp +++ b/src/widget.cpp @@ -2000,11 +2000,11 @@ NWidgetCore *NWidgetMatrix::GetWidgetFromPos(int x, int y) bool rtl = _current_text_dir == TD_RTL; int widget_col = (rtl ? - -x + (int)this->pip_post + (int)this->pos_x + base_offs_x + (int)this->widget_w - 1 - (int)this->pip_inter : - x - (int)this->pip_pre - (int)this->pos_x - base_offs_x + -x + (int)this->pip_post + this->pos_x + base_offs_x + this->widget_w - 1 - (int)this->pip_inter : + x - (int)this->pip_pre - this->pos_x - base_offs_x ) / this->widget_w; - int widget_row = (y - base_offs_y - (int)this->pip_pre - (int)this->pos_y) / this->widget_h; + int widget_row = (y - base_offs_y - (int)this->pip_pre - this->pos_y) / this->widget_h; int sub_wid = (widget_row + start_y) * this->widgets_x + start_x + widget_col; if (sub_wid >= this->count) return nullptr; diff --git a/src/window.cpp b/src/window.cpp index ae4d35ef4f..d399318824 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -215,8 +215,8 @@ int Window::GetRowFromWidget(int clickpos, int widget, int padding, int line_hei { const NWidgetBase *wid = this->GetWidget(widget); if (line_height < 0) line_height = wid->resize_y; - if (clickpos < (int)wid->pos_y + padding) return INT_MAX; - return (clickpos - (int)wid->pos_y - padding) / line_height; + if (clickpos < wid->pos_y + padding) return INT_MAX; + return (clickpos - wid->pos_y - padding) / line_height; } /** @@ -741,7 +741,7 @@ static void DispatchLeftClickEvent(Window *w, int x, int y, int click_count) case WWT_RESIZEBOX: /* When the resize widget is on the left size of the window * we assume that that button is used to resize to the left. */ - StartWindowSizing(w, (int)nw->pos_x < (w->width / 2)); + StartWindowSizing(w, nw->pos_x < (w->width / 2)); nw->SetDirty(w); return;