summaryrefslogtreecommitdiff
path: root/src/order_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-07-24 15:18:25 +0000
committerrubidium <rubidium@openttd.org>2009-07-24 15:18:25 +0000
commitc3d2c47faa6bb9c07c362127b4fb5de79130bfa0 (patch)
tree6478960a00fd8d58956b9fdb0981ad1bf995f373 /src/order_cmd.cpp
parentcf38a5bee6628f4be58a1bd7774658cf86807d5c (diff)
downloadopenttd-c3d2c47faa6bb9c07c362127b4fb5de79130bfa0.tar.xz
(svn r16940) -Codechange: make the pathfinders behave the same when finding waypoints or stations, i.e. don't force exactly one destination tile for a waypoint
Diffstat (limited to 'src/order_cmd.cpp')
-rw-r--r--src/order_cmd.cpp22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index 3b1a319ee..7e2b3757a 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -412,9 +412,9 @@ static TileIndex GetOrderLocation(const Order& o)
{
switch (o.GetType()) {
default: NOT_REACHED();
- case OT_GOTO_WAYPOINT: // This function is only called for ships, thus waypoints are buoys which are stations.
- case OT_GOTO_STATION: return Station::Get(o.GetDestination())->xy;
- case OT_GOTO_DEPOT: return Depot::Get(o.GetDestination())->xy;
+ case OT_GOTO_WAYPOINT: return Waypoint::Get(o.GetDestination())->xy;
+ case OT_GOTO_STATION: return Station::Get(o.GetDestination())->xy;
+ case OT_GOTO_DEPOT: return Depot::Get(o.GetDestination())->xy;
}
}
@@ -1688,11 +1688,7 @@ bool UpdateOrderDest(Vehicle *v, const Order *order, int conditional_depth)
break;
case OT_GOTO_WAYPOINT:
- if (v->type == VEH_TRAIN) {
- v->dest_tile = Waypoint::Get(order->GetDestination())->xy;
- } else {
- v->dest_tile = Station::Get(order->GetDestination())->xy;
- }
+ v->dest_tile = Waypoint::Get(order->GetDestination())->xy;
return true;
case OT_CONDITIONAL: {
@@ -1755,17 +1751,11 @@ bool ProcessOrders(Vehicle *v)
*/
bool may_reverse = v->current_order.IsType(OT_NOTHING);
- /* Check if we've reached the waypoint? */
- if (v->current_order.IsType(OT_GOTO_WAYPOINT) && v->tile == v->dest_tile) {
- UpdateVehicleTimetable(v, true);
- v->IncrementOrderIndex();
- }
-
/* Check if we've reached a non-stop station.. */
- if (v->current_order.IsType(OT_GOTO_STATION) && (v->current_order.GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) &&
+ if (((v->current_order.IsType(OT_GOTO_STATION) && (v->current_order.GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION)) || v->current_order.IsType(OT_GOTO_WAYPOINT)) &&
IsTileType(v->tile, MP_STATION) &&
v->current_order.GetDestination() == GetStationIndex(v->tile)) {
- v->last_station_visited = v->current_order.GetDestination();
+ if (v->current_order.IsType(OT_GOTO_STATION)) v->last_station_visited = v->current_order.GetDestination();
UpdateVehicleTimetable(v, true);
v->IncrementOrderIndex();
}