(svn r6142) -Codechange: added WaypointID (sorry DV, couldn't splits it anymore)

-Codechange: introduced DestinationID, which is in fact an union of several types
  Used in Order struct, so no longer StationID is abused for all targets.
  Hangars are a big exception, as they use a station-id with GOTO_DEPOT (go figure)
This commit is contained in:
truelight
2006-08-26 16:34:03 +00:00
parent f73a2829f3
commit db8dfcd6e9
23 changed files with 172 additions and 157 deletions

View File

@@ -537,7 +537,7 @@ int32 CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
if (flags & DC_EXEC) {
v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = HASBIT(p2, 16) ? 0 : OF_NON_STOP | OF_FULL_LOAD;
v->current_order.station = next_airport_index;
v->current_order.dest.station = next_airport_index;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
if (HASBIT(p2, 17) || (p2 == 0 && v->u.air.state == FLYING && !next_airport_has_hangar)) {
// the aircraft is now heading for a different hangar than the next in the orders
@@ -650,7 +650,7 @@ static void CheckIfAircraftNeedsService(Vehicle *v)
if (_patches.gotodepot && VehicleHasDepotOrders(v)) return;
st = GetStation(v->current_order.station);
st = GetStation(v->current_order.dest.station);
// only goto depot if the target airport has terminals (eg. it is airport)
if (IsValidStation(st) && st->airport_tile != 0 && GetAirport(st->airport_type)->terminals != NULL) {
// printf("targetairport = %d, st->index = %d\n", v->u.air.targetairport, st->index);
@@ -1195,9 +1195,9 @@ static void ProcessAircraftOrder(Vehicle *v)
if (order->type == OT_DUMMY && !CheckForValidOrders(v)) CrashAirplane(v);
if (order->type == v->current_order.type &&
order->flags == v->current_order.flags &&
order->station == v->current_order.station)
if (order->type == v->current_order.type &&
order->flags == v->current_order.flags &&
order->dest.station == v->current_order.dest.station)
return;
v->current_order = *order;
@@ -1205,7 +1205,7 @@ static void ProcessAircraftOrder(Vehicle *v)
// orders are changed in flight, ensure going to the right station
if (order->type == OT_GOTO_STATION && v->u.air.state == FLYING) {
AircraftNextAirportPos_and_Order(v);
v->u.air.targetairport = order->station;
v->u.air.targetairport = order->dest.station;
}
InvalidateVehicleOrder(v);
@@ -1347,7 +1347,7 @@ static void AircraftEntersTerminal(Vehicle *v)
v->current_order.flags = 0;
if (old_order.type == OT_GOTO_STATION &&
v->current_order.station == v->last_station_visited) {
v->current_order.dest.station == v->last_station_visited) {
v->current_order.flags =
(old_order.flags & (OF_FULL_LOAD | OF_UNLOAD | OF_TRANSFER)) | OF_NON_STOP;
}
@@ -1415,7 +1415,7 @@ static void AircraftNextAirportPos_and_Order(Vehicle *v)
if (v->current_order.type == OT_GOTO_STATION ||
v->current_order.type == OT_GOTO_DEPOT)
v->u.air.targetairport = v->current_order.station;
v->u.air.targetairport = v->current_order.dest.station;
st = GetStation(v->u.air.targetairport);
Airport = GetAirport(st->airport_type);
@@ -1487,7 +1487,7 @@ static void AircraftEventHandler_InHangar(Vehicle *v, const AirportFTAClass *Air
if (AirportHasBlock(v, &Airport->layout[v->u.air.pos], Airport)) return;
// We are already at the target airport, we need to find a terminal
if (v->current_order.station == v->u.air.targetairport) {
if (v->current_order.dest.station == v->u.air.targetairport) {
// FindFreeTerminal:
// 1. Find a free terminal, 2. Occupy it, 3. Set the vehicle's state to that terminal
if (v->subtype != 0) {
@@ -1539,7 +1539,7 @@ static void AircraftEventHandler_AtTerminal(Vehicle *v, const AirportFTAClass *A
v->u.air.state = (v->subtype != 0) ? TAKEOFF : HELITAKEOFF;
break;
case OT_GOTO_DEPOT: // visit hangar for serivicing, sale, etc.
if (v->current_order.station == v->u.air.targetairport) {
if (v->current_order.dest.station == v->u.air.targetairport) {
v->u.air.state = HANGAR;
} else {
v->u.air.state = (v->subtype != 0) ? TAKEOFF : HELITAKEOFF;