forked from mirror/OpenTTD
(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:
@@ -2453,7 +2453,7 @@ handle_nocash:
|
||||
|
||||
order.type = OT_GOTO_STATION;
|
||||
order.flags = 0;
|
||||
order.station = AiGetStationIdByDef(aib->use_tile, aib->cur_building_rule);
|
||||
order.dest.station = AiGetStationIdByDef(aib->use_tile, aib->cur_building_rule);
|
||||
|
||||
if (!is_pass && i == 1) order.flags |= OF_UNLOAD;
|
||||
if (p->ai.num_want_fullload != 0 && (is_pass || i == 0))
|
||||
@@ -3185,7 +3185,7 @@ static void AiStateBuildRoadVehicles(Player *p)
|
||||
|
||||
order.type = OT_GOTO_STATION;
|
||||
order.flags = 0;
|
||||
order.station = AiGetStationIdFromRoadBlock(aib->use_tile, aib->cur_building_rule);
|
||||
order.dest.station = AiGetStationIdFromRoadBlock(aib->use_tile, aib->cur_building_rule);
|
||||
|
||||
if (!is_pass && i == 1) order.flags |= OF_UNLOAD;
|
||||
if (p->ai.num_want_fullload != 0 && (is_pass || i == 0))
|
||||
@@ -3464,7 +3464,7 @@ static void AiStateBuildAircraftVehicles(Player *p)
|
||||
|
||||
order.type = OT_GOTO_STATION;
|
||||
order.flags = 0;
|
||||
order.station = AiGetStationIdFromAircraftBlock(aib->use_tile, aib->cur_building_rule);
|
||||
order.dest.station = AiGetStationIdFromAircraftBlock(aib->use_tile, aib->cur_building_rule);
|
||||
|
||||
if (!is_pass && i == 1) order.flags |= OF_UNLOAD;
|
||||
if (p->ai.num_want_fullload != 0 && (is_pass || i == 0))
|
||||
@@ -3567,7 +3567,7 @@ static void AiStateRemoveStation(Player *p)
|
||||
in_use = malloc(GetStationArraySize());
|
||||
memset(in_use, 0, GetStationArraySize());
|
||||
FOR_ALL_ORDERS(ord) {
|
||||
if (ord->type == OT_GOTO_STATION) in_use[ord->station] = 1;
|
||||
if (ord->type == OT_GOTO_STATION) in_use[ord->dest.station] = 1;
|
||||
}
|
||||
|
||||
// Go through all stations and delete those that aren't in use
|
||||
|
@@ -555,7 +555,7 @@ static bool AiNew_CheckVehicleStation(Player *p, Station *st)
|
||||
const Order *order;
|
||||
|
||||
FOR_VEHICLE_ORDERS(v, order) {
|
||||
if (order->type == OT_GOTO_STATION && GetStation(order->station) == st) {
|
||||
if (order->type == OT_GOTO_STATION && GetStation(order->dest.station) == st) {
|
||||
// This vehicle has this city in its list
|
||||
count++;
|
||||
}
|
||||
@@ -1192,14 +1192,14 @@ static void AiNew_State_GiveOrders(Player *p)
|
||||
idx = 0;
|
||||
order.type = OT_GOTO_DEPOT;
|
||||
order.flags = OF_UNLOAD;
|
||||
order.station = GetDepotByTile(p->ainew.depot_tile)->index;
|
||||
order.dest.depot = GetDepotByTile(p->ainew.depot_tile)->index;
|
||||
AI_DoCommand(0, p->ainew.veh_id + (idx << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
|
||||
}
|
||||
|
||||
idx = 0;
|
||||
order.type = OT_GOTO_STATION;
|
||||
order.flags = 0;
|
||||
order.station = GetStationIndex(p->ainew.to_tile);
|
||||
order.dest.station = GetStationIndex(p->ainew.to_tile);
|
||||
if (p->ainew.tbt == AI_TRUCK && p->ainew.to_deliver)
|
||||
order.flags |= OF_FULL_LOAD;
|
||||
AI_DoCommand(0, p->ainew.veh_id + (idx << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
|
||||
@@ -1207,7 +1207,7 @@ static void AiNew_State_GiveOrders(Player *p)
|
||||
idx = 0;
|
||||
order.type = OT_GOTO_STATION;
|
||||
order.flags = 0;
|
||||
order.station = GetStationIndex(p->ainew.from_tile);
|
||||
order.dest.station = GetStationIndex(p->ainew.from_tile);
|
||||
if (p->ainew.tbt == AI_TRUCK && p->ainew.from_deliver)
|
||||
order.flags |= OF_FULL_LOAD;
|
||||
AI_DoCommand(0, p->ainew.veh_id + (idx << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
|
||||
|
Reference in New Issue
Block a user