Mercurial > hg > openttd
changeset 18637:2c51accd82c3 draft
(svn r23484) -Fix [FS#4770]: in case you already have orders, ignore the vehicles when adding an extra order
author | rubidium <rubidium@openttd.org> |
---|---|
date | Sat, 10 Dec 2011 19:20:30 +0000 |
parents | 3a4c1613d80b |
children | ac23ced64c4b |
files | src/depot_gui.cpp src/order_gui.cpp src/vehicle_gui.cpp src/window_gui.h |
diffstat | 4 files changed, 9 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -838,12 +838,14 @@ /** * Clones a vehicle * @param v the original vehicle to clone + * @return Always true. */ - virtual void OnVehicleSelect(const Vehicle *v) + virtual bool OnVehicleSelect(const Vehicle *v) { if (DoCommandP(this->window_number, v->index, _ctrl_pressed ? 1 : 0, CMD_CLONE_VEHICLE | CMD_MSG(STR_ERROR_CAN_T_BUY_TRAIN + v->type), CcCloneVehicle)) { ResetObjectToPlace(); } + return true; } virtual void OnPlaceObjectAbort()
--- a/src/order_gui.cpp +++ b/src/order_gui.cpp @@ -1466,7 +1466,7 @@ } } - virtual void OnVehicleSelect(const Vehicle *v) + virtual bool OnVehicleSelect(const Vehicle *v) { /* v is vehicle getting orders. Only copy/clone orders if vehicle doesn't have any orders yet. * We disallow copying orders of other vehicles if we already have at least one order entry @@ -1474,13 +1474,14 @@ * Obviously if you press CTRL on a non-empty orders vehicle you know what you are doing * TODO: give a warning message */ bool share_order = _ctrl_pressed || this->goto_type == OPOS_SHARE; - if (this->vehicle->GetNumOrders() != 0 && !share_order) return; + if (this->vehicle->GetNumOrders() != 0 && !share_order) return false; if (DoCommandP(this->vehicle->tile, this->vehicle->index | (share_order ? CO_SHARE : CO_COPY) << 30, v->index, share_order ? CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_SHARE_ORDER_LIST) : CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_COPY_ORDER_LIST))) { this->selected_order = -1; ResetObjectToPlace(); } + return true; } virtual void OnPlaceObjectAbort()
--- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -2671,8 +2671,7 @@ v = v->First(); if (!v->IsPrimaryVehicle()) return false; - _thd.GetCallbackWnd()->OnVehicleSelect(v); - return true; + return _thd.GetCallbackWnd()->OnVehicleSelect(v); } void StopGlobalFollowVehicle(const Vehicle *v)
--- a/src/window_gui.h +++ b/src/window_gui.h @@ -667,8 +667,9 @@ /** * The user clicked on a vehicle while HT_VEHICLE has been set. * @param v clicked vehicle. It is guaranteed to be v->IsPrimaryVehicle() == true + * @return True if the click is handled, false if it is ignored. */ - virtual void OnVehicleSelect(const struct Vehicle *v) {} + virtual bool OnVehicleSelect(const struct Vehicle *v) { return false; } /** * The user cancelled a tile highlight mode that has been set.