Mercurial > hg > openttd
changeset 17829:3c9a83a23782 draft
(svn r22620) -Change [FS#4651]: Enforce refit orders to be 'always go to depot' orders; service-only and stop-in-depot orders make no sense with refitting.
author | frosch <frosch@openttd.org> |
---|---|
date | Sat, 02 Jul 2011 16:45:54 +0000 |
parents | 111bcb2076f3 |
children | 45d44aa92d1c |
files | src/order_cmd.cpp src/order_gui.cpp |
diffstat | 2 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/order_cmd.cpp +++ b/src/order_cmd.cpp @@ -1280,11 +1280,13 @@ case DA_SERVICE: order->SetDepotOrderType((OrderDepotTypeFlags)(order->GetDepotOrderType() | ODTFB_SERVICE)); order->SetDepotActionType((OrderDepotActionFlags)(order->GetDepotActionType() & ~ODATFB_HALT)); + order->SetRefit(CT_NO_REFIT); break; case DA_STOP: order->SetDepotOrderType((OrderDepotTypeFlags)(order->GetDepotOrderType() & ~ODTFB_SERVICE)); order->SetDepotActionType((OrderDepotActionFlags)(order->GetDepotActionType() | ODATFB_HALT)); + order->SetRefit(CT_NO_REFIT); break; default: @@ -1529,6 +1531,12 @@ if (flags & DC_EXEC) { order->SetRefit(cargo, subtype); + /* Make the depot order an 'always go' order. */ + if (cargo != CT_NO_REFIT) { + order->SetDepotOrderType((OrderDepotTypeFlags)(order->GetDepotOrderType() & ~ODTFB_SERVICE)); + order->SetDepotActionType((OrderDepotActionFlags)(order->GetDepotActionType() & ~ODATFB_HALT)); + } + for (Vehicle *u = v->FirstShared(); u != NULL; u = u->NextShared()) { /* Update any possible open window of the vehicle */ InvalidateVehicleOrder(u, -2);
--- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -980,6 +980,9 @@ this->EnableWidget(ORDER_WIDGET_NON_STOP); this->SetWidgetLoweredState(ORDER_WIDGET_NON_STOP, order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS); } + /* Disable refit button if the order is no 'always go' order. + * However, keep the service button enabled for refit-orders to allow clearing refits (without knowing about ctrl). */ + this->SetWidgetDisabledState(ORDER_WIDGET_REFIT, (order->GetDepotOrderType() & ODTFB_SERVICE) || (order->GetDepotActionType() & ODATFB_HALT)); this->SetWidgetLoweredState(ORDER_WIDGET_SERVICE, order->GetDepotOrderType() & ODTFB_SERVICE); break;