summaryrefslogtreecommitdiff
path: root/src/aircraft_cmd.cpp
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2007-03-08 21:39:34 +0000
committerbjarni <bjarni@openttd.org>2007-03-08 21:39:34 +0000
commitc2b7d0192d2b07ca7e4d87d583dabb2e43df49ec (patch)
treecfdbc180c9140ada4cb0bc22da9defe931609d16 /src/aircraft_cmd.cpp
parentdaeac3d310a6bf367eb77f0b965f8930dc187899 (diff)
downloadopenttd-c2b7d0192d2b07ca7e4d87d583dabb2e43df49ec.tar.xz
(svn r9072) -Codechange: [Orders] added methods to orders to free them and check if they are in use
Diffstat (limited to 'src/aircraft_cmd.cpp')
-rw-r--r--src/aircraft_cmd.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index ea7a236c3..e4d5b44ab 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -1273,8 +1273,7 @@ static void ProcessAircraftOrder(Vehicle *v)
if (CmdFailed(ret)) CrashAirplane(v);
} else if (v->current_order.type != OT_GOTO_DEPOT) {
- v->current_order.type = OT_NOTHING;
- v->current_order.flags = 0;
+ v->current_order.Free();
}
return;
}
@@ -1326,8 +1325,7 @@ static void HandleAircraftLoading(Vehicle *v, int mode)
}
Order b = v->current_order;
- v->current_order.type = OT_NOTHING;
- v->current_order.flags = 0;
+ v->current_order.Free();
MarkAircraftDirty(v);
if (!(b.flags & OF_NON_STOP)) return;
break;
@@ -1552,8 +1550,7 @@ static void AircraftEventHandler_InHangar(Vehicle *v, const AirportFTAClass *apc
/* if we were sent to the depot, stay there */
if (v->current_order.type == OT_GOTO_DEPOT && (v->vehstatus & VS_STOPPED)) {
- v->current_order.type = OT_NOTHING;
- v->current_order.flags = 0;
+ v->current_order.Free();
return;
}
@@ -1601,7 +1598,7 @@ static void AircraftEventHandler_AtTerminal(Vehicle *v, const AirportFTAClass *a
return;
}
- if (v->current_order.type == OT_NOTHING) return;
+ if (!v->current_order.IsValid()) return;
/* if the block of the next position is busy, stay put */
if (AirportHasBlock(v, &apc->layout[v->u.air.pos], apc)) return;
@@ -1622,8 +1619,7 @@ static void AircraftEventHandler_AtTerminal(Vehicle *v, const AirportFTAClass *a
}
break;
default: // orders have been deleted (no orders), goto depot and don't bother us
- v->current_order.type = OT_NOTHING;
- v->current_order.flags = 0;
+ v->current_order.Free();
v->u.air.state = HANGAR;
}
AirportMove(v, apc);