mirror of https://github.com/OpenTTD/OpenTTD
(svn r12575) -Codechange: unduplicate Process*Orders for trains, ships and road vehicles.
parent
e9661fb420
commit
bdd64495cd
|
@ -23,6 +23,8 @@
|
||||||
#include "settings_type.h"
|
#include "settings_type.h"
|
||||||
#include "string_func.h"
|
#include "string_func.h"
|
||||||
#include "newgrf_cargo.h"
|
#include "newgrf_cargo.h"
|
||||||
|
#include "timetable.h"
|
||||||
|
#include "vehicle_func.h"
|
||||||
|
|
||||||
#include "table/strings.h"
|
#include "table/strings.h"
|
||||||
|
|
||||||
|
@ -1275,6 +1277,118 @@ Date GetServiceIntervalClamped(uint index)
|
||||||
return (_patches.servint_ispercent) ? Clamp(index, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : Clamp(index, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS);
|
return (_patches.servint_ispercent) ? Clamp(index, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : Clamp(index, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle the orders of a vehicle and determine the next place
|
||||||
|
* to go to if needed.
|
||||||
|
* @param v the vehicle to do this for.
|
||||||
|
* @return true *if* the vehicle is eligible for reversing
|
||||||
|
* (basically only when leaving a station).
|
||||||
|
*/
|
||||||
|
bool ProcessOrders(Vehicle *v)
|
||||||
|
{
|
||||||
|
switch (v->current_order.type) {
|
||||||
|
case OT_GOTO_DEPOT:
|
||||||
|
/* 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_SERVICE_IF_NEEDED) && !VehicleNeedsService(v)) {
|
||||||
|
UpdateVehicleTimetable(v, true);
|
||||||
|
v->cur_order_index++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OT_LOADING:
|
||||||
|
case OT_LEAVESTATION:
|
||||||
|
return false;
|
||||||
|
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reversing because of order change is allowed only just after leaving a
|
||||||
|
* station (and the difficulty setting to allowed, of course)
|
||||||
|
* this can be detected because only after OT_LEAVESTATION, current_order
|
||||||
|
* 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)
|
||||||
|
*/
|
||||||
|
bool may_reverse = v->current_order.type == OT_NOTHING;
|
||||||
|
|
||||||
|
/* Check if we've reached the waypoint? */
|
||||||
|
if (v->current_order.type == OT_GOTO_WAYPOINT && v->tile == v->dest_tile) {
|
||||||
|
UpdateVehicleTimetable(v, true);
|
||||||
|
v->cur_order_index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if we've reached a non-stop station while TTDPatch nonstop is enabled.. */
|
||||||
|
if (_patches.new_nonstop &&
|
||||||
|
v->current_order.flags & OFB_NON_STOP &&
|
||||||
|
IsTileType(v->tile, MP_STATION) &&
|
||||||
|
v->current_order.dest == GetStationIndex(v->tile)) {
|
||||||
|
UpdateVehicleTimetable(v, true);
|
||||||
|
v->cur_order_index++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get the current order */
|
||||||
|
if (v->cur_order_index >= v->num_orders) v->cur_order_index = 0;
|
||||||
|
|
||||||
|
const Order *order = GetVehicleOrder(v, v->cur_order_index);
|
||||||
|
|
||||||
|
/* If no order, do nothing. */
|
||||||
|
if (order == NULL) {
|
||||||
|
v->current_order.Free();
|
||||||
|
v->dest_tile = 0;
|
||||||
|
if (v->type == VEH_ROAD) ClearSlot(v);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If it is unchanged, keep it. */
|
||||||
|
if (order->type == v->current_order.type &&
|
||||||
|
order->flags == v->current_order.flags &&
|
||||||
|
order->dest == v->current_order.dest &&
|
||||||
|
(v->type != VEH_SHIP || order->type != OT_GOTO_STATION || GetStation(order->dest)->dock_tile != 0)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Otherwise set it, and determine the destination tile. */
|
||||||
|
v->current_order = *order;
|
||||||
|
|
||||||
|
InvalidateVehicleOrder(v);
|
||||||
|
switch (v->type) {
|
||||||
|
default:
|
||||||
|
NOT_REACHED();
|
||||||
|
|
||||||
|
case VEH_ROAD:
|
||||||
|
case VEH_TRAIN:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VEH_SHIP:
|
||||||
|
InvalidateWindowClasses(v->GetVehicleListWindowClass());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (order->type) {
|
||||||
|
case OT_GOTO_STATION:
|
||||||
|
if (order->dest == v->last_station_visited) {
|
||||||
|
v->last_station_visited = INVALID_STATION;
|
||||||
|
}
|
||||||
|
v->dest_tile = v->GetOrderStationLocation(order->dest);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OT_GOTO_DEPOT:
|
||||||
|
v->dest_tile = GetDepot(order->dest)->xy;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case OT_GOTO_WAYPOINT:
|
||||||
|
v->dest_tile = GetWaypoint(order->dest)->xy;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
v->dest_tile = 0;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return may_reverse;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -36,6 +36,7 @@ bool VehicleHasDepotOrders(const Vehicle *v);
|
||||||
void CheckOrders(const Vehicle*);
|
void CheckOrders(const Vehicle*);
|
||||||
void DeleteVehicleOrders(Vehicle *v);
|
void DeleteVehicleOrders(Vehicle *v);
|
||||||
bool CheckForValidOrders(const Vehicle* v);
|
bool CheckForValidOrders(const Vehicle* v);
|
||||||
|
bool ProcessOrders(Vehicle *v);
|
||||||
|
|
||||||
#define MIN_SERVINT_PERCENT 5
|
#define MIN_SERVINT_PERCENT 5
|
||||||
#define MAX_SERVINT_PERCENT 90
|
#define MAX_SERVINT_PERCENT 90
|
||||||
|
|
|
@ -76,6 +76,7 @@ struct RoadVehicle : public Vehicle {
|
||||||
bool IsInDepot() const { return this->u.road.state == RVSB_IN_DEPOT; }
|
bool IsInDepot() const { return this->u.road.state == RVSB_IN_DEPOT; }
|
||||||
void Tick();
|
void Tick();
|
||||||
void OnNewDay();
|
void OnNewDay();
|
||||||
|
TileIndex GetOrderStationLocation(StationID station);
|
||||||
};
|
};
|
||||||
|
|
||||||
byte GetRoadVehLength(const Vehicle *v);
|
byte GetRoadVehLength(const Vehicle *v);
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
#include "road_map.h"
|
#include "road_map.h"
|
||||||
#include "roadveh.h"
|
#include "roadveh.h"
|
||||||
#include "station_map.h"
|
#include "station_map.h"
|
||||||
#include "timetable.h"
|
|
||||||
#include "command_func.h"
|
#include "command_func.h"
|
||||||
#include "station_base.h"
|
#include "station_base.h"
|
||||||
#include "news_func.h"
|
#include "news_func.h"
|
||||||
|
@ -755,61 +754,16 @@ static void HandleBrokenRoadVeh(Vehicle *v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ProcessRoadVehOrder(Vehicle *v)
|
TileIndex RoadVehicle::GetOrderStationLocation(StationID station)
|
||||||
{
|
{
|
||||||
const Order *order;
|
|
||||||
|
|
||||||
switch (v->current_order.type) {
|
|
||||||
case OT_GOTO_DEPOT:
|
|
||||||
/* Let a depot order in the orderlist interrupt. */
|
|
||||||
if (!(v->current_order.flags & OFB_PART_OF_ORDERS)) return;
|
|
||||||
if (v->current_order.flags & OFB_SERVICE_IF_NEEDED &&
|
|
||||||
!VehicleNeedsService(v)) {
|
|
||||||
UpdateVehicleTimetable(v, true);
|
|
||||||
v->cur_order_index++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OT_LOADING:
|
|
||||||
case OT_LEAVESTATION:
|
|
||||||
return;
|
|
||||||
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (v->cur_order_index >= v->num_orders) v->cur_order_index = 0;
|
|
||||||
|
|
||||||
order = GetVehicleOrder(v, v->cur_order_index);
|
|
||||||
|
|
||||||
if (order == NULL) {
|
|
||||||
v->current_order.Free();
|
|
||||||
v->dest_tile = 0;
|
|
||||||
ClearSlot(v);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (order->type == v->current_order.type &&
|
|
||||||
order->flags == v->current_order.flags &&
|
|
||||||
order->dest == v->current_order.dest) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
v->current_order = *order;
|
|
||||||
|
|
||||||
switch (order->type) {
|
|
||||||
case OT_GOTO_STATION: {
|
|
||||||
if (order->dest == v->last_station_visited) {
|
|
||||||
v->last_station_visited = INVALID_STATION;
|
|
||||||
}
|
|
||||||
|
|
||||||
const RoadStop *rs = GetStation(order->dest)->GetPrimaryRoadStop(v);
|
|
||||||
|
|
||||||
TileIndex dest = INVALID_TILE;
|
TileIndex dest = INVALID_TILE;
|
||||||
|
|
||||||
|
const RoadStop *rs = GetStation(station)->GetPrimaryRoadStop(this);
|
||||||
if (rs != NULL) {
|
if (rs != NULL) {
|
||||||
uint mindist = MAX_UVALUE(uint);
|
uint mindist = MAX_UVALUE(uint);
|
||||||
|
|
||||||
for (; rs != NULL; rs = rs->GetNextRoadStop(v)) {
|
for (; rs != NULL; rs = rs->GetNextRoadStop(this)) {
|
||||||
uint dist = DistanceManhattan(v->tile, rs->xy);
|
uint dist = DistanceManhattan(this->tile, rs->xy);
|
||||||
|
|
||||||
if (dist < mindist) {
|
if (dist < mindist) {
|
||||||
mindist = dist;
|
mindist = dist;
|
||||||
|
@ -819,25 +773,12 @@ static void ProcessRoadVehOrder(Vehicle *v)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dest != INVALID_TILE) {
|
if (dest != INVALID_TILE) {
|
||||||
v->dest_tile = dest;
|
return dest;
|
||||||
} else {
|
} else {
|
||||||
/* There is no stop left at the station, so don't even TRY to go there */
|
/* There is no stop left at the station, so don't even TRY to go there */
|
||||||
v->cur_order_index++;
|
this->cur_order_index++;
|
||||||
v->dest_tile = 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case OT_GOTO_DEPOT:
|
|
||||||
v->dest_tile = GetDepot(order->dest)->xy;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
v->dest_tile = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
InvalidateVehicleOrder(v);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void StartRoadVehSound(const Vehicle* v)
|
static void StartRoadVehSound(const Vehicle* v)
|
||||||
|
@ -1939,7 +1880,7 @@ static void RoadVehController(Vehicle *v)
|
||||||
|
|
||||||
if (v->vehstatus & VS_STOPPED) return;
|
if (v->vehstatus & VS_STOPPED) return;
|
||||||
|
|
||||||
ProcessRoadVehOrder(v);
|
ProcessOrders(v);
|
||||||
v->HandleLoading();
|
v->HandleLoading();
|
||||||
|
|
||||||
if (v->current_order.type == OT_LOADING) return;
|
if (v->current_order.type == OT_LOADING) return;
|
||||||
|
|
|
@ -42,6 +42,7 @@ struct Ship: public Vehicle {
|
||||||
bool IsInDepot() const { return this->u.ship.state == 0x80; }
|
bool IsInDepot() const { return this->u.ship.state == 0x80; }
|
||||||
void Tick();
|
void Tick();
|
||||||
void OnNewDay();
|
void OnNewDay();
|
||||||
|
TileIndex GetOrderStationLocation(StationID station);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SHIP_H */
|
#endif /* SHIP_H */
|
||||||
|
|
|
@ -242,66 +242,15 @@ void Ship::PlayLeaveStationSound() const
|
||||||
PlayShipSound(this);
|
PlayShipSound(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ProcessShipOrder(Vehicle *v)
|
TileIndex Ship::GetOrderStationLocation(StationID station)
|
||||||
{
|
{
|
||||||
const Order *order;
|
Station *st = GetStation(station);
|
||||||
|
|
||||||
switch (v->current_order.type) {
|
|
||||||
case OT_GOTO_DEPOT:
|
|
||||||
if (!(v->current_order.flags & OFB_PART_OF_ORDERS)) return;
|
|
||||||
if (v->current_order.flags & OFB_SERVICE_IF_NEEDED &&
|
|
||||||
!VehicleNeedsService(v)) {
|
|
||||||
UpdateVehicleTimetable(v, true);
|
|
||||||
v->cur_order_index++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OT_LOADING:
|
|
||||||
case OT_LEAVESTATION:
|
|
||||||
return;
|
|
||||||
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (v->cur_order_index >= v->num_orders) v->cur_order_index = 0;
|
|
||||||
|
|
||||||
order = GetVehicleOrder(v, v->cur_order_index);
|
|
||||||
|
|
||||||
if (order == NULL) {
|
|
||||||
v->current_order.Free();
|
|
||||||
v->dest_tile = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (order->type == v->current_order.type &&
|
|
||||||
order->flags == v->current_order.flags &&
|
|
||||||
order->dest == v->current_order.dest &&
|
|
||||||
(order->type != OT_GOTO_STATION || GetStation(order->dest)->dock_tile != 0))
|
|
||||||
return;
|
|
||||||
|
|
||||||
v->current_order = *order;
|
|
||||||
|
|
||||||
if (order->type == OT_GOTO_STATION) {
|
|
||||||
const Station *st;
|
|
||||||
|
|
||||||
if (order->dest == v->last_station_visited)
|
|
||||||
v->last_station_visited = INVALID_STATION;
|
|
||||||
|
|
||||||
st = GetStation(order->dest);
|
|
||||||
if (st->dock_tile != 0) {
|
if (st->dock_tile != 0) {
|
||||||
v->dest_tile = TILE_ADD(st->dock_tile, ToTileIndexDiff(GetDockOffset(st->dock_tile)));
|
return TILE_ADD(st->dock_tile, ToTileIndexDiff(GetDockOffset(st->dock_tile)));
|
||||||
} else {
|
} else {
|
||||||
v->cur_order_index++;
|
this->cur_order_index++;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
} else if (order->type == OT_GOTO_DEPOT) {
|
|
||||||
v->dest_tile = GetDepot(order->dest)->xy;
|
|
||||||
} else {
|
|
||||||
v->dest_tile = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
InvalidateVehicleOrder(v);
|
|
||||||
|
|
||||||
InvalidateWindowClasses(WC_SHIPS_LIST);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ship::UpdateDeltaXY(Direction direction)
|
void Ship::UpdateDeltaXY(Direction direction)
|
||||||
|
@ -650,7 +599,7 @@ static void ShipController(Vehicle *v)
|
||||||
|
|
||||||
if (v->vehstatus & VS_STOPPED) return;
|
if (v->vehstatus & VS_STOPPED) return;
|
||||||
|
|
||||||
ProcessShipOrder(v);
|
ProcessOrders(v);
|
||||||
v->HandleLoading();
|
v->HandleLoading();
|
||||||
|
|
||||||
if (v->current_order.type == OT_LOADING) return;
|
if (v->current_order.type == OT_LOADING) return;
|
||||||
|
|
|
@ -306,6 +306,7 @@ struct Train : public Vehicle {
|
||||||
bool IsStoppedInDepot() const { return CheckTrainStoppedInDepot(this) >= 0; }
|
bool IsStoppedInDepot() const { return CheckTrainStoppedInDepot(this) >= 0; }
|
||||||
void Tick();
|
void Tick();
|
||||||
void OnNewDay();
|
void OnNewDay();
|
||||||
|
TileIndex GetOrderStationLocation(StationID station);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* TRAIN_H */
|
#endif /* TRAIN_H */
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "station_map.h"
|
#include "station_map.h"
|
||||||
#include "tunnel_map.h"
|
#include "tunnel_map.h"
|
||||||
#include "timetable.h"
|
|
||||||
#include "articulated_vehicles.h"
|
#include "articulated_vehicles.h"
|
||||||
#include "command_func.h"
|
#include "command_func.h"
|
||||||
#include "pathfind.h"
|
#include "pathfind.h"
|
||||||
|
@ -2616,94 +2615,9 @@ bad:;
|
||||||
return reverse_best != 0;
|
return reverse_best != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ProcessTrainOrder(Vehicle *v)
|
TileIndex Train::GetOrderStationLocation(StationID station)
|
||||||
{
|
{
|
||||||
switch (v->current_order.type) {
|
return GetStation(station)->xy;
|
||||||
case OT_GOTO_DEPOT:
|
|
||||||
if (!(v->current_order.flags & OFB_PART_OF_ORDERS)) return false;
|
|
||||||
if ((v->current_order.flags & OFB_SERVICE_IF_NEEDED) &&
|
|
||||||
!VehicleNeedsService(v)) {
|
|
||||||
UpdateVehicleTimetable(v, true);
|
|
||||||
v->cur_order_index++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OT_LOADING:
|
|
||||||
case OT_LEAVESTATION:
|
|
||||||
return false;
|
|
||||||
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reversing because of order change is allowed only just after leaving a
|
|
||||||
* station (and the difficulty setting to allowed, of course)
|
|
||||||
* this can be detected because only after OT_LEAVESTATION, current_order
|
|
||||||
* 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)
|
|
||||||
*/
|
|
||||||
bool may_reverse = v->current_order.type == OT_NOTHING;
|
|
||||||
|
|
||||||
/* check if we've reached the waypoint? */
|
|
||||||
if (v->current_order.type == OT_GOTO_WAYPOINT && v->tile == v->dest_tile) {
|
|
||||||
UpdateVehicleTimetable(v, true);
|
|
||||||
v->cur_order_index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check if we've reached a non-stop station while TTDPatch nonstop is enabled.. */
|
|
||||||
if (_patches.new_nonstop &&
|
|
||||||
v->current_order.flags & OFB_NON_STOP &&
|
|
||||||
IsTileType(v->tile, MP_STATION) &&
|
|
||||||
v->current_order.dest == GetStationIndex(v->tile)) {
|
|
||||||
UpdateVehicleTimetable(v, true);
|
|
||||||
v->cur_order_index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the current order */
|
|
||||||
if (v->cur_order_index >= v->num_orders) v->cur_order_index = 0;
|
|
||||||
|
|
||||||
const Order *order = GetVehicleOrder(v, v->cur_order_index);
|
|
||||||
|
|
||||||
/* If no order, do nothing. */
|
|
||||||
if (order == NULL) {
|
|
||||||
v->current_order.Free();
|
|
||||||
v->dest_tile = 0;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If it is unchanged, keep it. */
|
|
||||||
if (order->type == v->current_order.type &&
|
|
||||||
order->flags == v->current_order.flags &&
|
|
||||||
order->dest == v->current_order.dest)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
/* Otherwise set it, and determine the destination tile. */
|
|
||||||
v->current_order = *order;
|
|
||||||
|
|
||||||
v->dest_tile = 0;
|
|
||||||
|
|
||||||
InvalidateVehicleOrder(v);
|
|
||||||
|
|
||||||
switch (order->type) {
|
|
||||||
case OT_GOTO_STATION:
|
|
||||||
if (order->dest == v->last_station_visited)
|
|
||||||
v->last_station_visited = INVALID_STATION;
|
|
||||||
v->dest_tile = GetStation(order->dest)->xy;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OT_GOTO_DEPOT:
|
|
||||||
v->dest_tile = GetDepot(order->dest)->xy;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case OT_GOTO_WAYPOINT:
|
|
||||||
v->dest_tile = GetWaypoint(order->dest)->xy;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return may_reverse && CheckReverseTrain(v);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Train::MarkDirty()
|
void Train::MarkDirty()
|
||||||
|
@ -3565,7 +3479,7 @@ static void TrainLocoHandler(Vehicle *v, bool mode)
|
||||||
/* exit if train is stopped */
|
/* exit if train is stopped */
|
||||||
if (v->vehstatus & VS_STOPPED && v->cur_speed == 0) return;
|
if (v->vehstatus & VS_STOPPED && v->cur_speed == 0) return;
|
||||||
|
|
||||||
if (ProcessTrainOrder(v)) {
|
if (ProcessOrders(v) && CheckReverseTrain(v)) {
|
||||||
v->load_unload_time_rem = 0;
|
v->load_unload_time_rem = 0;
|
||||||
v->cur_speed = 0;
|
v->cur_speed = 0;
|
||||||
v->subspeed = 0;
|
v->subspeed = 0;
|
||||||
|
|
|
@ -488,6 +488,15 @@ public:
|
||||||
inline bool IsOrderListShared() const { return this->next_shared != NULL || this->prev_shared != NULL; };
|
inline bool IsOrderListShared() const { return this->next_shared != NULL || this->prev_shared != NULL; };
|
||||||
|
|
||||||
bool NeedsAutorenewing(const Player *p) const;
|
bool NeedsAutorenewing(const Player *p) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the location for the station where the vehicle goes to next.
|
||||||
|
* Things done for example are allocating slots in a road stop or exact
|
||||||
|
* location of the platform is determined for ships.
|
||||||
|
* @param station the station to make the next location of the vehicle.
|
||||||
|
* @return the location (tile) to aim for.
|
||||||
|
*/
|
||||||
|
virtual TileIndex GetOrderStationLocation(StationID station) { return INVALID_TILE; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue