summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/depot_gui.cpp4
-rw-r--r--src/order_gui.cpp5
-rw-r--r--src/vehicle_gui.cpp3
-rw-r--r--src/window_gui.h3
4 files changed, 9 insertions, 6 deletions
diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp
index cd0b4671d..05a07856d 100644
--- a/src/depot_gui.cpp
+++ b/src/depot_gui.cpp
@@ -838,12 +838,14 @@ struct DepotWindow : Window {
/**
* 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()
diff --git a/src/order_gui.cpp b/src/order_gui.cpp
index 90e4f8a6f..513e7b0e2 100644
--- a/src/order_gui.cpp
+++ b/src/order_gui.cpp
@@ -1466,7 +1466,7 @@ public:
}
}
- 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 @@ public:
* 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()
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 519f39c19..ecd47a722 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -2671,8 +2671,7 @@ bool VehicleClicked(const Vehicle *v)
v = v->First();
if (!v->IsPrimaryVehicle()) return false;
- _thd.GetCallbackWnd()->OnVehicleSelect(v);
- return true;
+ return _thd.GetCallbackWnd()->OnVehicleSelect(v);
}
void StopGlobalFollowVehicle(const Vehicle *v)
diff --git a/src/window_gui.h b/src/window_gui.h
index f3acb97fc..461d6652b 100644
--- a/src/window_gui.h
+++ b/src/window_gui.h
@@ -667,8 +667,9 @@ public:
/**
* 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.