(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold

DestinationID being a union of these types is just hassle without benefit and cannot be handled correctly everywhere because of local lack of information
This commit is contained in:
tron
2006-09-03 08:25:27 +00:00
parent 302772883c
commit 1c21c645ae
21 changed files with 173 additions and 187 deletions

View File

@@ -125,7 +125,7 @@ static void CheckIfShipNeedsService(Vehicle *v)
v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = OF_NON_STOP;
v->current_order.dest.depot = depot->index;
v->current_order.dest = depot->index;
v->dest_tile = depot->xy;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
}
@@ -227,9 +227,9 @@ static void ProcessShipOrder(Vehicle *v)
return;
}
if (order->type == v->current_order.type &&
order->flags == v->current_order.flags &&
order->dest.station == v->current_order.dest.station)
if (order->type == v->current_order.type &&
order->flags == v->current_order.flags &&
order->dest == v->current_order.dest)
return;
v->current_order = *order;
@@ -237,15 +237,15 @@ static void ProcessShipOrder(Vehicle *v)
if (order->type == OT_GOTO_STATION) {
const Station *st;
if (order->dest.station == v->last_station_visited)
if (order->dest == v->last_station_visited)
v->last_station_visited = INVALID_STATION;
st = GetStation(order->dest.station);
st = GetStation(order->dest);
if (st->dock_tile != 0) {
v->dest_tile = TILE_ADD(st->dock_tile, ToTileIndexDiff(GetDockOffset(st->dock_tile)));
}
} else if (order->type == OT_GOTO_DEPOT) {
v->dest_tile = GetDepot(order->dest.depot)->xy;
v->dest_tile = GetDepot(order->dest)->xy;
} else {
v->dest_tile = 0;
}
@@ -722,10 +722,10 @@ static void ShipController(Vehicle *v)
} else if (v->current_order.type == OT_GOTO_STATION) {
Station *st;
v->last_station_visited = v->current_order.dest.station;
v->last_station_visited = v->current_order.dest;
/* Process station in the orderlist. */
st = GetStation(v->current_order.dest.station);
st = GetStation(v->current_order.dest);
if (st->facilities & FACIL_DOCK) { /* ugly, ugly workaround for problem with ships able to drop off cargo at wrong stations */
v->current_order.type = OT_LOADING;
v->current_order.flags &= OF_FULL_LOAD | OF_UNLOAD | OF_TRANSFER;
@@ -1055,7 +1055,7 @@ int32 CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v->current_order.type = OT_GOTO_DEPOT;
v->current_order.flags = OF_NON_STOP;
if (!(p2 & DEPOT_SERVICE)) SETBIT(v->current_order.flags, OFB_HALT_IN_DEPOT);
v->current_order.dest.depot = dep->index;
v->current_order.dest = dep->index;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
}