Cleanup: widget pos_x/y are already int. (#10809)

Remove old casts left over from when pos_x/y were unsigned.
This commit is contained in:
PeterN 2023-05-12 18:02:51 +01:00 committed by GitHub
parent 7e3646cf46
commit da7f431812
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View File

@ -2314,7 +2314,7 @@ struct GameSettingsWindow : Window {
this->closing_dropdown = false;
const NWidgetBase *wid = this->GetWidget<NWidgetBase>(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);

View File

@ -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;

View File

@ -215,8 +215,8 @@ int Window::GetRowFromWidget(int clickpos, int widget, int padding, int line_hei
{
const NWidgetBase *wid = this->GetWidget<NWidgetBase>(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;