mirror of https://github.com/OpenTTD/OpenTTD
(svn r12584) -Codechange: do not access the order type directly.
parent
56e63a6044
commit
5b47f81b0f
|
@ -299,7 +299,7 @@ static EngineID AiChooseShipToReplaceWith(const Player* p, const Vehicle* v)
|
||||||
|
|
||||||
static void AiHandleGotoDepot(Player *p, int cmd)
|
static void AiHandleGotoDepot(Player *p, int cmd)
|
||||||
{
|
{
|
||||||
if (_players_ai[p->index].cur_veh->current_order.type != OT_GOTO_DEPOT)
|
if (!_players_ai[p->index].cur_veh->current_order.IsType(OT_GOTO_DEPOT))
|
||||||
DoCommand(0, _players_ai[p->index].cur_veh->index, 0, DC_EXEC, cmd);
|
DoCommand(0, _players_ai[p->index].cur_veh->index, 0, DC_EXEC, cmd);
|
||||||
|
|
||||||
if (++_players_ai[p->index].state_counter <= 1387) {
|
if (++_players_ai[p->index].state_counter <= 1387) {
|
||||||
|
@ -307,9 +307,8 @@ static void AiHandleGotoDepot(Player *p, int cmd)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_players_ai[p->index].cur_veh->current_order.type == OT_GOTO_DEPOT) {
|
if (_players_ai[p->index].cur_veh->current_order.IsType(OT_GOTO_DEPOT)) {
|
||||||
_players_ai[p->index].cur_veh->current_order.type = OT_DUMMY;
|
_players_ai[p->index].cur_veh->current_order.MakeDummy();
|
||||||
_players_ai[p->index].cur_veh->current_order.flags = 0;
|
|
||||||
InvalidateWindow(WC_VEHICLE_VIEW, _players_ai[p->index].cur_veh->index);
|
InvalidateWindow(WC_VEHICLE_VIEW, _players_ai[p->index].cur_veh->index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -318,7 +317,7 @@ static void AiRestoreVehicleOrders(Vehicle *v, BackuppedOrders *bak)
|
||||||
{
|
{
|
||||||
if (bak->order == NULL) return;
|
if (bak->order == NULL) return;
|
||||||
|
|
||||||
for (uint i = 0; bak->order[i].type != OT_NOTHING; i++) {
|
for (uint i = 0; !bak->order[i].IsType(OT_NOTHING); i++) {
|
||||||
if (!DoCommandP(0, v->index + (i << 16), PackOrder(&bak->order[i]), NULL, CMD_INSERT_ORDER | CMD_NO_TEST_IF_IN_NETWORK))
|
if (!DoCommandP(0, v->index + (i << 16), PackOrder(&bak->order[i]), NULL, CMD_INSERT_ORDER | CMD_NO_TEST_IF_IN_NETWORK))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2553,9 +2552,7 @@ handle_nocash:
|
||||||
);
|
);
|
||||||
Order order;
|
Order order;
|
||||||
|
|
||||||
order.type = OT_GOTO_STATION;
|
order.MakeGoToStation(AiGetStationIdByDef(aib->use_tile, aib->cur_building_rule));
|
||||||
order.flags = 0;
|
|
||||||
order.dest = AiGetStationIdByDef(aib->use_tile, aib->cur_building_rule);
|
|
||||||
|
|
||||||
if (!is_pass && i == 1) order.flags |= OFB_UNLOAD;
|
if (!is_pass && i == 1) order.flags |= OFB_UNLOAD;
|
||||||
if (_players_ai[p->index].num_want_fullload != 0 && (is_pass || i == 0))
|
if (_players_ai[p->index].num_want_fullload != 0 && (is_pass || i == 0))
|
||||||
|
@ -3290,9 +3287,7 @@ static void AiStateBuildRoadVehicles(Player *p)
|
||||||
);
|
);
|
||||||
Order order;
|
Order order;
|
||||||
|
|
||||||
order.type = OT_GOTO_STATION;
|
order.MakeGoToStation(AiGetStationIdFromRoadBlock(aib->use_tile, aib->cur_building_rule));
|
||||||
order.flags = 0;
|
|
||||||
order.dest = AiGetStationIdFromRoadBlock(aib->use_tile, aib->cur_building_rule);
|
|
||||||
|
|
||||||
if (!is_pass && i == 1) order.flags |= OFB_UNLOAD;
|
if (!is_pass && i == 1) order.flags |= OFB_UNLOAD;
|
||||||
if (_players_ai[p->index].num_want_fullload != 0 && (is_pass || i == 0))
|
if (_players_ai[p->index].num_want_fullload != 0 && (is_pass || i == 0))
|
||||||
|
@ -3571,9 +3566,7 @@ static void AiStateBuildAircraftVehicles(Player *p)
|
||||||
bool is_pass = (_players_ai[p->index].cargo_type == CT_PASSENGERS || _players_ai[p->index].cargo_type == CT_MAIL);
|
bool is_pass = (_players_ai[p->index].cargo_type == CT_PASSENGERS || _players_ai[p->index].cargo_type == CT_MAIL);
|
||||||
Order order;
|
Order order;
|
||||||
|
|
||||||
order.type = OT_GOTO_STATION;
|
order.MakeGoToStation(AiGetStationIdFromAircraftBlock(aib->use_tile, aib->cur_building_rule));
|
||||||
order.flags = 0;
|
|
||||||
order.dest = AiGetStationIdFromAircraftBlock(aib->use_tile, aib->cur_building_rule);
|
|
||||||
|
|
||||||
if (!is_pass && i == 1) order.flags |= OFB_UNLOAD;
|
if (!is_pass && i == 1) order.flags |= OFB_UNLOAD;
|
||||||
if (_players_ai[p->index].num_want_fullload != 0 && (is_pass || i == 0))
|
if (_players_ai[p->index].num_want_fullload != 0 && (is_pass || i == 0))
|
||||||
|
@ -3614,7 +3607,7 @@ static void AiStateSellVeh(Player *p)
|
||||||
if (v->type == VEH_TRAIN) {
|
if (v->type == VEH_TRAIN) {
|
||||||
|
|
||||||
if (!IsTileDepotType(v->tile, TRANSPORT_RAIL) || v->u.rail.track != 0x80 || !(v->vehstatus&VS_STOPPED)) {
|
if (!IsTileDepotType(v->tile, TRANSPORT_RAIL) || v->u.rail.track != 0x80 || !(v->vehstatus&VS_STOPPED)) {
|
||||||
if (v->current_order.type != OT_GOTO_DEPOT)
|
if (!v->current_order.IsType(OT_GOTO_DEPOT))
|
||||||
DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_TRAIN_TO_DEPOT);
|
DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_TRAIN_TO_DEPOT);
|
||||||
goto going_to_depot;
|
goto going_to_depot;
|
||||||
}
|
}
|
||||||
|
@ -3624,7 +3617,7 @@ static void AiStateSellVeh(Player *p)
|
||||||
|
|
||||||
} else if (v->type == VEH_ROAD) {
|
} else if (v->type == VEH_ROAD) {
|
||||||
if (!v->IsStoppedInDepot()) {
|
if (!v->IsStoppedInDepot()) {
|
||||||
if (v->current_order.type != OT_GOTO_DEPOT)
|
if (!v->current_order.IsType(OT_GOTO_DEPOT))
|
||||||
DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_ROADVEH_TO_DEPOT);
|
DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_ROADVEH_TO_DEPOT);
|
||||||
goto going_to_depot;
|
goto going_to_depot;
|
||||||
}
|
}
|
||||||
|
@ -3632,7 +3625,7 @@ static void AiStateSellVeh(Player *p)
|
||||||
DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_ROAD_VEH);
|
DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_ROAD_VEH);
|
||||||
} else if (v->type == VEH_AIRCRAFT) {
|
} else if (v->type == VEH_AIRCRAFT) {
|
||||||
if (!v->IsStoppedInDepot()) {
|
if (!v->IsStoppedInDepot()) {
|
||||||
if (v->current_order.type != OT_GOTO_DEPOT)
|
if (!v->current_order.IsType(OT_GOTO_DEPOT))
|
||||||
DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_AIRCRAFT_TO_HANGAR);
|
DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_AIRCRAFT_TO_HANGAR);
|
||||||
goto going_to_depot;
|
goto going_to_depot;
|
||||||
}
|
}
|
||||||
|
@ -3647,9 +3640,8 @@ static void AiStateSellVeh(Player *p)
|
||||||
going_to_depot:;
|
going_to_depot:;
|
||||||
if (++_players_ai[p->index].state_counter <= 832) return;
|
if (++_players_ai[p->index].state_counter <= 832) return;
|
||||||
|
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT) {
|
if (v->current_order.IsType(OT_GOTO_DEPOT)) {
|
||||||
v->current_order.type = OT_DUMMY;
|
v->current_order.MakeDummy();
|
||||||
v->current_order.flags = 0;
|
|
||||||
InvalidateWindow(WC_VEHICLE_VIEW, v->index);
|
InvalidateWindow(WC_VEHICLE_VIEW, v->index);
|
||||||
}
|
}
|
||||||
return_to_loop:;
|
return_to_loop:;
|
||||||
|
@ -3670,7 +3662,7 @@ static void AiStateRemoveStation(Player *p)
|
||||||
byte *in_use = MallocT<byte>(GetMaxStationIndex() + 1);
|
byte *in_use = MallocT<byte>(GetMaxStationIndex() + 1);
|
||||||
memset(in_use, 0, GetMaxStationIndex() + 1);
|
memset(in_use, 0, GetMaxStationIndex() + 1);
|
||||||
FOR_ALL_ORDERS(ord) {
|
FOR_ALL_ORDERS(ord) {
|
||||||
if (ord->type == OT_GOTO_STATION) in_use[ord->dest] = 1;
|
if (ord->IsType(OT_GOTO_STATION)) in_use[ord->dest] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Go through all stations and delete those that aren't in use
|
// Go through all stations and delete those that aren't in use
|
||||||
|
|
|
@ -553,7 +553,7 @@ static bool AiNew_CheckVehicleStation(Player *p, Station *st)
|
||||||
const Order *order;
|
const Order *order;
|
||||||
|
|
||||||
FOR_VEHICLE_ORDERS(v, order) {
|
FOR_VEHICLE_ORDERS(v, order) {
|
||||||
if (order->type == OT_GOTO_STATION && GetStation(order->dest) == st) {
|
if (order->IsType(OT_GOTO_STATION) && GetStation(order->dest) == st) {
|
||||||
// This vehicle has this city in its list
|
// This vehicle has this city in its list
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -1184,24 +1184,18 @@ static void AiNew_State_GiveOrders(Player *p)
|
||||||
// Very handy for AI, goto depot.. but yeah, it needs to be activated ;)
|
// Very handy for AI, goto depot.. but yeah, it needs to be activated ;)
|
||||||
if (_patches.gotodepot) {
|
if (_patches.gotodepot) {
|
||||||
idx = 0;
|
idx = 0;
|
||||||
order.type = OT_GOTO_DEPOT;
|
order.MakeGoToDepot(GetDepotByTile(_players_ainew[p->index].depot_tile)->index, true);
|
||||||
order.flags = OFB_UNLOAD;
|
|
||||||
order.dest = GetDepotByTile(_players_ainew[p->index].depot_tile)->index;
|
|
||||||
AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
|
AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
idx = 0;
|
idx = 0;
|
||||||
order.type = OT_GOTO_STATION;
|
order.MakeGoToStation(GetStationIndex(_players_ainew[p->index].to_tile));
|
||||||
order.flags = 0;
|
|
||||||
order.dest = GetStationIndex(_players_ainew[p->index].to_tile);
|
|
||||||
if (_players_ainew[p->index].tbt == AI_TRUCK && _players_ainew[p->index].to_deliver)
|
if (_players_ainew[p->index].tbt == AI_TRUCK && _players_ainew[p->index].to_deliver)
|
||||||
order.flags |= OFB_FULL_LOAD;
|
order.flags |= OFB_FULL_LOAD;
|
||||||
AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
|
AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
|
||||||
|
|
||||||
idx = 0;
|
idx = 0;
|
||||||
order.type = OT_GOTO_STATION;
|
order.MakeGoToStation(GetStationIndex(_players_ainew[p->index].from_tile));
|
||||||
order.flags = 0;
|
|
||||||
order.dest = GetStationIndex(_players_ainew[p->index].from_tile);
|
|
||||||
if (_players_ainew[p->index].tbt == AI_TRUCK && _players_ainew[p->index].from_deliver)
|
if (_players_ainew[p->index].tbt == AI_TRUCK && _players_ainew[p->index].from_deliver)
|
||||||
order.flags |= OFB_FULL_LOAD;
|
order.flags |= OFB_FULL_LOAD;
|
||||||
AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
|
AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
|
||||||
|
|
|
@ -569,7 +569,7 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
|
||||||
|
|
||||||
if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner) || v->IsInDepot()) return CMD_ERROR;
|
if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner) || v->IsInDepot()) return CMD_ERROR;
|
||||||
|
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT && !(p2 & DEPOT_LOCATE_HANGAR)) {
|
if (v->current_order.IsType(OT_GOTO_DEPOT) && !(p2 & DEPOT_LOCATE_HANGAR)) {
|
||||||
if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OF_HALT_IN_DEPOT)) {
|
if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OF_HALT_IN_DEPOT)) {
|
||||||
/* We called with a different DEPOT_SERVICE setting.
|
/* We called with a different DEPOT_SERVICE setting.
|
||||||
* Now we change the setting to apply the new one and let the vehicle head for the same hangar.
|
* Now we change the setting to apply the new one and let the vehicle head for the same hangar.
|
||||||
|
@ -585,8 +585,7 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
|
||||||
if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of hangar orders
|
if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of hangar orders
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
if (v->current_order.flags & OFB_UNLOAD) v->cur_order_index++;
|
if (v->current_order.flags & OFB_UNLOAD) v->cur_order_index++;
|
||||||
v->current_order.type = OT_DUMMY;
|
v->current_order.MakeDummy();
|
||||||
v->current_order.flags = 0;
|
|
||||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -604,13 +603,10 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
if (v->current_order.type == OT_LOADING) v->LeaveStation();
|
if (v->current_order.IsType(OT_LOADING)) v->LeaveStation();
|
||||||
|
|
||||||
v->current_order.type = OT_GOTO_DEPOT;
|
v->current_order.MakeGoToDepot(next_airport_index, false);
|
||||||
v->current_order.flags = OFB_NON_STOP;
|
|
||||||
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
|
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
|
||||||
v->current_order.refit_cargo = CT_INVALID;
|
|
||||||
v->current_order.dest = next_airport_index;
|
|
||||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
||||||
if (v->u.air.state == FLYING && !next_airport_has_hangar) {
|
if (v->u.air.state == FLYING && !next_airport_has_hangar) {
|
||||||
/* The aircraft is now heading for a different hangar than the next in the orders */
|
/* The aircraft is now heading for a different hangar than the next in the orders */
|
||||||
|
@ -714,12 +710,10 @@ static void CheckIfAircraftNeedsService(Vehicle *v)
|
||||||
if (st->IsValid() && st->airport_tile != 0 && st->Airport()->terminals != NULL) {
|
if (st->IsValid() && st->airport_tile != 0 && st->Airport()->terminals != NULL) {
|
||||||
// printf("targetairport = %d, st->index = %d\n", v->u.air.targetairport, st->index);
|
// printf("targetairport = %d, st->index = %d\n", v->u.air.targetairport, st->index);
|
||||||
// v->u.air.targetairport = st->index;
|
// v->u.air.targetairport = st->index;
|
||||||
v->current_order.type = OT_GOTO_DEPOT;
|
v->current_order.MakeGoToDepot(INVALID_STATION, false);
|
||||||
v->current_order.flags = OFB_NON_STOP;
|
|
||||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
||||||
} else if (v->current_order.type == OT_GOTO_DEPOT) {
|
} else if (v->current_order.IsType(OT_GOTO_DEPOT)) {
|
||||||
v->current_order.type = OT_DUMMY;
|
v->current_order.MakeDummy();
|
||||||
v->current_order.flags = 0;
|
|
||||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -780,7 +774,7 @@ static void HelicopterTickHandler(Vehicle *v)
|
||||||
|
|
||||||
/* if true, helicopter rotors do not rotate. This should only be the case if a helicopter is
|
/* if true, helicopter rotors do not rotate. This should only be the case if a helicopter is
|
||||||
* loading/unloading at a terminal or stopped */
|
* loading/unloading at a terminal or stopped */
|
||||||
if (v->current_order.type == OT_LOADING || (v->vehstatus & VS_STOPPED)) {
|
if (v->current_order.IsType(OT_LOADING) || (v->vehstatus & VS_STOPPED)) {
|
||||||
if (u->cur_speed != 0) {
|
if (u->cur_speed != 0) {
|
||||||
u->cur_speed++;
|
u->cur_speed++;
|
||||||
if (u->cur_speed >= 0x80 && u->u.air.state == HRS_ROTOR_MOVING_3) {
|
if (u->cur_speed >= 0x80 && u->u.air.state == HRS_ROTOR_MOVING_3) {
|
||||||
|
@ -1388,7 +1382,7 @@ void HandleMissingAircraftOrders(Vehicle *v)
|
||||||
_current_player = old_player;
|
_current_player = old_player;
|
||||||
|
|
||||||
if (CmdFailed(ret)) CrashAirplane(v);
|
if (CmdFailed(ret)) CrashAirplane(v);
|
||||||
} else if (v->current_order.type != OT_GOTO_DEPOT) {
|
} else if (!v->current_order.IsType(OT_GOTO_DEPOT)) {
|
||||||
v->current_order.Free();
|
v->current_order.Free();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1471,7 +1465,7 @@ static void MaybeCrashAirplane(Vehicle *v)
|
||||||
/** we've landed and just arrived at a terminal */
|
/** we've landed and just arrived at a terminal */
|
||||||
static void AircraftEntersTerminal(Vehicle *v)
|
static void AircraftEntersTerminal(Vehicle *v)
|
||||||
{
|
{
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT) return;
|
if (v->current_order.IsType(OT_GOTO_DEPOT)) return;
|
||||||
|
|
||||||
Station *st = GetStation(v->u.air.targetairport);
|
Station *st = GetStation(v->u.air.targetairport);
|
||||||
v->last_station_visited = v->u.air.targetairport;
|
v->last_station_visited = v->u.air.targetairport;
|
||||||
|
@ -1505,8 +1499,8 @@ static void AircraftLandAirplane(Vehicle *v)
|
||||||
/** set the right pos when heading to other airports after takeoff */
|
/** set the right pos when heading to other airports after takeoff */
|
||||||
static void AircraftNextAirportPos_and_Order(Vehicle *v)
|
static void AircraftNextAirportPos_and_Order(Vehicle *v)
|
||||||
{
|
{
|
||||||
if (v->current_order.type == OT_GOTO_STATION ||
|
if (v->current_order.IsType(OT_GOTO_STATION) ||
|
||||||
v->current_order.type == OT_GOTO_DEPOT)
|
v->current_order.IsType(OT_GOTO_DEPOT))
|
||||||
v->u.air.targetairport = v->current_order.dest;
|
v->u.air.targetairport = v->current_order.dest;
|
||||||
|
|
||||||
const AirportFTAClass *apc = GetStation(v->u.air.targetairport)->Airport();
|
const AirportFTAClass *apc = GetStation(v->u.air.targetairport)->Airport();
|
||||||
|
@ -1603,13 +1597,13 @@ static void AircraftEventHandler_InHangar(Vehicle *v, const AirportFTAClass *apc
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we were sent to the depot, stay there */
|
/* if we were sent to the depot, stay there */
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT && (v->vehstatus & VS_STOPPED)) {
|
if (v->current_order.IsType(OT_GOTO_DEPOT) && (v->vehstatus & VS_STOPPED)) {
|
||||||
v->current_order.Free();
|
v->current_order.Free();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v->current_order.type != OT_GOTO_STATION &&
|
if (!v->current_order.IsType(OT_GOTO_STATION) &&
|
||||||
v->current_order.type != OT_GOTO_DEPOT)
|
!v->current_order.IsType(OT_GOTO_DEPOT))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* if the block of the next position is busy, stay put */
|
/* if the block of the next position is busy, stay put */
|
||||||
|
@ -1660,7 +1654,7 @@ static void AircraftEventHandler_AtTerminal(Vehicle *v, const AirportFTAClass *a
|
||||||
/* airport-road is free. We either have to go to another airport, or to the hangar
|
/* airport-road is free. We either have to go to another airport, or to the hangar
|
||||||
* ---> start moving */
|
* ---> start moving */
|
||||||
|
|
||||||
switch (v->current_order.type) {
|
switch (v->current_order.GetType()) {
|
||||||
case OT_GOTO_STATION: // ready to fly to another airport
|
case OT_GOTO_STATION: // ready to fly to another airport
|
||||||
/* airplane goto state takeoff, helicopter to helitakeoff */
|
/* airplane goto state takeoff, helicopter to helitakeoff */
|
||||||
v->u.air.state = (v->subtype == AIR_HELICOPTER) ? HELITAKEOFF : TAKEOFF;
|
v->u.air.state = (v->subtype == AIR_HELICOPTER) ? HELITAKEOFF : TAKEOFF;
|
||||||
|
@ -1786,7 +1780,7 @@ static void AircraftEventHandler_EndLanding(Vehicle *v, const AirportFTAClass *a
|
||||||
* 1. in case all terminals are busy AirportFindFreeTerminal() returns false or
|
* 1. in case all terminals are busy AirportFindFreeTerminal() returns false or
|
||||||
* 2. not going for terminal (but depot, no order),
|
* 2. not going for terminal (but depot, no order),
|
||||||
* --> get out of the way to the hangar. */
|
* --> get out of the way to the hangar. */
|
||||||
if (v->current_order.type == OT_GOTO_STATION) {
|
if (v->current_order.IsType(OT_GOTO_STATION)) {
|
||||||
if (AirportFindFreeTerminal(v, apc)) return;
|
if (AirportFindFreeTerminal(v, apc)) return;
|
||||||
}
|
}
|
||||||
v->u.air.state = HANGAR;
|
v->u.air.state = HANGAR;
|
||||||
|
@ -1805,7 +1799,7 @@ static void AircraftEventHandler_HeliEndLanding(Vehicle *v, const AirportFTAClas
|
||||||
* --> else TAKEOFF
|
* --> else TAKEOFF
|
||||||
* the reason behind this is that if an airport has a terminal, it also has a hangar. Airplanes
|
* the reason behind this is that if an airport has a terminal, it also has a hangar. Airplanes
|
||||||
* must go to a hangar. */
|
* must go to a hangar. */
|
||||||
if (v->current_order.type == OT_GOTO_STATION) {
|
if (v->current_order.IsType(OT_GOTO_STATION)) {
|
||||||
if (AirportFindFreeHelipad(v, apc)) return;
|
if (AirportFindFreeHelipad(v, apc)) return;
|
||||||
}
|
}
|
||||||
v->u.air.state = (apc->nof_depots != 0) ? HANGAR : HELITAKEOFF;
|
v->u.air.state = (apc->nof_depots != 0) ? HANGAR : HELITAKEOFF;
|
||||||
|
@ -2126,7 +2120,7 @@ static void AircraftEventHandler(Vehicle *v, int loop)
|
||||||
ProcessOrders(v);
|
ProcessOrders(v);
|
||||||
v->HandleLoading(loop != 0);
|
v->HandleLoading(loop != 0);
|
||||||
|
|
||||||
if (v->current_order.type >= OT_LOADING) return;
|
if (v->current_order.IsType(OT_LOADING) || v->current_order.IsType(OT_LEAVESTATION)) return;
|
||||||
|
|
||||||
AirportGoToNextPosition(v);
|
AirportGoToNextPosition(v);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1967,7 +1967,7 @@ int WhoCanServiceIndustry(Industry* ind)
|
||||||
*/
|
*/
|
||||||
const Order *o;
|
const Order *o;
|
||||||
FOR_VEHICLE_ORDERS(v, o) {
|
FOR_VEHICLE_ORDERS(v, o) {
|
||||||
if (o->type == OT_GOTO_STATION && !HasBit(o->flags, OF_TRANSFER)) {
|
if (o->IsType(OT_GOTO_STATION) && !HasBit(o->flags, OF_TRANSFER)) {
|
||||||
/* Vehicle visits a station to load or unload */
|
/* Vehicle visits a station to load or unload */
|
||||||
Station *st = GetStation(o->dest);
|
Station *st = GetStation(o->dest);
|
||||||
if (!st->IsValid()) continue;
|
if (!st->IsValid()) continue;
|
||||||
|
|
|
@ -348,11 +348,11 @@ static byte MapAircraftMovementAction(const Vehicle *v)
|
||||||
|
|
||||||
case TERM1:
|
case TERM1:
|
||||||
case HELIPAD1:
|
case HELIPAD1:
|
||||||
return (v->current_order.type == OT_LOADING) ? AMA_TTDP_ON_PAD1 : AMA_TTDP_LANDING_TO_PAD1;
|
return (v->current_order.IsType(OT_LOADING)) ? AMA_TTDP_ON_PAD1 : AMA_TTDP_LANDING_TO_PAD1;
|
||||||
|
|
||||||
case TERM2:
|
case TERM2:
|
||||||
case HELIPAD2:
|
case HELIPAD2:
|
||||||
return (v->current_order.type == OT_LOADING) ? AMA_TTDP_ON_PAD2 : AMA_TTDP_LANDING_TO_PAD2;
|
return (v->current_order.IsType(OT_LOADING)) ? AMA_TTDP_ON_PAD2 : AMA_TTDP_LANDING_TO_PAD2;
|
||||||
|
|
||||||
case TERM3:
|
case TERM3:
|
||||||
case TERM4:
|
case TERM4:
|
||||||
|
@ -362,7 +362,7 @@ static byte MapAircraftMovementAction(const Vehicle *v)
|
||||||
case TERM8:
|
case TERM8:
|
||||||
case HELIPAD3:
|
case HELIPAD3:
|
||||||
case HELIPAD4:
|
case HELIPAD4:
|
||||||
return (v->current_order.type == OT_LOADING) ? AMA_TTDP_ON_PAD3 : AMA_TTDP_LANDING_TO_PAD3;
|
return (v->current_order.IsType(OT_LOADING)) ? AMA_TTDP_ON_PAD3 : AMA_TTDP_LANDING_TO_PAD3;
|
||||||
|
|
||||||
case TAKEOFF: // Moving to takeoff position
|
case TAKEOFF: // Moving to takeoff position
|
||||||
case STARTTAKEOFF: // Accelerating down runway
|
case STARTTAKEOFF: // Accelerating down runway
|
||||||
|
@ -379,7 +379,7 @@ static byte MapAircraftMovementAction(const Vehicle *v)
|
||||||
case HELILANDING:
|
case HELILANDING:
|
||||||
case HELIENDLANDING:
|
case HELIENDLANDING:
|
||||||
/* @todo Need to check terminal we're landing to. Is it known yet? */
|
/* @todo Need to check terminal we're landing to. Is it known yet? */
|
||||||
return (v->current_order.type == OT_GOTO_DEPOT) ?
|
return (v->current_order.IsType(OT_GOTO_DEPOT)) ?
|
||||||
AMA_TTDP_LANDING_TO_HANGAR : AMA_TTDP_LANDING_TO_PAD1;
|
AMA_TTDP_LANDING_TO_HANGAR : AMA_TTDP_LANDING_TO_PAD1;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -811,7 +811,7 @@ static const SpriteGroup *VehicleResolveReal(const ResolverObject *object, const
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool in_motion = v->First()->current_order.type != OT_LOADING;
|
bool in_motion = !v->First()->current_order.IsType(OT_LOADING);
|
||||||
|
|
||||||
totalsets = in_motion ? group->g.real.num_loaded : group->g.real.num_loading;
|
totalsets = in_motion ? group->g.real.num_loaded : group->g.real.num_loading;
|
||||||
|
|
||||||
|
|
|
@ -980,7 +980,7 @@ void NPFFillWithOrderData(NPFFindStationOrTileData* fstd, Vehicle* v)
|
||||||
* dest_tile, not just any stop of that station.
|
* dest_tile, not just any stop of that station.
|
||||||
* So only for train orders to stations we fill fstd->station_index, for all
|
* So only for train orders to stations we fill fstd->station_index, for all
|
||||||
* others only dest_coords */
|
* others only dest_coords */
|
||||||
if (v->current_order.type == OT_GOTO_STATION && v->type == VEH_TRAIN) {
|
if (v->current_order.IsType(OT_GOTO_STATION) && v->type == VEH_TRAIN) {
|
||||||
fstd->station_index = v->current_order.dest;
|
fstd->station_index = v->current_order.dest;
|
||||||
/* Let's take the closest tile of the station as our target for trains */
|
/* Let's take the closest tile of the station as our target for trains */
|
||||||
fstd->dest_coords = CalcClosestStationTile(v->current_order.dest, v->tile);
|
fstd->dest_coords = CalcClosestStationTile(v->current_order.dest, v->tile);
|
||||||
|
|
|
@ -345,8 +345,8 @@ static void FixOldVehicles()
|
||||||
* (loading) order which causes assertions and the like later on.
|
* (loading) order which causes assertions and the like later on.
|
||||||
*/
|
*/
|
||||||
if (!IsPlayerBuildableVehicleType(v) ||
|
if (!IsPlayerBuildableVehicleType(v) ||
|
||||||
(v->IsPrimaryVehicle() && v->current_order.type == OT_NOTHING)) {
|
(v->IsPrimaryVehicle() && v->current_order.IsType(OT_NOTHING))) {
|
||||||
v->current_order.type = OT_DUMMY;
|
v->current_order.MakeDummy();
|
||||||
}
|
}
|
||||||
|
|
||||||
FOR_ALL_VEHICLES_FROM(u, v->index + 1) {
|
FOR_ALL_VEHICLES_FROM(u, v->index + 1) {
|
||||||
|
|
|
@ -2178,7 +2178,7 @@ bool AfterLoadGame()
|
||||||
FOR_ALL_VEHICLES(v) {
|
FOR_ALL_VEHICLES(v) {
|
||||||
if ((v->type != VEH_TRAIN || IsFrontEngine(v)) && // for all locs
|
if ((v->type != VEH_TRAIN || IsFrontEngine(v)) && // for all locs
|
||||||
!(v->vehstatus & (VS_STOPPED | VS_CRASHED)) && // not stopped or crashed
|
!(v->vehstatus & (VS_STOPPED | VS_CRASHED)) && // not stopped or crashed
|
||||||
v->current_order.type == OT_LOADING) { // loading
|
v->current_order.IsType(OT_LOADING)) { // loading
|
||||||
GetStation(v->last_station_visited)->loading_vehicles.push_back(v);
|
GetStation(v->last_station_visited)->loading_vehicles.push_back(v);
|
||||||
|
|
||||||
/* The loading finished flag is *only* set when actually completely
|
/* The loading finished flag is *only* set when actually completely
|
||||||
|
@ -2195,7 +2195,7 @@ bool AfterLoadGame()
|
||||||
for (iter = st->loading_vehicles.begin(); iter != st->loading_vehicles.end();) {
|
for (iter = st->loading_vehicles.begin(); iter != st->loading_vehicles.end();) {
|
||||||
Vehicle *v = *iter;
|
Vehicle *v = *iter;
|
||||||
iter++;
|
iter++;
|
||||||
if (v->current_order.type != OT_LOADING) st->loading_vehicles.remove(v);
|
if (!v->current_order.IsType(OT_LOADING)) st->loading_vehicles.remove(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2307,7 +2307,7 @@ bool AfterLoadGame()
|
||||||
/* Update go to buoy orders because they are just waypoints */
|
/* Update go to buoy orders because they are just waypoints */
|
||||||
Order *order;
|
Order *order;
|
||||||
FOR_ALL_ORDERS(order) {
|
FOR_ALL_ORDERS(order) {
|
||||||
if (order->type == OT_GOTO_STATION && GetStation(order->dest)->IsBuoy()) {
|
if (order->IsType(OT_GOTO_STATION) && GetStation(order->dest)->IsBuoy()) {
|
||||||
order->flags = 0;
|
order->flags = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,10 @@
|
||||||
#include "oldpool.h"
|
#include "oldpool.h"
|
||||||
#include "core/bitmath_func.hpp"
|
#include "core/bitmath_func.hpp"
|
||||||
#include "cargo_type.h"
|
#include "cargo_type.h"
|
||||||
|
#include "depot_type.h"
|
||||||
#include "station_type.h"
|
#include "station_type.h"
|
||||||
#include "vehicle_type.h"
|
#include "vehicle_type.h"
|
||||||
|
#include "waypoint_type.h"
|
||||||
|
|
||||||
DECLARE_OLD_POOL(Order, Order, 6, 1000)
|
DECLARE_OLD_POOL(Order, Order, 6, 1000)
|
||||||
|
|
||||||
|
@ -20,9 +22,20 @@ DECLARE_OLD_POOL(Order, Order, 6, 1000)
|
||||||
* - REF_ORDER (all REFs are currently limited to 16 bits!!)
|
* - REF_ORDER (all REFs are currently limited to 16 bits!!)
|
||||||
*/
|
*/
|
||||||
struct Order : PoolItem<Order, OrderID, &_Order_pool> {
|
struct Order : PoolItem<Order, OrderID, &_Order_pool> {
|
||||||
Order *next; ///< Pointer to next order. If NULL, end of list
|
private:
|
||||||
|
friend const struct SaveLoad *GetVehicleDescription(VehicleType vt); ///< Saving and loading the current order of vehicles.
|
||||||
|
friend void Load_VEHS(); ///< Loading of ancient vehicles.
|
||||||
|
friend const struct SaveLoad *GetOrderDescription(); ///< Saving and loading of orders.
|
||||||
|
friend uint32 PackOrder(const Order *order); ///< 'Compressing' an order.
|
||||||
|
friend Order UnpackOrder(uint32 packed); ///< 'Uncompressing' an order.
|
||||||
|
friend Order UnpackOldOrder(uint16 packed); ///< 'Uncompressing' a loaded old order.
|
||||||
|
friend Order UnpackVersion4Order(uint16 packed); ///< 'Uncompressing' a loaded ancient order.
|
||||||
|
|
||||||
OrderTypeByte type;
|
OrderTypeByte type;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Order *next; ///< Pointer to next order. If NULL, end of list
|
||||||
|
|
||||||
uint8 flags;
|
uint8 flags;
|
||||||
DestinationID dest; ///< The destionation of the order.
|
DestinationID dest; ///< The destionation of the order.
|
||||||
|
|
||||||
|
@ -37,15 +50,63 @@ struct Order : PoolItem<Order, OrderID, &_Order_pool> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a Order really exists.
|
* Check if a Order really exists.
|
||||||
|
* @return true if the order is valid.
|
||||||
*/
|
*/
|
||||||
inline bool IsValid() const { return this->type != OT_NOTHING; }
|
inline bool IsValid() const { return this->type != OT_NOTHING; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether this order is of the given type.
|
||||||
|
* @param type the type to check against.
|
||||||
|
* @return true if the order matches.
|
||||||
|
*/
|
||||||
|
inline bool IsType(OrderType type) const { return this->type == type; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the type of order of this order.
|
||||||
|
* @return the order type.
|
||||||
|
*/
|
||||||
|
inline OrderType GetType() const { return this->type; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 'Free' the order
|
* 'Free' the order
|
||||||
* @note ONLY use on "current_order" vehicle orders!
|
* @note ONLY use on "current_order" vehicle orders!
|
||||||
*/
|
*/
|
||||||
void Free();
|
void Free();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes this order a Go To Station order.
|
||||||
|
* @param destsination the station to go to.
|
||||||
|
*/
|
||||||
|
void MakeGoToStation(StationID destination);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes this order a Go To Depot order.
|
||||||
|
* @param destination the depot to go to.
|
||||||
|
* @param order is this order a 'default' order, or an overriden vehicle order?
|
||||||
|
*/
|
||||||
|
void MakeGoToDepot(DepotID destination, bool order);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes this order a Go To Waypoint order.
|
||||||
|
* @param destination the waypoint to go to.
|
||||||
|
*/
|
||||||
|
void MakeGoToWaypoint(WaypointID destination);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes this order a Loading order.
|
||||||
|
*/
|
||||||
|
void MakeLoading();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes this order a Leave Station order.
|
||||||
|
*/
|
||||||
|
void MakeLeaveStation();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes this order a Dummy order.
|
||||||
|
*/
|
||||||
|
void MakeDummy();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free a complete order chain.
|
* Free a complete order chain.
|
||||||
* @note do not use on "current_order" vehicle orders!
|
* @note do not use on "current_order" vehicle orders!
|
||||||
|
|
|
@ -48,6 +48,46 @@ void Order::Free()
|
||||||
this->next = NULL;
|
this->next = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Order::MakeGoToStation(StationID destination)
|
||||||
|
{
|
||||||
|
this->type = OT_GOTO_STATION;
|
||||||
|
this->flags = 0;
|
||||||
|
this->dest = destination;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Order::MakeGoToDepot(DepotID destination, bool order)
|
||||||
|
{
|
||||||
|
this->type = OT_GOTO_DEPOT;
|
||||||
|
this->flags = order ? OFB_PART_OF_ORDERS : OFB_NON_STOP;
|
||||||
|
this->dest = destination;
|
||||||
|
this->refit_cargo = CT_NO_REFIT;
|
||||||
|
this->refit_subtype = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Order::MakeGoToWaypoint(WaypointID destination)
|
||||||
|
{
|
||||||
|
this->type = OT_GOTO_WAYPOINT;
|
||||||
|
this->flags = 0;
|
||||||
|
this->dest = destination;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Order::MakeLoading()
|
||||||
|
{
|
||||||
|
this->type = OT_LOADING;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Order::MakeLeaveStation()
|
||||||
|
{
|
||||||
|
this->type = OT_LEAVESTATION;
|
||||||
|
this->flags = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Order::MakeDummy()
|
||||||
|
{
|
||||||
|
this->type = OT_DUMMY;
|
||||||
|
this->flags = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void Order::FreeChain()
|
void Order::FreeChain()
|
||||||
{
|
{
|
||||||
if (next != NULL) next->FreeChain();
|
if (next != NULL) next->FreeChain();
|
||||||
|
@ -128,7 +168,7 @@ Order UnpackOldOrder(uint16 packed)
|
||||||
* Unpacks a order from savegames with version 4 and lower
|
* Unpacks a order from savegames with version 4 and lower
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static Order UnpackVersion4Order(uint16 packed)
|
Order UnpackVersion4Order(uint16 packed)
|
||||||
{
|
{
|
||||||
Order order;
|
Order order;
|
||||||
order.type = (OrderType)GB(packed, 0, 4);
|
order.type = (OrderType)GB(packed, 0, 4);
|
||||||
|
@ -208,7 +248,7 @@ static void DeleteOrderWarnings(const Vehicle* v)
|
||||||
|
|
||||||
static TileIndex GetOrderLocation(const Order& o)
|
static TileIndex GetOrderLocation(const Order& o)
|
||||||
{
|
{
|
||||||
switch (o.type) {
|
switch (o.GetType()) {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
case OT_GOTO_STATION: return GetStation(o.dest)->xy;
|
case OT_GOTO_STATION: return GetStation(o.dest)->xy;
|
||||||
case OT_GOTO_DEPOT: return GetDepot(o.dest)->xy;
|
case OT_GOTO_DEPOT: return GetDepot(o.dest)->xy;
|
||||||
|
@ -241,7 +281,7 @@ CommandCost CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
|
|
||||||
/* Check if the inserted order is to the correct destination (owner, type),
|
/* Check if the inserted order is to the correct destination (owner, type),
|
||||||
* and has the correct flags if any */
|
* and has the correct flags if any */
|
||||||
switch (new_order.type) {
|
switch (new_order.GetType()) {
|
||||||
case OT_GOTO_STATION: {
|
case OT_GOTO_STATION: {
|
||||||
const Station *st;
|
const Station *st;
|
||||||
|
|
||||||
|
@ -401,7 +441,7 @@ CommandCost CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
* If the order is to be inserted at the beginning of the order list this
|
* If the order is to be inserted at the beginning of the order list this
|
||||||
* finds the last order in the list. */
|
* finds the last order in the list. */
|
||||||
for (const Order *o = v->orders; o != NULL; o = o->next) {
|
for (const Order *o = v->orders; o != NULL; o = o->next) {
|
||||||
if (o->type == OT_GOTO_STATION || o->type == OT_GOTO_DEPOT) prev = o;
|
if (o->IsType(OT_GOTO_STATION) || o->IsType(OT_GOTO_DEPOT)) prev = o;
|
||||||
if (++n == sel_ord && prev != NULL) break;
|
if (++n == sel_ord && prev != NULL) break;
|
||||||
}
|
}
|
||||||
if (prev != NULL) {
|
if (prev != NULL) {
|
||||||
|
@ -575,7 +615,7 @@ CommandCost CmdDeleteOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
|
|
||||||
/* NON-stop flag is misused to see if a train is in a station that is
|
/* NON-stop flag is misused to see if a train is in a station that is
|
||||||
* on his order list or not */
|
* on his order list or not */
|
||||||
if (sel_ord == u->cur_order_index && u->current_order.type == OT_LOADING &&
|
if (sel_ord == u->cur_order_index && u->current_order.IsType(OT_LOADING) &&
|
||||||
HasBit(u->current_order.flags, OF_NON_STOP)) {
|
HasBit(u->current_order.flags, OF_NON_STOP)) {
|
||||||
u->current_order.flags = 0;
|
u->current_order.flags = 0;
|
||||||
}
|
}
|
||||||
|
@ -614,7 +654,7 @@ CommandCost CmdSkipToOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
|
|
||||||
if (v->type == VEH_ROAD) ClearSlot(v);
|
if (v->type == VEH_ROAD) ClearSlot(v);
|
||||||
|
|
||||||
if (v->current_order.type == OT_LOADING) {
|
if (v->current_order.IsType(OT_LOADING)) {
|
||||||
v->LeaveStation();
|
v->LeaveStation();
|
||||||
/* NON-stop flag is misused to see if a train is in a station that is
|
/* NON-stop flag is misused to see if a train is in a station that is
|
||||||
* on his order list or not */
|
* on his order list or not */
|
||||||
|
@ -745,9 +785,9 @@ CommandCost CmdModifyOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
if (sel_ord >= v->num_orders) return CMD_ERROR;
|
if (sel_ord >= v->num_orders) return CMD_ERROR;
|
||||||
|
|
||||||
order = GetVehicleOrder(v, sel_ord);
|
order = GetVehicleOrder(v, sel_ord);
|
||||||
if ((order->type != OT_GOTO_STATION || GetStation(order->dest)->IsBuoy()) &&
|
if ((!order->IsType(OT_GOTO_STATION) || GetStation(order->dest)->IsBuoy()) &&
|
||||||
(order->type != OT_GOTO_DEPOT || p2 == OF_UNLOAD) &&
|
(!order->IsType(OT_GOTO_DEPOT) || p2 == OF_UNLOAD) &&
|
||||||
(order->type != OT_GOTO_WAYPOINT || p2 != OF_NON_STOP)) {
|
(!order->IsType(OT_GOTO_WAYPOINT) || p2 != OF_NON_STOP)) {
|
||||||
return CMD_ERROR;
|
return CMD_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -755,7 +795,7 @@ CommandCost CmdModifyOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
switch (p2) {
|
switch (p2) {
|
||||||
case OF_FULL_LOAD:
|
case OF_FULL_LOAD:
|
||||||
ToggleBit(order->flags, OF_FULL_LOAD);
|
ToggleBit(order->flags, OF_FULL_LOAD);
|
||||||
if (order->type != OT_GOTO_DEPOT) ClrBit(order->flags, OF_UNLOAD);
|
if (!order->IsType(OT_GOTO_DEPOT)) ClrBit(order->flags, OF_UNLOAD);
|
||||||
break;
|
break;
|
||||||
case OF_UNLOAD:
|
case OF_UNLOAD:
|
||||||
ToggleBit(order->flags, OF_UNLOAD);
|
ToggleBit(order->flags, OF_UNLOAD);
|
||||||
|
@ -787,7 +827,7 @@ CommandCost CmdModifyOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
* when this function is called.
|
* when this function is called.
|
||||||
*/
|
*/
|
||||||
if (sel_ord == u->cur_order_index &&
|
if (sel_ord == u->cur_order_index &&
|
||||||
u->current_order.type != OT_GOTO_DEPOT &&
|
!u->current_order.IsType(OT_GOTO_DEPOT) &&
|
||||||
HasBit(u->current_order.flags, OF_FULL_LOAD) != HasBit(order->flags, OF_FULL_LOAD)) {
|
HasBit(u->current_order.flags, OF_FULL_LOAD) != HasBit(order->flags, OF_FULL_LOAD)) {
|
||||||
ToggleBit(u->current_order.flags, OF_FULL_LOAD);
|
ToggleBit(u->current_order.flags, OF_FULL_LOAD);
|
||||||
}
|
}
|
||||||
|
@ -884,7 +924,7 @@ CommandCost CmdCloneOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
TileIndex required_dst = INVALID_TILE;
|
TileIndex required_dst = INVALID_TILE;
|
||||||
|
|
||||||
FOR_VEHICLE_ORDERS(src, order) {
|
FOR_VEHICLE_ORDERS(src, order) {
|
||||||
if (order->type == OT_GOTO_STATION) {
|
if (order->IsType(OT_GOTO_STATION)) {
|
||||||
const Station *st = GetStation(order->dest);
|
const Station *st = GetStation(order->dest);
|
||||||
if (IsCargoInClass(dst->cargo_type, CC_PASSENGERS)) {
|
if (IsCargoInClass(dst->cargo_type, CC_PASSENGERS)) {
|
||||||
if (st->bus_stops != NULL) required_dst = st->bus_stops->xy;
|
if (st->bus_stops != NULL) required_dst = st->bus_stops->xy;
|
||||||
|
@ -1162,12 +1202,12 @@ void CheckOrders(const Vehicle* v)
|
||||||
|
|
||||||
FOR_VEHICLE_ORDERS(v, order) {
|
FOR_VEHICLE_ORDERS(v, order) {
|
||||||
/* Dummy order? */
|
/* Dummy order? */
|
||||||
if (order->type == OT_DUMMY) {
|
if (order->IsType(OT_DUMMY)) {
|
||||||
problem_type = 1;
|
problem_type = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* Does station have a load-bay for this vehicle? */
|
/* Does station have a load-bay for this vehicle? */
|
||||||
if (order->type == OT_GOTO_STATION) {
|
if (order->IsType(OT_GOTO_STATION)) {
|
||||||
const Station* st = GetStation(order->dest);
|
const Station* st = GetStation(order->dest);
|
||||||
TileIndex required_tile = GetStationTileForVehicle(v, st);
|
TileIndex required_tile = GetStationTileForVehicle(v, st);
|
||||||
|
|
||||||
|
@ -1228,20 +1268,18 @@ void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination)
|
||||||
}
|
}
|
||||||
|
|
||||||
order = &v->current_order;
|
order = &v->current_order;
|
||||||
if ((v->type == VEH_AIRCRAFT && order->type == OT_GOTO_DEPOT ? OT_GOTO_STATION : order->type) == type &&
|
if ((v->type == VEH_AIRCRAFT && order->IsType(OT_GOTO_DEPOT) ? OT_GOTO_STATION : order->GetType()) == type &&
|
||||||
v->current_order.dest == destination) {
|
v->current_order.dest == destination) {
|
||||||
order->type = OT_DUMMY;
|
order->MakeDummy();
|
||||||
order->flags = 0;
|
|
||||||
InvalidateWindow(WC_VEHICLE_VIEW, v->index);
|
InvalidateWindow(WC_VEHICLE_VIEW, v->index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clear the order from the order-list */
|
/* Clear the order from the order-list */
|
||||||
invalidate = false;
|
invalidate = false;
|
||||||
FOR_VEHICLE_ORDERS(v, order) {
|
FOR_VEHICLE_ORDERS(v, order) {
|
||||||
if ((v->type == VEH_AIRCRAFT && order->type == OT_GOTO_DEPOT ? OT_GOTO_STATION : order->type) == type &&
|
if ((v->type == VEH_AIRCRAFT && order->IsType(OT_GOTO_DEPOT) ? OT_GOTO_STATION : order->GetType()) == type &&
|
||||||
order->dest == destination) {
|
order->dest == destination) {
|
||||||
order->type = OT_DUMMY;
|
order->MakeDummy();
|
||||||
order->flags = 0;
|
|
||||||
invalidate = true;
|
invalidate = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1263,7 +1301,7 @@ bool VehicleHasDepotOrders(const Vehicle *v)
|
||||||
const Order *order;
|
const Order *order;
|
||||||
|
|
||||||
FOR_VEHICLE_ORDERS(v, order) {
|
FOR_VEHICLE_ORDERS(v, order) {
|
||||||
if (order->type == OT_GOTO_DEPOT)
|
if (order->IsType(OT_GOTO_DEPOT))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1340,7 +1378,7 @@ static bool CheckForValidOrders(const Vehicle *v)
|
||||||
{
|
{
|
||||||
const Order *order;
|
const Order *order;
|
||||||
|
|
||||||
FOR_VEHICLE_ORDERS(v, order) if (order->type != OT_DUMMY) return true;
|
FOR_VEHICLE_ORDERS(v, order) if (!order->IsType(OT_DUMMY)) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1354,7 +1392,7 @@ static bool CheckForValidOrders(const Vehicle *v)
|
||||||
*/
|
*/
|
||||||
bool ProcessOrders(Vehicle *v)
|
bool ProcessOrders(Vehicle *v)
|
||||||
{
|
{
|
||||||
switch (v->current_order.type) {
|
switch (v->current_order.GetType()) {
|
||||||
case OT_GOTO_DEPOT:
|
case OT_GOTO_DEPOT:
|
||||||
/* Let a depot order in the orderlist interrupt. */
|
/* Let a depot order in the orderlist interrupt. */
|
||||||
if (!(v->current_order.flags & OFB_PART_OF_ORDERS)) return false;
|
if (!(v->current_order.flags & OFB_PART_OF_ORDERS)) return false;
|
||||||
|
@ -1382,10 +1420,10 @@ bool ProcessOrders(Vehicle *v)
|
||||||
* will be reset to nothing. (That also happens if no order, but in that case
|
* will be reset to nothing. (That also happens if no order, but in that case
|
||||||
* it won't hit the point in code where may_reverse is checked)
|
* it won't hit the point in code where may_reverse is checked)
|
||||||
*/
|
*/
|
||||||
bool may_reverse = v->current_order.type == OT_NOTHING;
|
bool may_reverse = v->current_order.IsType(OT_NOTHING);
|
||||||
|
|
||||||
/* Check if we've reached the waypoint? */
|
/* Check if we've reached the waypoint? */
|
||||||
if (v->current_order.type == OT_GOTO_WAYPOINT && v->tile == v->dest_tile) {
|
if (v->current_order.IsType(OT_GOTO_WAYPOINT) && v->tile == v->dest_tile) {
|
||||||
UpdateVehicleTimetable(v, true);
|
UpdateVehicleTimetable(v, true);
|
||||||
v->cur_order_index++;
|
v->cur_order_index++;
|
||||||
}
|
}
|
||||||
|
@ -1406,7 +1444,7 @@ bool ProcessOrders(Vehicle *v)
|
||||||
const Order *order = GetVehicleOrder(v, v->cur_order_index);
|
const Order *order = GetVehicleOrder(v, v->cur_order_index);
|
||||||
|
|
||||||
/* If no order, do nothing. */
|
/* If no order, do nothing. */
|
||||||
if (order == NULL || (v->type == VEH_AIRCRAFT && order->type == OT_DUMMY && !CheckForValidOrders(v))) {
|
if (order == NULL || (v->type == VEH_AIRCRAFT && order->IsType(OT_DUMMY) && !CheckForValidOrders(v))) {
|
||||||
if (v->type == VEH_AIRCRAFT) {
|
if (v->type == VEH_AIRCRAFT) {
|
||||||
/* Aircraft do something vastly different here, so handle separately */
|
/* Aircraft do something vastly different here, so handle separately */
|
||||||
extern void HandleMissingAircraftOrders(Vehicle *v);
|
extern void HandleMissingAircraftOrders(Vehicle *v);
|
||||||
|
@ -1422,7 +1460,7 @@ bool ProcessOrders(Vehicle *v)
|
||||||
|
|
||||||
/* If it is unchanged, keep it. */
|
/* If it is unchanged, keep it. */
|
||||||
if (order->Equals(v->current_order) &&
|
if (order->Equals(v->current_order) &&
|
||||||
(v->type != VEH_SHIP || order->type != OT_GOTO_STATION || GetStation(order->dest)->dock_tile != 0)) {
|
(v->type != VEH_SHIP || !order->IsType(OT_GOTO_STATION) || GetStation(order->dest)->dock_tile != 0)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1444,7 +1482,7 @@ bool ProcessOrders(Vehicle *v)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (order->type) {
|
switch (order->GetType()) {
|
||||||
case OT_GOTO_STATION:
|
case OT_GOTO_STATION:
|
||||||
v->dest_tile = v->GetOrderStationLocation(order->dest);
|
v->dest_tile = v->GetOrderStationLocation(order->dest);
|
||||||
break;
|
break;
|
||||||
|
@ -1490,6 +1528,7 @@ void InitializeOrders()
|
||||||
_backup_orders_tile = 0;
|
_backup_orders_tile = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SaveLoad *GetOrderDescription() {
|
||||||
static const SaveLoad _order_desc[] = {
|
static const SaveLoad _order_desc[] = {
|
||||||
SLE_VAR(Order, type, SLE_UINT8),
|
SLE_VAR(Order, type, SLE_UINT8),
|
||||||
SLE_VAR(Order, flags, SLE_UINT8),
|
SLE_VAR(Order, flags, SLE_UINT8),
|
||||||
|
@ -1505,6 +1544,8 @@ static const SaveLoad _order_desc[] = {
|
||||||
SLE_CONDNULL(10, 5, 35),
|
SLE_CONDNULL(10, 5, 35),
|
||||||
SLE_END()
|
SLE_END()
|
||||||
};
|
};
|
||||||
|
return _order_desc;
|
||||||
|
}
|
||||||
|
|
||||||
static void Save_ORDR()
|
static void Save_ORDR()
|
||||||
{
|
{
|
||||||
|
@ -1512,7 +1553,7 @@ static void Save_ORDR()
|
||||||
|
|
||||||
FOR_ALL_ORDERS(order) {
|
FOR_ALL_ORDERS(order) {
|
||||||
SlSetArrayIndex(order->index);
|
SlSetArrayIndex(order->index);
|
||||||
SlObject(order, _order_desc);
|
SlObject(order, GetOrderDescription());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1565,7 +1606,7 @@ static void Load_ORDR()
|
||||||
|
|
||||||
while ((index = SlIterateArray()) != -1) {
|
while ((index = SlIterateArray()) != -1) {
|
||||||
Order *order = new (index) Order();
|
Order *order = new (index) Order();
|
||||||
SlObject(order, _order_desc);
|
SlObject(order, GetOrderDescription());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ static void DrawOrdersWindow(Window *w)
|
||||||
w->ShowWidget(ORDER_WIDGET_UNLOAD); // Unload
|
w->ShowWidget(ORDER_WIDGET_UNLOAD); // Unload
|
||||||
|
|
||||||
if (order != NULL) {
|
if (order != NULL) {
|
||||||
switch (order->type) {
|
switch (order->GetType()) {
|
||||||
case OT_GOTO_STATION:
|
case OT_GOTO_STATION:
|
||||||
if (!GetStation(order->dest)->IsBuoy()) break;
|
if (!GetStation(order->dest)->IsBuoy()) break;
|
||||||
/* Fall-through */
|
/* Fall-through */
|
||||||
|
@ -194,7 +194,7 @@ static void DrawOrdersWindow(Window *w)
|
||||||
if (i - w->vscroll.pos < w->vscroll.cap) {
|
if (i - w->vscroll.pos < w->vscroll.cap) {
|
||||||
SetDParam(1, 6);
|
SetDParam(1, 6);
|
||||||
|
|
||||||
switch (order->type) {
|
switch (order->GetType()) {
|
||||||
case OT_DUMMY:
|
case OT_DUMMY:
|
||||||
SetDParam(1, STR_INVALID_ORDER);
|
SetDParam(1, STR_INVALID_ORDER);
|
||||||
SetDParam(2, order->dest);
|
SetDParam(2, order->dest);
|
||||||
|
@ -272,9 +272,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
|
||||||
case MP_RAILWAY:
|
case MP_RAILWAY:
|
||||||
if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_player)) {
|
if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_player)) {
|
||||||
if (IsRailDepot(tile)) {
|
if (IsRailDepot(tile)) {
|
||||||
order.type = OT_GOTO_DEPOT;
|
order.MakeGoToDepot(GetDepotByTile(tile)->index, true);
|
||||||
order.flags = OFB_PART_OF_ORDERS;
|
|
||||||
order.dest = GetDepotByTile(tile)->index;
|
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -282,9 +280,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
|
||||||
|
|
||||||
case MP_ROAD:
|
case MP_ROAD:
|
||||||
if (IsRoadDepot(tile) && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) {
|
if (IsRoadDepot(tile) && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) {
|
||||||
order.type = OT_GOTO_DEPOT;
|
order.MakeGoToDepot(GetDepotByTile(tile)->index, true);
|
||||||
order.flags = OFB_PART_OF_ORDERS;
|
|
||||||
order.dest = GetDepotByTile(tile)->index;
|
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -292,9 +288,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
|
||||||
case MP_STATION:
|
case MP_STATION:
|
||||||
if (v->type != VEH_AIRCRAFT) break;
|
if (v->type != VEH_AIRCRAFT) break;
|
||||||
if (IsHangar(tile) && IsTileOwner(tile, _local_player)) {
|
if (IsHangar(tile) && IsTileOwner(tile, _local_player)) {
|
||||||
order.type = OT_GOTO_DEPOT;
|
order.MakeGoToDepot(GetStationIndex(tile), true);
|
||||||
order.flags = OFB_PART_OF_ORDERS;
|
|
||||||
order.dest = GetStationIndex(tile);
|
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -305,9 +299,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
|
||||||
IsTileOwner(tile, _local_player)) {
|
IsTileOwner(tile, _local_player)) {
|
||||||
TileIndex tile2 = GetOtherShipDepotTile(tile);
|
TileIndex tile2 = GetOtherShipDepotTile(tile);
|
||||||
|
|
||||||
order.type = OT_GOTO_DEPOT;
|
order.MakeGoToDepot(GetDepotByTile(tile < tile2 ? tile : tile2)->index, true);
|
||||||
order.flags = OFB_PART_OF_ORDERS;
|
|
||||||
order.dest = GetDepotByTile(tile < tile2 ? tile : tile2)->index;
|
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,9 +313,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
|
||||||
v->type == VEH_TRAIN &&
|
v->type == VEH_TRAIN &&
|
||||||
IsTileOwner(tile, _local_player) &&
|
IsTileOwner(tile, _local_player) &&
|
||||||
IsRailWaypoint(tile)) {
|
IsRailWaypoint(tile)) {
|
||||||
order.type = OT_GOTO_WAYPOINT;
|
order.MakeGoToWaypoint(GetWaypointByTile(tile)->index);
|
||||||
order.flags = 0;
|
|
||||||
order.dest = GetWaypointByTile(tile)->index;
|
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,9 +329,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
|
||||||
(facil=FACIL_BUS_STOP, v->type == VEH_ROAD && IsCargoInClass(v->cargo_type, CC_PASSENGERS)) ||
|
(facil=FACIL_BUS_STOP, v->type == VEH_ROAD && IsCargoInClass(v->cargo_type, CC_PASSENGERS)) ||
|
||||||
(facil=FACIL_TRUCK_STOP, 1);
|
(facil=FACIL_TRUCK_STOP, 1);
|
||||||
if (st->facilities & facil) {
|
if (st->facilities & facil) {
|
||||||
order.type = OT_GOTO_STATION;
|
order.MakeGoToStation(st_index);
|
||||||
order.flags = 0;
|
|
||||||
order.dest = st_index;
|
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -576,7 +564,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e)
|
||||||
const Order *ord = GetVehicleOrder(v, sel);
|
const Order *ord = GetVehicleOrder(v, sel);
|
||||||
TileIndex xy;
|
TileIndex xy;
|
||||||
|
|
||||||
switch (ord->type) {
|
switch (ord->GetType()) {
|
||||||
case OT_GOTO_STATION: xy = GetStation(ord->dest)->xy ; break;
|
case OT_GOTO_STATION: xy = GetStation(ord->dest)->xy ; break;
|
||||||
case OT_GOTO_DEPOT: xy = (v->type == VEH_AIRCRAFT) ? GetStation(ord->dest)->xy : GetDepot(ord->dest)->xy; break;
|
case OT_GOTO_DEPOT: xy = (v->type == VEH_AIRCRAFT) ? GetStation(ord->dest)->xy : GetDepot(ord->dest)->xy; break;
|
||||||
case OT_GOTO_WAYPOINT: xy = GetWaypoint(ord->dest)->xy; break;
|
case OT_GOTO_WAYPOINT: xy = GetWaypoint(ord->dest)->xy; break;
|
||||||
|
@ -691,7 +679,7 @@ static void OrdersWndProc(Window *w, WindowEvent *e)
|
||||||
int s = OrderGetSel(w);
|
int s = OrderGetSel(w);
|
||||||
|
|
||||||
if (e->we.click.widget != ORDER_WIDGET_FULL_LOAD) break;
|
if (e->we.click.widget != ORDER_WIDGET_FULL_LOAD) break;
|
||||||
if (s == v->num_orders || GetVehicleOrder(v, s)->type != OT_GOTO_DEPOT) {
|
if (s == v->num_orders || !GetVehicleOrder(v, s)->IsType(OT_GOTO_DEPOT)) {
|
||||||
GuiShowTooltips(STR_8857_MAKE_THE_HIGHLIGHTED_ORDER);
|
GuiShowTooltips(STR_8857_MAKE_THE_HIGHLIGHTED_ORDER);
|
||||||
} else {
|
} else {
|
||||||
GuiShowTooltips(STR_SERVICE_HINT);
|
GuiShowTooltips(STR_SERVICE_HINT);
|
||||||
|
|
|
@ -476,7 +476,7 @@ CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint3
|
||||||
if (v->IsInDepot()) return CMD_ERROR;
|
if (v->IsInDepot()) return CMD_ERROR;
|
||||||
|
|
||||||
/* If the current orders are already goto-depot */
|
/* If the current orders are already goto-depot */
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT) {
|
if (v->current_order.IsType(OT_GOTO_DEPOT)) {
|
||||||
if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OF_HALT_IN_DEPOT)) {
|
if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OF_HALT_IN_DEPOT)) {
|
||||||
/* We called with a different DEPOT_SERVICE setting.
|
/* We called with a different DEPOT_SERVICE setting.
|
||||||
* Now we change the setting to apply the new one and let the vehicle head for the same depot.
|
* Now we change the setting to apply the new one and let the vehicle head for the same depot.
|
||||||
|
@ -496,8 +496,7 @@ CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint3
|
||||||
if (HasBit(v->current_order.flags, OF_PART_OF_ORDERS))
|
if (HasBit(v->current_order.flags, OF_PART_OF_ORDERS))
|
||||||
v->cur_order_index++;
|
v->cur_order_index++;
|
||||||
|
|
||||||
v->current_order.type = OT_DUMMY;
|
v->current_order.MakeDummy();
|
||||||
v->current_order.flags = 0;
|
|
||||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
||||||
}
|
}
|
||||||
return CommandCost();
|
return CommandCost();
|
||||||
|
@ -507,14 +506,11 @@ CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint3
|
||||||
if (dep == NULL) return_cmd_error(STR_9019_UNABLE_TO_FIND_LOCAL_DEPOT);
|
if (dep == NULL) return_cmd_error(STR_9019_UNABLE_TO_FIND_LOCAL_DEPOT);
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
if (v->current_order.type == OT_LOADING) v->LeaveStation();
|
if (v->current_order.IsType(OT_LOADING)) v->LeaveStation();
|
||||||
|
|
||||||
ClearSlot(v);
|
ClearSlot(v);
|
||||||
v->current_order.type = OT_GOTO_DEPOT;
|
v->current_order.MakeGoToDepot(dep->index, false);
|
||||||
v->current_order.flags = OFB_NON_STOP;
|
|
||||||
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
|
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
|
||||||
v->current_order.refit_cargo = CT_INVALID;
|
|
||||||
v->current_order.dest = dep->index;
|
|
||||||
v->dest_tile = dep->xy;
|
v->dest_tile = dep->xy;
|
||||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
||||||
}
|
}
|
||||||
|
@ -1757,8 +1753,8 @@ again:
|
||||||
/* Vehicle is at the stop position (at a bay) in a road stop.
|
/* Vehicle is at the stop position (at a bay) in a road stop.
|
||||||
* Note, if vehicle is loading/unloading it has already been handled,
|
* Note, if vehicle is loading/unloading it has already been handled,
|
||||||
* so if we get here the vehicle has just arrived or is just ready to leave. */
|
* so if we get here the vehicle has just arrived or is just ready to leave. */
|
||||||
if (v->current_order.type != OT_LEAVESTATION &&
|
if (!v->current_order.IsType(OT_LEAVESTATION) &&
|
||||||
v->current_order.type != OT_GOTO_DEPOT) {
|
!v->current_order.IsType(OT_GOTO_DEPOT)) {
|
||||||
/* Vehicle has arrived at a bay in a road stop */
|
/* Vehicle has arrived at a bay in a road stop */
|
||||||
|
|
||||||
if (IsDriveThroughStopTile(v->tile)) {
|
if (IsDriveThroughStopTile(v->tile)) {
|
||||||
|
@ -1795,7 +1791,7 @@ again:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Vehicle is ready to leave a bay in a road stop */
|
/* Vehicle is ready to leave a bay in a road stop */
|
||||||
if (v->current_order.type != OT_GOTO_DEPOT) {
|
if (!v->current_order.IsType(OT_GOTO_DEPOT)) {
|
||||||
if (rs->IsEntranceBusy()) {
|
if (rs->IsEntranceBusy()) {
|
||||||
/* Road stop entrance is busy, so wait as there is nowhere else to go */
|
/* Road stop entrance is busy, so wait as there is nowhere else to go */
|
||||||
v->cur_speed = 0;
|
v->cur_speed = 0;
|
||||||
|
@ -1821,8 +1817,8 @@ again:
|
||||||
if (v->dest_tile != v->u.road.slot->xy) {
|
if (v->dest_tile != v->u.road.slot->xy) {
|
||||||
DEBUG(ms, 2, " stop tile 0x%X is not destination tile 0x%X. Multistop desync", v->u.road.slot->xy, v->dest_tile);
|
DEBUG(ms, 2, " stop tile 0x%X is not destination tile 0x%X. Multistop desync", v->u.road.slot->xy, v->dest_tile);
|
||||||
}
|
}
|
||||||
if (v->current_order.type != OT_GOTO_STATION) {
|
if (!v->current_order.IsType(OT_GOTO_STATION)) {
|
||||||
DEBUG(ms, 2, " current order type (%d) is not OT_GOTO_STATION", v->current_order.type);
|
DEBUG(ms, 2, " current order type (%d) is not OT_GOTO_STATION", v->current_order.GetType());
|
||||||
} else {
|
} else {
|
||||||
if (v->current_order.dest != st->index)
|
if (v->current_order.dest != st->index)
|
||||||
DEBUG(ms, 2, " current station %d is not target station in current_order.station (%d)",
|
DEBUG(ms, 2, " current station %d is not target station in current_order.station (%d)",
|
||||||
|
@ -1884,7 +1880,7 @@ static void RoadVehController(Vehicle *v)
|
||||||
ProcessOrders(v);
|
ProcessOrders(v);
|
||||||
v->HandleLoading();
|
v->HandleLoading();
|
||||||
|
|
||||||
if (v->current_order.type == OT_LOADING) return;
|
if (v->current_order.IsType(OT_LOADING)) return;
|
||||||
|
|
||||||
if (v->IsInDepot() && RoadVehLeaveDepot(v, true)) return;
|
if (v->IsInDepot() && RoadVehLeaveDepot(v, true)) return;
|
||||||
|
|
||||||
|
@ -1925,26 +1921,23 @@ static void CheckIfRoadVehNeedsService(Vehicle *v)
|
||||||
const Depot *depot = FindClosestRoadDepot(v);
|
const Depot *depot = FindClosestRoadDepot(v);
|
||||||
|
|
||||||
if (depot == NULL || DistanceManhattan(v->tile, depot->xy) > 12) {
|
if (depot == NULL || DistanceManhattan(v->tile, depot->xy) > 12) {
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT) {
|
if (v->current_order.IsType(OT_GOTO_DEPOT)) {
|
||||||
v->current_order.type = OT_DUMMY;
|
v->current_order.MakeDummy();
|
||||||
v->current_order.flags = 0;
|
|
||||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT &&
|
if (v->current_order.IsType(OT_GOTO_DEPOT) &&
|
||||||
v->current_order.flags & OFB_NON_STOP &&
|
v->current_order.flags & OFB_NON_STOP &&
|
||||||
!Chance16(1, 20)) {
|
!Chance16(1, 20)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v->current_order.type == OT_LOADING) v->LeaveStation();
|
if (v->current_order.IsType(OT_LOADING)) v->LeaveStation();
|
||||||
ClearSlot(v);
|
ClearSlot(v);
|
||||||
|
|
||||||
v->current_order.type = OT_GOTO_DEPOT;
|
v->current_order.MakeGoToDepot(depot->index, false);
|
||||||
v->current_order.flags = OFB_NON_STOP;
|
|
||||||
v->current_order.dest = depot->index;
|
|
||||||
v->dest_tile = depot->xy;
|
v->dest_tile = depot->xy;
|
||||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
||||||
}
|
}
|
||||||
|
@ -1962,14 +1955,14 @@ void RoadVehicle::OnNewDay()
|
||||||
CheckOrders(this);
|
CheckOrders(this);
|
||||||
|
|
||||||
/* Current slot has expired */
|
/* Current slot has expired */
|
||||||
if (this->current_order.type == OT_GOTO_STATION && this->u.road.slot != NULL && this->u.road.slot_age-- == 0) {
|
if (this->current_order.IsType(OT_GOTO_STATION) && this->u.road.slot != NULL && this->u.road.slot_age-- == 0) {
|
||||||
DEBUG(ms, 3, "Slot expired for vehicle %d (index %d) at stop 0x%X",
|
DEBUG(ms, 3, "Slot expired for vehicle %d (index %d) at stop 0x%X",
|
||||||
this->unitnumber, this->index, this->u.road.slot->xy);
|
this->unitnumber, this->index, this->u.road.slot->xy);
|
||||||
ClearSlot(this);
|
ClearSlot(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update destination */
|
/* update destination */
|
||||||
if (!(this->vehstatus & VS_STOPPED) && this->current_order.type == OT_GOTO_STATION && this->u.road.slot == NULL && !(this->vehstatus & VS_CRASHED)) {
|
if (!(this->vehstatus & VS_STOPPED) && this->current_order.IsType(OT_GOTO_STATION) && this->u.road.slot == NULL && !(this->vehstatus & VS_CRASHED)) {
|
||||||
Station *st = GetStation(this->current_order.dest);
|
Station *st = GetStation(this->current_order.dest);
|
||||||
RoadStop *rs = st->GetPrimaryRoadStop(this);
|
RoadStop *rs = st->GetPrimaryRoadStop(this);
|
||||||
RoadStop *best = NULL;
|
RoadStop *best = NULL;
|
||||||
|
|
|
@ -153,17 +153,14 @@ static void CheckIfShipNeedsService(Vehicle *v)
|
||||||
const Depot *depot = FindClosestShipDepot(v);
|
const Depot *depot = FindClosestShipDepot(v);
|
||||||
|
|
||||||
if (depot == NULL || DistanceManhattan(v->tile, depot->xy) > 12) {
|
if (depot == NULL || DistanceManhattan(v->tile, depot->xy) > 12) {
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT) {
|
if (v->current_order.IsType(OT_GOTO_DEPOT)) {
|
||||||
v->current_order.type = OT_DUMMY;
|
v->current_order.MakeDummy();
|
||||||
v->current_order.flags = 0;
|
|
||||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
v->current_order.type = OT_GOTO_DEPOT;
|
v->current_order.MakeGoToDepot(depot->index, false);
|
||||||
v->current_order.flags = OFB_NON_STOP;
|
|
||||||
v->current_order.dest = depot->index;
|
|
||||||
v->dest_tile = depot->xy;
|
v->dest_tile = depot->xy;
|
||||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
||||||
}
|
}
|
||||||
|
@ -604,7 +601,7 @@ static void ShipController(Vehicle *v)
|
||||||
ProcessOrders(v);
|
ProcessOrders(v);
|
||||||
v->HandleLoading();
|
v->HandleLoading();
|
||||||
|
|
||||||
if (v->current_order.type == OT_LOADING) return;
|
if (v->current_order.IsType(OT_LOADING)) return;
|
||||||
|
|
||||||
CheckShipLeaveDepot(v);
|
CheckShipLeaveDepot(v);
|
||||||
|
|
||||||
|
@ -625,40 +622,38 @@ static void ShipController(Vehicle *v)
|
||||||
|
|
||||||
/* A leave station order only needs one tick to get processed, so we can
|
/* A leave station order only needs one tick to get processed, so we can
|
||||||
* always skip ahead. */
|
* always skip ahead. */
|
||||||
if (v->current_order.type == OT_LEAVESTATION) {
|
if (v->current_order.IsType(OT_LEAVESTATION)) {
|
||||||
v->current_order.Free();
|
v->current_order.Free();
|
||||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
||||||
} else if (v->dest_tile != 0) {
|
} else if (v->dest_tile != 0) {
|
||||||
/* We have a target, let's see if we reached it... */
|
/* We have a target, let's see if we reached it... */
|
||||||
if (v->current_order.type == OT_GOTO_STATION &&
|
if (v->current_order.IsType(OT_GOTO_STATION) &&
|
||||||
IsBuoyTile(v->dest_tile) &&
|
IsBuoyTile(v->dest_tile) &&
|
||||||
DistanceManhattan(v->dest_tile, gp.new_tile) <= 3) {
|
DistanceManhattan(v->dest_tile, gp.new_tile) <= 3) {
|
||||||
/* We got within 3 tiles of our target buoy, so let's skip to our
|
/* We got within 3 tiles of our target buoy, so let's skip to our
|
||||||
* next order */
|
* next order */
|
||||||
UpdateVehicleTimetable(v, true);
|
UpdateVehicleTimetable(v, true);
|
||||||
v->cur_order_index++;
|
v->cur_order_index++;
|
||||||
v->current_order.type = OT_DUMMY;
|
v->current_order.MakeDummy();
|
||||||
InvalidateVehicleOrder(v);
|
InvalidateVehicleOrder(v);
|
||||||
} else {
|
} else {
|
||||||
/* Non-buoy orders really need to reach the tile */
|
/* Non-buoy orders really need to reach the tile */
|
||||||
if (v->dest_tile == gp.new_tile) {
|
if (v->dest_tile == gp.new_tile) {
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT) {
|
if (v->current_order.IsType(OT_GOTO_DEPOT)) {
|
||||||
if ((gp.x & 0xF) == 8 && (gp.y & 0xF) == 8) {
|
if ((gp.x & 0xF) == 8 && (gp.y & 0xF) == 8) {
|
||||||
VehicleEnterDepot(v);
|
VehicleEnterDepot(v);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (v->current_order.type == OT_GOTO_STATION) {
|
} else if (v->current_order.IsType(OT_GOTO_STATION)) {
|
||||||
Station *st;
|
|
||||||
|
|
||||||
v->last_station_visited = v->current_order.dest;
|
v->last_station_visited = v->current_order.dest;
|
||||||
|
|
||||||
/* Process station in the orderlist. */
|
/* 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
|
if (st->facilities & FACIL_DOCK) { // ugly, ugly workaround for problem with ships able to drop off cargo at wrong stations
|
||||||
ShipArrivesAt(v, st);
|
ShipArrivesAt(v, st);
|
||||||
v->BeginLoading();
|
v->BeginLoading();
|
||||||
} else { // leave stations without docks right aways
|
} else { // leave stations without docks right aways
|
||||||
v->current_order.type = OT_LEAVESTATION;
|
v->current_order.MakeLeaveStation();
|
||||||
v->cur_order_index++;
|
v->cur_order_index++;
|
||||||
InvalidateVehicleOrder(v);
|
InvalidateVehicleOrder(v);
|
||||||
}
|
}
|
||||||
|
@ -947,7 +942,7 @@ CommandCost CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
|
||||||
if (v->IsInDepot()) return CMD_ERROR;
|
if (v->IsInDepot()) return CMD_ERROR;
|
||||||
|
|
||||||
/* If the current orders are already goto-depot */
|
/* If the current orders are already goto-depot */
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT) {
|
if (v->current_order.IsType(OT_GOTO_DEPOT)) {
|
||||||
if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OF_HALT_IN_DEPOT)) {
|
if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OF_HALT_IN_DEPOT)) {
|
||||||
/* We called with a different DEPOT_SERVICE setting.
|
/* We called with a different DEPOT_SERVICE setting.
|
||||||
* Now we change the setting to apply the new one and let the vehicle head for the same depot.
|
* Now we change the setting to apply the new one and let the vehicle head for the same depot.
|
||||||
|
@ -967,8 +962,7 @@ CommandCost CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
|
||||||
if (HasBit(v->current_order.flags, OF_PART_OF_ORDERS))
|
if (HasBit(v->current_order.flags, OF_PART_OF_ORDERS))
|
||||||
v->cur_order_index++;
|
v->cur_order_index++;
|
||||||
|
|
||||||
v->current_order.type = OT_DUMMY;
|
v->current_order.MakeDummy();
|
||||||
v->current_order.flags = 0;
|
|
||||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
||||||
}
|
}
|
||||||
return CommandCost();
|
return CommandCost();
|
||||||
|
@ -978,14 +972,11 @@ CommandCost CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
|
||||||
if (dep == NULL) return_cmd_error(STR_981A_UNABLE_TO_FIND_LOCAL_DEPOT);
|
if (dep == NULL) return_cmd_error(STR_981A_UNABLE_TO_FIND_LOCAL_DEPOT);
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
if (v->current_order.type == OT_LOADING) v->LeaveStation();
|
if (v->current_order.IsType(OT_LOADING)) v->LeaveStation();
|
||||||
|
|
||||||
v->dest_tile = dep->xy;
|
v->dest_tile = dep->xy;
|
||||||
v->current_order.type = OT_GOTO_DEPOT;
|
v->current_order.MakeGoToDepot(dep->index, false);
|
||||||
v->current_order.flags = OFB_NON_STOP;
|
|
||||||
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
|
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
|
||||||
v->current_order.refit_cargo = CT_INVALID;
|
|
||||||
v->current_order.dest = dep->index;
|
|
||||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1898,7 +1898,7 @@ bool HasStationInUse(StationID station, PlayerID player)
|
||||||
if (player == INVALID_PLAYER || v->owner == player) {
|
if (player == INVALID_PLAYER || v->owner == player) {
|
||||||
const Order *order;
|
const Order *order;
|
||||||
FOR_VEHICLE_ORDERS(v, order) {
|
FOR_VEHICLE_ORDERS(v, order) {
|
||||||
if (order->type == OT_GOTO_STATION && order->dest == station) {
|
if (order->IsType(OT_GOTO_STATION) && order->dest == station) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ CommandCost CmdChangeTimetable(TileIndex tile, uint32 flags, uint32 p1, uint32 p
|
||||||
bool packed_time = HasBit(p1, 25);
|
bool packed_time = HasBit(p1, 25);
|
||||||
bool is_journey = HasBit(p1, 24) || packed_time;
|
bool is_journey = HasBit(p1, 24) || packed_time;
|
||||||
if (!is_journey) {
|
if (!is_journey) {
|
||||||
if (order->type != OT_GOTO_STATION) return_cmd_error(STR_TIMETABLE_ONLY_WAIT_AT_STATIONS);
|
if (!order->IsType(OT_GOTO_STATION)) return_cmd_error(STR_TIMETABLE_ONLY_WAIT_AT_STATIONS);
|
||||||
if (_patches.new_nonstop && (order->flags & OFB_NON_STOP)) return_cmd_error(STR_TIMETABLE_NOT_STOPPING_HERE);
|
if (_patches.new_nonstop && (order->flags & OFB_NON_STOP)) return_cmd_error(STR_TIMETABLE_NOT_STOPPING_HERE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ static void DrawTimetableWindow(Window *w)
|
||||||
w->EnableWidget(TTV_CLEAR_TIME);
|
w->EnableWidget(TTV_CLEAR_TIME);
|
||||||
} else {
|
} else {
|
||||||
const Order *order = GetVehicleOrder(v, (selected + 1) / 2);
|
const Order *order = GetVehicleOrder(v, (selected + 1) / 2);
|
||||||
bool disable = order == NULL || order->type != OT_GOTO_STATION || (_patches.new_nonstop && (order->flags & OFB_NON_STOP));
|
bool disable = order == NULL || !order->IsType(OT_GOTO_STATION) || (_patches.new_nonstop && (order->flags & OFB_NON_STOP));
|
||||||
|
|
||||||
w->SetWidgetDisabledState(TTV_CHANGE_TIME, disable);
|
w->SetWidgetDisabledState(TTV_CHANGE_TIME, disable);
|
||||||
w->SetWidgetDisabledState(TTV_CLEAR_TIME, disable);
|
w->SetWidgetDisabledState(TTV_CLEAR_TIME, disable);
|
||||||
|
@ -113,7 +113,7 @@ static void DrawTimetableWindow(Window *w)
|
||||||
if (i % 2 == 0) {
|
if (i % 2 == 0) {
|
||||||
SetDParam(2, STR_EMPTY);
|
SetDParam(2, STR_EMPTY);
|
||||||
|
|
||||||
switch (order->type) {
|
switch (order->GetType()) {
|
||||||
case OT_DUMMY:
|
case OT_DUMMY:
|
||||||
SetDParam(0, STR_INVALID_ORDER);
|
SetDParam(0, STR_INVALID_ORDER);
|
||||||
break;
|
break;
|
||||||
|
@ -197,7 +197,7 @@ static void DrawTimetableWindow(Window *w)
|
||||||
for (const Order *order = GetVehicleOrder(v, 0); order != NULL; order = order->next) {
|
for (const Order *order = GetVehicleOrder(v, 0); order != NULL; order = order->next) {
|
||||||
total_time += order->travel_time + order->wait_time;
|
total_time += order->travel_time + order->wait_time;
|
||||||
if (order->travel_time == 0) complete = false;
|
if (order->travel_time == 0) complete = false;
|
||||||
if (order->wait_time == 0 && order->type == OT_GOTO_STATION && !(_patches.new_nonstop && (order->flags & OFB_NON_STOP))) complete = false;
|
if (order->wait_time == 0 && order->IsType(OT_GOTO_STATION) && !(_patches.new_nonstop && (order->flags & OFB_NON_STOP))) complete = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (total_time != 0) {
|
if (total_time != 0) {
|
||||||
|
|
|
@ -2107,7 +2107,7 @@ CommandCost CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32
|
||||||
|
|
||||||
if (v->vehstatus & VS_CRASHED) return CMD_ERROR;
|
if (v->vehstatus & VS_CRASHED) return CMD_ERROR;
|
||||||
|
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT) {
|
if (v->current_order.IsType(OT_GOTO_DEPOT)) {
|
||||||
if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OF_HALT_IN_DEPOT)) {
|
if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OF_HALT_IN_DEPOT)) {
|
||||||
/* We called with a different DEPOT_SERVICE setting.
|
/* We called with a different DEPOT_SERVICE setting.
|
||||||
* Now we change the setting to apply the new one and let the vehicle head for the same depot.
|
* Now we change the setting to apply the new one and let the vehicle head for the same depot.
|
||||||
|
@ -2126,8 +2126,7 @@ CommandCost CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32
|
||||||
v->cur_order_index++;
|
v->cur_order_index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
v->current_order.type = OT_DUMMY;
|
v->current_order.MakeDummy();
|
||||||
v->current_order.flags = 0;
|
|
||||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
||||||
}
|
}
|
||||||
return CommandCost();
|
return CommandCost();
|
||||||
|
@ -2141,14 +2140,11 @@ CommandCost CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32
|
||||||
if (tfdd.best_length == (uint)-1) return_cmd_error(STR_883A_UNABLE_TO_FIND_ROUTE_TO);
|
if (tfdd.best_length == (uint)-1) return_cmd_error(STR_883A_UNABLE_TO_FIND_ROUTE_TO);
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
if (v->current_order.type == OT_LOADING) v->LeaveStation();
|
if (v->current_order.IsType(OT_LOADING)) v->LeaveStation();
|
||||||
|
|
||||||
v->dest_tile = tfdd.tile;
|
v->dest_tile = tfdd.tile;
|
||||||
v->current_order.type = OT_GOTO_DEPOT;
|
v->current_order.MakeGoToDepot(GetDepotByTile(tfdd.tile)->index, false);
|
||||||
v->current_order.flags = OFB_NON_STOP;
|
|
||||||
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
|
if (!(p2 & DEPOT_SERVICE)) SetBit(v->current_order.flags, OF_HALT_IN_DEPOT);
|
||||||
v->current_order.dest = GetDepotByTile(tfdd.tile)->index;
|
|
||||||
v->current_order.refit_cargo = CT_INVALID;
|
|
||||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
||||||
/* If there is no depot in front, reverse automatically */
|
/* If there is no depot in front, reverse automatically */
|
||||||
if (tfdd.reverse) DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION);
|
if (tfdd.reverse) DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION);
|
||||||
|
@ -2346,11 +2342,7 @@ static bool NtpCallbFindStation(TileIndex tile, TrainTrackFollowerData *ttfd, Tr
|
||||||
static void FillWithStationData(TrainTrackFollowerData* fd, const Vehicle* v)
|
static void FillWithStationData(TrainTrackFollowerData* fd, const Vehicle* v)
|
||||||
{
|
{
|
||||||
fd->dest_coords = v->dest_tile;
|
fd->dest_coords = v->dest_tile;
|
||||||
if (v->current_order.type == OT_GOTO_STATION) {
|
fd->station_index = v->current_order.IsType(OT_GOTO_STATION) ? v->current_order.dest : INVALID_STATION;
|
||||||
fd->station_index = v->current_order.dest;
|
|
||||||
} else {
|
|
||||||
fd->station_index = INVALID_STATION;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const byte _initial_tile_subcoord[6][4][3] = {
|
static const byte _initial_tile_subcoord[6][4][3] = {
|
||||||
|
@ -2958,7 +2950,7 @@ static void TrainController(Vehicle *v, Vehicle *nomove, bool update_image)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v->current_order.type == OT_LEAVESTATION) {
|
if (v->current_order.IsType(OT_LEAVESTATION)) {
|
||||||
v->current_order.Free();
|
v->current_order.Free();
|
||||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
||||||
}
|
}
|
||||||
|
@ -3470,7 +3462,7 @@ static void TrainLocoHandler(Vehicle *v, bool mode)
|
||||||
|
|
||||||
v->HandleLoading(mode);
|
v->HandleLoading(mode);
|
||||||
|
|
||||||
if (v->current_order.type == OT_LOADING) return;
|
if (v->current_order.IsType(OT_LOADING)) return;
|
||||||
|
|
||||||
if (CheckTrainStayInDepot(v)) return;
|
if (CheckTrainStayInDepot(v)) return;
|
||||||
|
|
||||||
|
@ -3554,12 +3546,11 @@ static void CheckIfTrainNeedsService(Vehicle *v)
|
||||||
TrainFindDepotData tfdd = FindClosestTrainDepot(v, MAX_ACCEPTABLE_DEPOT_DIST);
|
TrainFindDepotData tfdd = FindClosestTrainDepot(v, MAX_ACCEPTABLE_DEPOT_DIST);
|
||||||
/* Only go to the depot if it is not too far out of our way. */
|
/* Only go to the depot if it is not too far out of our way. */
|
||||||
if (tfdd.best_length == (uint)-1 || tfdd.best_length > MAX_ACCEPTABLE_DEPOT_DIST) {
|
if (tfdd.best_length == (uint)-1 || tfdd.best_length > MAX_ACCEPTABLE_DEPOT_DIST) {
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT) {
|
if (v->current_order.IsType(OT_GOTO_DEPOT)) {
|
||||||
/* If we were already heading for a depot but it has
|
/* If we were already heading for a depot but it has
|
||||||
* suddenly moved farther away, we continue our normal
|
* suddenly moved farther away, we continue our normal
|
||||||
* schedule? */
|
* schedule? */
|
||||||
v->current_order.type = OT_DUMMY;
|
v->current_order.MakeDummy();
|
||||||
v->current_order.flags = 0;
|
|
||||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
@ -3567,15 +3558,13 @@ static void CheckIfTrainNeedsService(Vehicle *v)
|
||||||
|
|
||||||
const Depot* depot = GetDepotByTile(tfdd.tile);
|
const Depot* depot = GetDepotByTile(tfdd.tile);
|
||||||
|
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT &&
|
if (v->current_order.IsType(OT_GOTO_DEPOT) &&
|
||||||
v->current_order.dest != depot->index &&
|
v->current_order.dest != depot->index &&
|
||||||
!Chance16(3, 16)) {
|
!Chance16(3, 16)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
v->current_order.type = OT_GOTO_DEPOT;
|
v->current_order.MakeGoToDepot(depot->index, false);
|
||||||
v->current_order.flags = OFB_NON_STOP;
|
|
||||||
v->current_order.dest = depot->index;
|
|
||||||
v->dest_tile = tfdd.tile;
|
v->dest_tile = tfdd.tile;
|
||||||
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
|
||||||
}
|
}
|
||||||
|
@ -3593,7 +3582,7 @@ void Train::OnNewDay()
|
||||||
CheckOrders(this);
|
CheckOrders(this);
|
||||||
|
|
||||||
/* update destination */
|
/* update destination */
|
||||||
if (this->current_order.type == OT_GOTO_STATION) {
|
if (this->current_order.IsType(OT_GOTO_STATION)) {
|
||||||
TileIndex tile = GetStation(this->current_order.dest)->train_tile;
|
TileIndex tile = GetStation(this->current_order.dest)->train_tile;
|
||||||
if (tile != 0) this->dest_tile = tile;
|
if (tile != 0) this->dest_tile = tile;
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,10 +120,10 @@ void VehicleServiceInDepot(Vehicle *v)
|
||||||
bool VehicleNeedsService(const Vehicle *v)
|
bool VehicleNeedsService(const Vehicle *v)
|
||||||
{
|
{
|
||||||
if (v->vehstatus & (VS_STOPPED | VS_CRASHED)) return false;
|
if (v->vehstatus & (VS_STOPPED | VS_CRASHED)) return false;
|
||||||
if (v->current_order.type != OT_GOTO_DEPOT || !(v->current_order.flags & OFB_PART_OF_ORDERS)) { // Don't interfere with a depot visit by the order list
|
if (!v->current_order.IsType(OT_GOTO_DEPOT) || !(v->current_order.flags & OFB_PART_OF_ORDERS)) { // Don't interfere with a depot visit by the order list
|
||||||
if (_patches.gotodepot && VehicleHasDepotOrders(v)) return false;
|
if (_patches.gotodepot && VehicleHasDepotOrders(v)) return false;
|
||||||
if (v->current_order.type == OT_LOADING) return false;
|
if (v->current_order.IsType(OT_LOADING)) return false;
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT && v->current_order.flags & OFB_HALT_IN_DEPOT) return false;
|
if (v->current_order.IsType(OT_GOTO_DEPOT) && v->current_order.flags & OFB_HALT_IN_DEPOT) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_patches.no_servicing_if_no_breakdowns && _opt.diff.vehicle_breakdowns == 0) {
|
if (_patches.no_servicing_if_no_breakdowns && _opt.diff.vehicle_breakdowns == 0) {
|
||||||
|
@ -631,7 +631,7 @@ void VehicleEnteredDepotThisTick(Vehicle *v)
|
||||||
{
|
{
|
||||||
/* We need to set v->leave_depot_instantly as we have no control of it's contents at this time.
|
/* We need to set v->leave_depot_instantly as we have no control of it's contents at this time.
|
||||||
* Vehicle should stop in the depot if it was in 'stopping' state - train intered depot while slowing down. */
|
* Vehicle should stop in the depot if it was in 'stopping' state - train intered depot while slowing down. */
|
||||||
if ((HasBit(v->current_order.flags, OF_HALT_IN_DEPOT) && !HasBit(v->current_order.flags, OF_PART_OF_ORDERS) && v->current_order.type == OT_GOTO_DEPOT) ||
|
if ((HasBit(v->current_order.flags, OF_HALT_IN_DEPOT) && !HasBit(v->current_order.flags, OF_PART_OF_ORDERS) && v->current_order.IsType(OT_GOTO_DEPOT)) ||
|
||||||
(v->vehstatus & VS_STOPPED)) {
|
(v->vehstatus & VS_STOPPED)) {
|
||||||
/* we keep the vehicle in the depot since the user ordered it to stay */
|
/* we keep the vehicle in the depot since the user ordered it to stay */
|
||||||
v->leave_depot_instantly = false;
|
v->leave_depot_instantly = false;
|
||||||
|
@ -2033,7 +2033,7 @@ uint GenerateVehicleSortList(const Vehicle ***sort_list, uint16 *length_of_array
|
||||||
const Order *order;
|
const Order *order;
|
||||||
|
|
||||||
FOR_VEHICLE_ORDERS(v, order) {
|
FOR_VEHICLE_ORDERS(v, order) {
|
||||||
if (order->type == OT_GOTO_STATION && order->dest == index) {
|
if (order->IsType(OT_GOTO_STATION) && order->dest == index) {
|
||||||
if (n == *length_of_array) ExtendVehicleListSize(sort_list, length_of_array, 50);
|
if (n == *length_of_array) ExtendVehicleListSize(sort_list, length_of_array, 50);
|
||||||
(*sort_list)[n++] = v;
|
(*sort_list)[n++] = v;
|
||||||
break;
|
break;
|
||||||
|
@ -2077,7 +2077,7 @@ uint GenerateVehicleSortList(const Vehicle ***sort_list, uint16 *length_of_array
|
||||||
const Order *order;
|
const Order *order;
|
||||||
|
|
||||||
FOR_VEHICLE_ORDERS(v, order) {
|
FOR_VEHICLE_ORDERS(v, order) {
|
||||||
if (order->type == OT_GOTO_DEPOT && order->dest == index) {
|
if (order->IsType(OT_GOTO_DEPOT) && order->dest == index) {
|
||||||
if (n == *length_of_array) ExtendVehicleListSize(sort_list, length_of_array, 25);
|
if (n == *length_of_array) ExtendVehicleListSize(sort_list, length_of_array, 25);
|
||||||
(*sort_list)[n++] = v;
|
(*sort_list)[n++] = v;
|
||||||
break;
|
break;
|
||||||
|
@ -2235,14 +2235,13 @@ void VehicleEnterDepot(Vehicle *v)
|
||||||
|
|
||||||
TriggerVehicle(v, VEHICLE_TRIGGER_DEPOT);
|
TriggerVehicle(v, VEHICLE_TRIGGER_DEPOT);
|
||||||
|
|
||||||
if (v->current_order.type == OT_GOTO_DEPOT) {
|
if (v->current_order.IsType(OT_GOTO_DEPOT)) {
|
||||||
Order t;
|
Order t;
|
||||||
|
|
||||||
InvalidateWindow(WC_VEHICLE_VIEW, v->index);
|
InvalidateWindow(WC_VEHICLE_VIEW, v->index);
|
||||||
|
|
||||||
t = v->current_order;
|
t = v->current_order;
|
||||||
v->current_order.type = OT_DUMMY;
|
v->current_order.MakeDummy();
|
||||||
v->current_order.flags = 0;
|
|
||||||
|
|
||||||
if (t.refit_cargo < NUM_CARGO) {
|
if (t.refit_cargo < NUM_CARGO) {
|
||||||
CommandCost cost;
|
CommandCost cost;
|
||||||
|
@ -3054,7 +3053,7 @@ static void Save_VEHS()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Will be called when vehicles need to be loaded. */
|
/** Will be called when vehicles need to be loaded. */
|
||||||
static void Load_VEHS()
|
void Load_VEHS()
|
||||||
{
|
{
|
||||||
int index;
|
int index;
|
||||||
Vehicle *v;
|
Vehicle *v;
|
||||||
|
@ -3097,7 +3096,7 @@ static void Load_VEHS()
|
||||||
if (CheckSavegameVersion(5)) {
|
if (CheckSavegameVersion(5)) {
|
||||||
/* Convert the current_order.type (which is a mix of type and flags, because
|
/* Convert the current_order.type (which is a mix of type and flags, because
|
||||||
* in those versions, they both were 4 bits big) to type and flags */
|
* in those versions, they both were 4 bits big) to type and flags */
|
||||||
v->current_order.flags = (v->current_order.type & 0xF0) >> 4;
|
v->current_order.flags = GB(v->current_order.type, 4, 4);
|
||||||
v->current_order.type.m_val &= 0x0F;
|
v->current_order.type.m_val &= 0x0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3131,7 +3130,7 @@ void Vehicle::BeginLoading()
|
||||||
{
|
{
|
||||||
assert(IsTileType(tile, MP_STATION) || type == VEH_SHIP);
|
assert(IsTileType(tile, MP_STATION) || type == VEH_SHIP);
|
||||||
|
|
||||||
if (this->current_order.type == OT_GOTO_STATION &&
|
if (this->current_order.IsType(OT_GOTO_STATION) &&
|
||||||
this->current_order.dest == this->last_station_visited) {
|
this->current_order.dest == this->last_station_visited) {
|
||||||
/* Arriving at the ordered station.
|
/* Arriving at the ordered station.
|
||||||
* Keep the load/unload flags, as we (obviously) still need them. */
|
* Keep the load/unload flags, as we (obviously) still need them. */
|
||||||
|
@ -3149,7 +3148,7 @@ void Vehicle::BeginLoading()
|
||||||
this->current_order.flags = 0;
|
this->current_order.flags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
current_order.type = OT_LOADING;
|
current_order.MakeLoading();
|
||||||
GetStation(this->last_station_visited)->loading_vehicles.push_back(this);
|
GetStation(this->last_station_visited)->loading_vehicles.push_back(this);
|
||||||
|
|
||||||
VehiclePayment(this);
|
VehiclePayment(this);
|
||||||
|
@ -3170,8 +3169,7 @@ void Vehicle::LeaveStation()
|
||||||
/* Only update the timetable if the vehicle was supposed to stop here. */
|
/* Only update the timetable if the vehicle was supposed to stop here. */
|
||||||
if (current_order.flags & OFB_NON_STOP) UpdateVehicleTimetable(this, false);
|
if (current_order.flags & OFB_NON_STOP) UpdateVehicleTimetable(this, false);
|
||||||
|
|
||||||
current_order.type = OT_LEAVESTATION;
|
current_order.MakeLeaveStation();
|
||||||
current_order.flags = 0;
|
|
||||||
GetStation(this->last_station_visited)->loading_vehicles.remove(this);
|
GetStation(this->last_station_visited)->loading_vehicles.remove(this);
|
||||||
|
|
||||||
HideFillingPercent(this->fill_percent_te_id);
|
HideFillingPercent(this->fill_percent_te_id);
|
||||||
|
@ -3181,7 +3179,7 @@ void Vehicle::LeaveStation()
|
||||||
|
|
||||||
void Vehicle::HandleLoading(bool mode)
|
void Vehicle::HandleLoading(bool mode)
|
||||||
{
|
{
|
||||||
switch (this->current_order.type) {
|
switch (this->current_order.GetType()) {
|
||||||
case OT_LOADING: {
|
case OT_LOADING: {
|
||||||
uint wait_time = max(this->current_order.wait_time - this->lateness_counter, 0);
|
uint wait_time = max(this->current_order.wait_time - this->lateness_counter, 0);
|
||||||
|
|
||||||
|
|
|
@ -917,7 +917,7 @@ void DrawSmallOrderList(const Vehicle *v, int x, int y)
|
||||||
if (sel == 0) DrawString(x - 6, y, STR_SMALL_RIGHT_ARROW, TC_BLACK);
|
if (sel == 0) DrawString(x - 6, y, STR_SMALL_RIGHT_ARROW, TC_BLACK);
|
||||||
sel--;
|
sel--;
|
||||||
|
|
||||||
if (order->type == OT_GOTO_STATION) {
|
if (order->IsType(OT_GOTO_STATION)) {
|
||||||
if (v->type == VEH_SHIP && GetStation(order->dest)->IsBuoy()) continue;
|
if (v->type == VEH_SHIP && GetStation(order->dest)->IsBuoy()) continue;
|
||||||
|
|
||||||
SetDParam(0, order->dest);
|
SetDParam(0, order->dest);
|
||||||
|
@ -1952,7 +1952,7 @@ static void DrawVehicleViewWindow(Window *w)
|
||||||
str = STR_8861_STOPPED;
|
str = STR_8861_STOPPED;
|
||||||
}
|
}
|
||||||
} else { // vehicle is in a "normal" state, show current order
|
} else { // vehicle is in a "normal" state, show current order
|
||||||
switch (v->current_order.type) {
|
switch (v->current_order.GetType()) {
|
||||||
case OT_GOTO_STATION: {
|
case OT_GOTO_STATION: {
|
||||||
SetDParam(0, v->current_order.dest);
|
SetDParam(0, v->current_order.dest);
|
||||||
SetDParam(1, v->GetDisplaySpeed());
|
SetDParam(1, v->GetDisplaySpeed());
|
||||||
|
|
|
@ -236,7 +236,7 @@ CommandCost CmdBuildTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint3
|
||||||
FOR_ALL_VEHICLES(v) {
|
FOR_ALL_VEHICLES(v) {
|
||||||
if (v->type == VEH_TRAIN &&
|
if (v->type == VEH_TRAIN &&
|
||||||
v->First() == v &&
|
v->First() == v &&
|
||||||
v->current_order.type == OT_GOTO_WAYPOINT &&
|
v->current_order.IsType(OT_GOTO_WAYPOINT) &&
|
||||||
v->dest_tile == wp->xy) {
|
v->dest_tile == wp->xy) {
|
||||||
v->dest_tile = tile;
|
v->dest_tile = tile;
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
void SetDestination(Vehicle* v)
|
void SetDestination(Vehicle* v)
|
||||||
{
|
{
|
||||||
switch (v->current_order.type) {
|
switch (v->current_order.GetType()) {
|
||||||
case OT_GOTO_STATION:
|
case OT_GOTO_STATION:
|
||||||
m_destTile = CalcStationCenterTile(v->current_order.dest);
|
m_destTile = CalcStationCenterTile(v->current_order.dest);
|
||||||
m_dest_station_id = v->current_order.dest;
|
m_dest_station_id = v->current_order.dest;
|
||||||
|
|
|
@ -84,7 +84,7 @@ public:
|
||||||
|
|
||||||
const Vehicle* v = Yapf().GetVehicle();
|
const Vehicle* v = Yapf().GetVehicle();
|
||||||
// we have reached the vehicle's destination - segment should end here to avoid target skipping
|
// we have reached the vehicle's destination - segment should end here to avoid target skipping
|
||||||
if (v->current_order.type == OT_GOTO_STATION && tile == v->dest_tile) break;
|
if (v->current_order.IsType(OT_GOTO_STATION) && tile == v->dest_tile) break;
|
||||||
|
|
||||||
// stop if we have just entered the depot
|
// stop if we have just entered the depot
|
||||||
if (IsTileDepotType(tile, TRANSPORT_ROAD) && trackdir == DiagdirToDiagTrackdir(ReverseDiagDir(GetRoadDepotDirection(tile)))) {
|
if (IsTileDepotType(tile, TRANSPORT_ROAD) && trackdir == DiagdirToDiagTrackdir(ReverseDiagDir(GetRoadDepotDirection(tile)))) {
|
||||||
|
|
Loading…
Reference in New Issue