diff options
author | rubidium <rubidium@openttd.org> | 2007-08-31 17:13:39 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-08-31 17:13:39 +0000 |
commit | cadc470da5eeffc9d719dfb0dab6216ed372a3ea (patch) | |
tree | 9b85848c6535d62d87e3afbd781847214c62b4e2 /src/ship_cmd.cpp | |
parent | 313fc8930f827f0eeb130c985fe942f59f4fc72c (diff) | |
download | openttd-cadc470da5eeffc9d719dfb0dab6216ed372a3ea.tar.xz |
(svn r11017) -Codechange: unify determining whether a vehicle needs/can be service a little more.
Diffstat (limited to 'src/ship_cmd.cpp')
-rw-r--r-- | src/ship_cmd.cpp | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index 5b13a2580..67e358d41 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -140,24 +140,13 @@ static const Depot* FindClosestShipDepot(const Vehicle* v) static void CheckIfShipNeedsService(Vehicle *v) { - const Depot* depot; - - if (_patches.servint_ships == 0) return; - if (!VehicleNeedsService(v)) return; - if (v->vehstatus & VS_STOPPED) return; - - if (v->current_order.type == OT_GOTO_DEPOT && - v->current_order.flags & OF_HALT_IN_DEPOT) - return; - - if (_patches.gotodepot && VehicleHasDepotOrders(v)) return; - + if (_patches.servint_ships == 0 || !VehicleNeedsService(v)) return; if (v->IsInDepot()) { VehicleServiceInDepot(v); return; } - depot = FindClosestShipDepot(v); + const Depot *depot = FindClosestShipDepot(v); if (depot == NULL || DistanceManhattan(v->tile, depot->xy) > 12) { if (v->current_order.type == OT_GOTO_DEPOT) { @@ -168,7 +157,6 @@ static void CheckIfShipNeedsService(Vehicle *v) return; } - if (v->current_order.type == OT_LOADING) v->LeaveStation(); v->current_order.type = OT_GOTO_DEPOT; v->current_order.flags = OF_NON_STOP; v->current_order.dest = depot->index; |