summaryrefslogtreecommitdiff
path: root/order_cmd.c
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2006-08-22 17:13:49 +0000
committertruelight <truelight@openttd.org>2006-08-22 17:13:49 +0000
commitbdc1d681a77ab4ca3342023c5314b565c2e21b86 (patch)
tree6fd89f2a96b8f71b4b34dda81300e4dd18bd4e6e /order_cmd.c
parent8d436dee6975b5fccd26de5c3e2429414df63776 (diff)
downloadopenttd-bdc1d681a77ab4ca3342023c5314b565c2e21b86.tar.xz
(svn r6052) -Codechange: change OrderType (order->type) in a typedef
-Codechange: renamed DeleteDestinationFromVehicleOrder to RemoveOrderFromAllVehicles to reflect his function better -Codechange: changed the params of RemoveOrderFromAllVehicles, to avoid unneeded variable-creation
Diffstat (limited to 'order_cmd.c')
-rw-r--r--order_cmd.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/order_cmd.c b/order_cmd.c
index 53c96c769..0f84d40f6 100644
--- a/order_cmd.c
+++ b/order_cmd.c
@@ -953,13 +953,11 @@ void CheckOrders(const Vehicle* v)
}
/**
- *
- * Delete a destination (like station, waypoint, ..) from the orders of vehicles
- *
- * @param dest type and station has to be set. This order will be removed from all orders of vehicles
- *
+ * Removes an order from all vehicles. Triggers when, say, a station is removed.
+ * @param type The type of the order (OT_GOTO_[STATION|DEPOT|WAYPOINT]).
+ * @param destination The destination. Can be a StationID, DepotID or WaypointID.
*/
-void DeleteDestinationFromVehicleOrder(Order dest)
+void RemoveOrderFromAllVehicles(OrderType type, StationID destination)
{
Vehicle *v;
Order *order;
@@ -970,12 +968,11 @@ void DeleteDestinationFromVehicleOrder(Order dest)
if (v->orders == NULL) continue;
/* Forget about this station if this station is removed */
- if (v->last_station_visited == dest.station && dest.type == OT_GOTO_STATION)
+ if (v->last_station_visited == destination && type == OT_GOTO_STATION)
v->last_station_visited = INVALID_STATION;
/* Check the current order */
- if (v->current_order.type == dest.type &&
- v->current_order.station == dest.station) {
+ if (v->current_order.type == type && v->current_order.station == destination) {
/* Mark the order as DUMMY */
v->current_order.type = OT_DUMMY;
v->current_order.flags = 0;
@@ -985,7 +982,7 @@ void DeleteDestinationFromVehicleOrder(Order dest)
/* Clear the order from the order-list */
need_invalidate = false;
FOR_VEHICLE_ORDERS(v, order) {
- if (order->type == dest.type && order->station == dest.station) {
+ if (order->type == type && order->station == destination) {
/* Mark the order as DUMMY */
order->type = OT_DUMMY;
order->flags = 0;