summaryrefslogtreecommitdiff
path: root/train_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-09-03 08:25:27 +0000
committertron <tron@openttd.org>2006-09-03 08:25:27 +0000
commit1c21c645ae04601cd3711b37e6541d807cb727a7 (patch)
tree79ebec494a87cd0b8e16e577740868f5bf90a7d2 /train_cmd.c
parent302772883ce9dd965ca6dfe9ade85530c6de8210 (diff)
downloadopenttd-1c21c645ae04601cd3711b37e6541d807cb727a7.tar.xz
(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
Diffstat (limited to 'train_cmd.c')
-rw-r--r--train_cmd.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/train_cmd.c b/train_cmd.c
index 79457b5d2..8b033054d 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -254,13 +254,13 @@ static bool TrainShouldStop(const Vehicle* v, TileIndex tile)
assert(v->type == VEH_Train);
//When does a train drive through a station
//first we deal with the "new nonstop handling"
- if (_patches.new_nonstop && o->flags & OF_NON_STOP && sid == o->dest.station) {
+ if (_patches.new_nonstop && o->flags & OF_NON_STOP && sid == o->dest) {
return false;
}
if (v->last_station_visited == sid) return false;
- if (sid != o->dest.station && (o->flags & OF_NON_STOP || _patches.new_nonstop)) {
+ if (sid != o->dest && (o->flags & OF_NON_STOP || _patches.new_nonstop)) {
return false;
}
@@ -1985,7 +1985,7 @@ int32 CmdSendTrainToDepot(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 = GetDepotByTile(tfdd.tile)->index;
+ v->current_order.dest = GetDepotByTile(tfdd.tile)->index;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
/* If there is no depot in front, reverse automatically */
if (tfdd.reverse)
@@ -2189,7 +2189,7 @@ static void FillWithStationData(TrainTrackFollowerData* fd, const Vehicle* v)
{
fd->dest_coords = v->dest_tile;
if (v->current_order.type == OT_GOTO_STATION) {
- fd->station_index = v->current_order.dest.station;
+ fd->station_index = v->current_order.dest;
} else {
fd->station_index = INVALID_STATION;
}
@@ -2436,7 +2436,7 @@ static bool ProcessTrainOrder(Vehicle *v)
if (_patches.new_nonstop &&
v->current_order.flags & OF_NON_STOP &&
IsTileType(v->tile, MP_STATION) &&
- v->current_order.dest.station == GetStationIndex(v->tile)) {
+ v->current_order.dest == GetStationIndex(v->tile)) {
v->cur_order_index++;
}
@@ -2454,9 +2454,9 @@ static bool ProcessTrainOrder(Vehicle *v)
}
// If it is unchanged, keep it.
- 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 false;
// Otherwise set it, and determine the destination tile.
@@ -2468,17 +2468,17 @@ static bool ProcessTrainOrder(Vehicle *v)
switch (order->type) {
case OT_GOTO_STATION:
- if (order->dest.station == v->last_station_visited)
+ if (order->dest == v->last_station_visited)
v->last_station_visited = INVALID_STATION;
- v->dest_tile = GetStation(order->dest.station)->xy;
+ v->dest_tile = GetStation(order->dest)->xy;
break;
case OT_GOTO_DEPOT:
- v->dest_tile = GetDepot(order->dest.depot)->xy;
+ v->dest_tile = GetDepot(order->dest)->xy;
break;
case OT_GOTO_WAYPOINT:
- v->dest_tile = GetWaypoint(order->dest.waypoint)->xy;
+ v->dest_tile = GetWaypoint(order->dest)->xy;
break;
default:
@@ -2599,7 +2599,7 @@ static void TrainEnterStation(Vehicle *v, StationID station)
// Did we reach the final destination?
if (v->current_order.type == OT_GOTO_STATION &&
- v->current_order.dest.station == station) {
+ v->current_order.dest == station) {
// Yeah, keep the load/unload flags
// Non Stop now means if the order should be increased.
v->current_order.type = OT_LOADING;
@@ -2610,7 +2610,7 @@ static void TrainEnterStation(Vehicle *v, StationID station)
v->current_order.type = OT_LOADING;
v->current_order.flags = 0;
}
- v->current_order.dest.station = 0;
+ v->current_order.dest = 0;
SET_EXPENSES_TYPE(EXPENSES_TRAIN_INC);
if (LoadUnloadVehicle(v) != 0) {
@@ -3528,14 +3528,14 @@ static void CheckIfTrainNeedsService(Vehicle *v)
depot = GetDepotByTile(tfdd.tile);
if (v->current_order.type == OT_GOTO_DEPOT &&
- v->current_order.dest.depot != depot->index &&
+ v->current_order.dest != depot->index &&
!CHANCE16(3, 16)) {
return;
}
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 = tfdd.tile;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
}
@@ -3580,7 +3580,7 @@ void OnNewDay_Train(Vehicle *v)
/* update destination */
if (v->current_order.type == OT_GOTO_STATION &&
- (tile = GetStation(v->current_order.dest.station)->train_tile) != 0) {
+ (tile = GetStation(v->current_order.dest)->train_tile) != 0) {
v->dest_tile = tile;
}