From c2b7d0192d2b07ca7e4d87d583dabb2e43df49ec Mon Sep 17 00:00:00 2001 From: bjarni Date: Thu, 8 Mar 2007 21:39:34 +0000 Subject: (svn r9072) -Codechange: [Orders] added methods to orders to free them and check if they are in use --- src/aircraft_cmd.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/aircraft_cmd.cpp') 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); -- cgit v1.2.3-54-g00ecf