mirror of https://github.com/OpenTTD/OpenTTD
(svn r21457) -Feature(tte) [FS#4215]: scroll to the inserted order (thror)
parent
fff4bdecd8
commit
8faa97c060
|
@ -751,6 +751,9 @@ public:
|
||||||
|
|
||||||
virtual void OnInvalidateData(int data)
|
virtual void OnInvalidateData(int data)
|
||||||
{
|
{
|
||||||
|
VehicleOrderID from = GB(data, 0, 8);
|
||||||
|
VehicleOrderID to = GB(data, 8, 8);
|
||||||
|
|
||||||
switch (data) {
|
switch (data) {
|
||||||
case 0:
|
case 0:
|
||||||
/* Autoreplace replaced the vehicle */
|
/* Autoreplace replaced the vehicle */
|
||||||
|
@ -770,14 +773,11 @@ public:
|
||||||
/* Some other order changes */
|
/* Some other order changes */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: {
|
default:
|
||||||
/* Moving an order. If one of these is INVALID_VEH_ORDER_ID, then
|
/* Moving an order. If one of these is INVALID_VEH_ORDER_ID, then
|
||||||
* the order is being created / removed */
|
* the order is being created / removed */
|
||||||
if (this->selected_order == -1) break;
|
if (this->selected_order == -1) break;
|
||||||
|
|
||||||
VehicleOrderID from = GB(data, 0, 8);
|
|
||||||
VehicleOrderID to = GB(data, 8, 8);
|
|
||||||
|
|
||||||
if (from == to) break; // no need to change anything
|
if (from == to) break; // no need to change anything
|
||||||
|
|
||||||
if (from != this->selected_order) {
|
if (from != this->selected_order) {
|
||||||
|
@ -800,11 +800,15 @@ public:
|
||||||
/* Moving selected order */
|
/* Moving selected order */
|
||||||
this->selected_order = to;
|
this->selected_order = to;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->vscroll->SetCount(this->vehicle->GetNumOrders() + 1);
|
this->vscroll->SetCount(this->vehicle->GetNumOrders() + 1);
|
||||||
this->UpdateButtonState();
|
this->UpdateButtonState();
|
||||||
|
|
||||||
|
/* Scroll to the new order. */
|
||||||
|
if (from == INVALID_VEH_ORDER_ID && to != INVALID_VEH_ORDER_ID && !this->vscroll->IsVisible(to)) {
|
||||||
|
this->vscroll->ScrollTowards(to);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateButtonState()
|
void UpdateButtonState()
|
||||||
|
|
Loading…
Reference in New Issue