Update to 12.0-beta1
This commit is contained in:
@@ -211,13 +211,13 @@ struct TimetableWindow : Window {
|
||||
|
||||
int GetOrderFromTimetableWndPt(int y, const Vehicle *v)
|
||||
{
|
||||
int sel = (y - this->GetWidget<NWidgetBase>(WID_VT_TIMETABLE_PANEL)->pos_y - WD_FRAMERECT_TOP) / FONT_HEIGHT_NORMAL;
|
||||
uint sel = (y - this->GetWidget<NWidgetBase>(WID_VT_TIMETABLE_PANEL)->pos_y - WD_FRAMERECT_TOP) / FONT_HEIGHT_NORMAL;
|
||||
|
||||
if ((uint)sel >= this->vscroll->GetCapacity()) return INVALID_ORDER;
|
||||
if (sel >= this->vscroll->GetCapacity()) return INVALID_ORDER;
|
||||
|
||||
sel += this->vscroll->GetPosition();
|
||||
|
||||
return (sel < v->GetNumOrders() * 2 && sel >= 0) ? sel : INVALID_ORDER;
|
||||
return (sel < v->GetNumOrders() * 2u) ? sel : INVALID_ORDER;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -237,7 +237,7 @@ struct TimetableWindow : Window {
|
||||
/* Removed / replaced all orders (after deleting / sharing) */
|
||||
if (this->sel_index == -1) break;
|
||||
|
||||
this->DeleteChildWindows();
|
||||
this->CloseChildWindows();
|
||||
this->sel_index = -1;
|
||||
break;
|
||||
|
||||
@@ -276,7 +276,7 @@ struct TimetableWindow : Window {
|
||||
/* Now we are modifying the selected order */
|
||||
if (to == INVALID_VEH_ORDER_ID) {
|
||||
/* Deleting selected order */
|
||||
this->DeleteChildWindows();
|
||||
this->CloseChildWindows();
|
||||
this->sel_index = -1;
|
||||
break;
|
||||
} else {
|
||||
@@ -523,7 +523,7 @@ struct TimetableWindow : Window {
|
||||
case WID_VT_TIMETABLE_PANEL: { // Main panel.
|
||||
int selected = GetOrderFromTimetableWndPt(pt.y, v);
|
||||
|
||||
this->DeleteChildWindows();
|
||||
this->CloseChildWindows();
|
||||
this->sel_index = (selected == INVALID_ORDER || selected == this->sel_index) ? -1 : selected;
|
||||
break;
|
||||
}
|
||||
@@ -707,7 +707,7 @@ static WindowDesc _timetable_desc(
|
||||
*/
|
||||
void ShowTimetableWindow(const Vehicle *v)
|
||||
{
|
||||
DeleteWindowById(WC_VEHICLE_DETAILS, v->index, false);
|
||||
DeleteWindowById(WC_VEHICLE_ORDERS, v->index, false);
|
||||
CloseWindowById(WC_VEHICLE_DETAILS, v->index, false);
|
||||
CloseWindowById(WC_VEHICLE_ORDERS, v->index, false);
|
||||
AllocateWindowDescFront<TimetableWindow>(&_timetable_desc, v->index);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user