summaryrefslogtreecommitdiff
path: root/aircraft_cmd.c
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2005-01-24 18:21:23 +0000
committerbjarni <bjarni@openttd.org>2005-01-24 18:21:23 +0000
commit6e2abeba5e63496a138f04df72454f2e0dbb8852 (patch)
treeffbebf8eb6c1381bace6bf694fd4523cfc90ce6e /aircraft_cmd.c
parenteae329f332d44eba4dc91ca1edd40daa24047200 (diff)
downloadopenttd-6e2abeba5e63496a138f04df72454f2e0dbb8852.tar.xz
(svn r1640) fix: now helicopters will use a hangar in schedule to be replaced in, even if they are only set to service there. Since helicopters are serviced at helipads, they will only go there if they needs to be replaced or renewed.
Diffstat (limited to 'aircraft_cmd.c')
-rw-r--r--aircraft_cmd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/aircraft_cmd.c b/aircraft_cmd.c
index 713475de8..8f834ea38 100644
--- a/aircraft_cmd.c
+++ b/aircraft_cmd.c
@@ -363,6 +363,8 @@ int32 CmdSendAircraftToHangar(int x, int y, uint32 flags, uint32 p1, uint32 p2)
v = GetVehicle(p1);
+ if (p2 != 0) v->set_for_replacement = true; //now all clients knows that the vehicle wants to be replaced
+
if (!CheckOwnership(v->owner))
return CMD_ERROR;
@@ -1030,7 +1032,8 @@ static void ProcessAircraftOrder(Vehicle *v)
if (v->current_order.type == OT_GOTO_DEPOT &&
(v->current_order.flags & (OF_UNLOAD | OF_FULL_LOAD)) == (OF_UNLOAD | OF_FULL_LOAD) &&
- !VehicleNeedsService(v)) {
+ !VehicleNeedsService(v) &&
+ v->set_for_replacement == false) {
v->cur_order_index++;
}
@@ -1434,8 +1437,8 @@ static void AircraftEventHandler_HeliTakeOff(Vehicle *v, const AirportFTAClass *
AircraftNextAirportPos_and_Order(v);
// check if the aircraft needs to be replaced or renewed and send it to a hangar if needed
- if ((v->owner == _local_player && _autoreplace_array[v->engine_type] != v->engine_type) ||
- (v->owner == _local_player && _patches.autorenew && v->age - v->max_age > (_patches.autorenew_months * 30))) {
+ if (v->current_order.type != OT_GOTO_DEPOT && ((v->owner == _local_player && _autoreplace_array[v->engine_type] != v->engine_type) ||
+ (v->owner == _local_player && _patches.autorenew && v->age - v->max_age > (_patches.autorenew_months * 30)))) {
_current_player = _local_player;
DoCommandP(v->tile, v->index, 1, NULL, CMD_SEND_AIRCRAFT_TO_HANGAR | CMD_SHOW_NO_ERROR);
_current_player = OWNER_NONE;