Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -183,7 +183,7 @@ public:
|
||||
* @param orig_age Age of the original link graph.
|
||||
* @return scaled value.
|
||||
*/
|
||||
inline static uint Scale(uint val, TimerGameEconomy::Date target_age, TimerGameEconomy::Date orig_age)
|
||||
static inline uint Scale(uint val, TimerGameEconomy::Date target_age, TimerGameEconomy::Date orig_age)
|
||||
{
|
||||
return val > 0 ? std::max(1U, val * target_age.base() / orig_age.base()) : 0;
|
||||
}
|
||||
|
||||
@@ -32,26 +32,26 @@
|
||||
* Colours for the various "load" states of links. Ordered from "unused" to
|
||||
* "overloaded".
|
||||
*/
|
||||
const uint8_t LinkGraphOverlay::LINK_COLOURS[][12] = {
|
||||
const PixelColour LinkGraphOverlay::LINK_COLOURS[][12] = {
|
||||
{
|
||||
0x0f, 0xd1, 0xd0, 0x57,
|
||||
0x55, 0x53, 0xbf, 0xbd,
|
||||
0xba, 0xb9, 0xb7, 0xb5
|
||||
PixelColour{0x0f}, PixelColour{0xd1}, PixelColour{0xd0}, PixelColour{0x57},
|
||||
PixelColour{0x55}, PixelColour{0x53}, PixelColour{0xbf}, PixelColour{0xbd},
|
||||
PixelColour{0xba}, PixelColour{0xb9}, PixelColour{0xb7}, PixelColour{0xb5}
|
||||
},
|
||||
{
|
||||
0x0f, 0xd1, 0xd0, 0x57,
|
||||
0x55, 0x53, 0x96, 0x95,
|
||||
0x94, 0x93, 0x92, 0x91
|
||||
PixelColour{0x0f}, PixelColour{0xd1}, PixelColour{0xd0}, PixelColour{0x57},
|
||||
PixelColour{0x55}, PixelColour{0x53}, PixelColour{0x96}, PixelColour{0x95},
|
||||
PixelColour{0x94}, PixelColour{0x93}, PixelColour{0x92}, PixelColour{0x91}
|
||||
},
|
||||
{
|
||||
0x0f, 0x0b, 0x09, 0x07,
|
||||
0x05, 0x03, 0xbf, 0xbd,
|
||||
0xba, 0xb9, 0xb7, 0xb5
|
||||
PixelColour{0x0f}, PixelColour{0x0b}, PixelColour{0x09}, PixelColour{0x07},
|
||||
PixelColour{0x05}, PixelColour{0x03}, PixelColour{0xbf}, PixelColour{0xbd},
|
||||
PixelColour{0xba}, PixelColour{0xb9}, PixelColour{0xb7}, PixelColour{0xb5}
|
||||
},
|
||||
{
|
||||
0x0f, 0x0b, 0x0a, 0x09,
|
||||
0x08, 0x07, 0x06, 0x05,
|
||||
0x04, 0x03, 0x02, 0x01
|
||||
PixelColour{0x0f}, PixelColour{0x0b}, PixelColour{0x0a}, PixelColour{0x09},
|
||||
PixelColour{0x08}, PixelColour{0x07}, PixelColour{0x06}, PixelColour{0x05},
|
||||
PixelColour{0x04}, PixelColour{0x03}, PixelColour{0x02}, PixelColour{0x01}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -299,7 +299,7 @@ void LinkGraphOverlay::DrawLinks(const DrawPixelInfo *dpi) const
|
||||
void LinkGraphOverlay::DrawContent(Point pta, Point ptb, const LinkProperties &cargo) const
|
||||
{
|
||||
uint usage_or_plan = std::min(cargo.capacity * 2 + 1, cargo.Usage());
|
||||
int colour = LinkGraphOverlay::LINK_COLOURS[_settings_client.gui.linkgraph_colours][usage_or_plan * lengthof(LinkGraphOverlay::LINK_COLOURS[0]) / (cargo.capacity * 2 + 2)];
|
||||
PixelColour colour = LinkGraphOverlay::LINK_COLOURS[_settings_client.gui.linkgraph_colours][usage_or_plan * lengthof(LinkGraphOverlay::LINK_COLOURS[0]) / (cargo.capacity * 2 + 2)];
|
||||
int width = ScaleGUITrad(this->scale);
|
||||
int dash = cargo.shared ? width * 4 : 0;
|
||||
|
||||
@@ -347,7 +347,7 @@ void LinkGraphOverlay::DrawStationDots(const DrawPixelInfo *dpi) const
|
||||
* @param colour Colour with which the vertex will be filled.
|
||||
* @param border_colour Colour for the border of the vertex.
|
||||
*/
|
||||
/* static */ void LinkGraphOverlay::DrawVertex(int x, int y, int size, int colour, int border_colour)
|
||||
/* static */ void LinkGraphOverlay::DrawVertex(int x, int y, int size, PixelColour colour, PixelColour border_colour)
|
||||
{
|
||||
size--;
|
||||
int w1 = size / 2;
|
||||
@@ -606,10 +606,10 @@ void LinkGraphLegendWindow::DrawWidget(const Rect &r, WidgetID widget) const
|
||||
if (this->IsWidgetDisabled(widget)) return;
|
||||
CompanyID cid = (CompanyID)(widget - WID_LGL_COMPANY_FIRST);
|
||||
Dimension sprite_size = GetSpriteSize(SPR_COMPANY_ICON);
|
||||
DrawCompanyIcon(cid, CenterBounds(br.left, br.right, sprite_size.width), CenterBounds(br.top, br.bottom, sprite_size.height));
|
||||
DrawCompanyIcon(cid, CentreBounds(br.left, br.right, sprite_size.width), CentreBounds(br.top, br.bottom, sprite_size.height));
|
||||
}
|
||||
if (IsInsideMM(widget, WID_LGL_SATURATION_FIRST, WID_LGL_SATURATION_LAST + 1)) {
|
||||
uint8_t colour = LinkGraphOverlay::LINK_COLOURS[_settings_client.gui.linkgraph_colours][widget - WID_LGL_SATURATION_FIRST];
|
||||
PixelColour colour = LinkGraphOverlay::LINK_COLOURS[_settings_client.gui.linkgraph_colours][widget - WID_LGL_SATURATION_FIRST];
|
||||
GfxFillRect(br, colour);
|
||||
StringID str = STR_NULL;
|
||||
if (widget == WID_LGL_SATURATION_FIRST) {
|
||||
@@ -620,13 +620,13 @@ void LinkGraphLegendWindow::DrawWidget(const Rect &r, WidgetID widget) const
|
||||
str = STR_LINKGRAPH_LEGEND_SATURATED;
|
||||
}
|
||||
if (str != STR_NULL) {
|
||||
DrawString(br.left, br.right, CenterBounds(br.top, br.bottom, GetCharacterHeight(FS_SMALL)), str, GetContrastColour(colour) | TC_FORCED, SA_HOR_CENTER, false, FS_SMALL);
|
||||
DrawString(br.left, br.right, CentreBounds(br.top, br.bottom, GetCharacterHeight(FS_SMALL)), str, GetContrastColour(colour) | TC_FORCED, SA_HOR_CENTER, false, FS_SMALL);
|
||||
}
|
||||
}
|
||||
if (IsInsideMM(widget, WID_LGL_CARGO_FIRST, WID_LGL_CARGO_LAST + 1)) {
|
||||
const CargoSpec *cargo = _sorted_cargo_specs[widget - WID_LGL_CARGO_FIRST];
|
||||
GfxFillRect(br, cargo->legend_colour);
|
||||
DrawString(br.left, br.right, CenterBounds(br.top, br.bottom, GetCharacterHeight(FS_SMALL)), cargo->abbrev, GetContrastColour(cargo->legend_colour, 73), SA_HOR_CENTER, false, FS_SMALL);
|
||||
DrawString(br.left, br.right, CentreBounds(br.top, br.bottom, GetCharacterHeight(FS_SMALL)), cargo->abbrev, GetContrastColour(cargo->legend_colour, 73), SA_HOR_CENTER, false, FS_SMALL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
typedef std::map<StationID, StationLinkMap> LinkMap;
|
||||
typedef std::vector<std::pair<StationID, uint> > StationSupplyList;
|
||||
|
||||
static const uint8_t LINK_COLOURS[][12];
|
||||
static const PixelColour LINK_COLOURS[][12];
|
||||
|
||||
/**
|
||||
* Create a link graph overlay for the specified window.
|
||||
@@ -95,7 +95,7 @@ protected:
|
||||
void RebuildCache();
|
||||
|
||||
static void AddStats(CargoType new_cargo, uint new_cap, uint new_usg, uint new_flow, uint32_t time, bool new_shared, LinkProperties &cargo);
|
||||
static void DrawVertex(int x, int y, int size, int colour, int border_colour);
|
||||
static void DrawVertex(int x, int y, int size, PixelColour colour, PixelColour border_colour);
|
||||
};
|
||||
|
||||
void ShowLinkGraphLegend();
|
||||
|
||||
@@ -28,7 +28,7 @@ INSTANTIATE_POOL_METHODS(LinkGraphJob)
|
||||
|
||||
/**
|
||||
* Create a link graph job from a link graph. The link graph will be copied so
|
||||
* that the calculations don't interfer with the normal operations on the
|
||||
* that the calculations don't interfere with the normal operations on the
|
||||
* original. The job is immediately started.
|
||||
* @param orig Original LinkGraph to be copied.
|
||||
*/
|
||||
@@ -42,13 +42,13 @@ LinkGraphJob::LinkGraphJob(const LinkGraph &orig) :
|
||||
}
|
||||
|
||||
/**
|
||||
* Erase all flows originating at a specific node.
|
||||
* @param from Node to erase flows for.
|
||||
* Erase all flows originating at a specific station.
|
||||
* @param from StationID to erase flows for.
|
||||
*/
|
||||
void LinkGraphJob::EraseFlows(NodeID from)
|
||||
void LinkGraphJob::EraseFlows(StationID from)
|
||||
{
|
||||
for (NodeID node_id = 0; node_id < this->Size(); ++node_id) {
|
||||
(*this)[node_id].flows.erase(StationID{from});
|
||||
(*this)[node_id].flows.erase(from);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ LinkGraphJob::~LinkGraphJob()
|
||||
/* The station can have been deleted. Remove all flows originating from it then. */
|
||||
Station *st = Station::GetIfValid(from.base.station);
|
||||
if (st == nullptr) {
|
||||
this->EraseFlows(node_id);
|
||||
this->EraseFlows(from.base.station);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ LinkGraphJob::~LinkGraphJob()
|
||||
* sure that everything is still consistent or ignore it otherwise. */
|
||||
GoodsEntry &ge = st->goods[this->Cargo()];
|
||||
if (ge.link_graph != this->link_graph.index || ge.node != node_id) {
|
||||
this->EraseFlows(node_id);
|
||||
this->EraseFlows(from.base.station);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ LinkGraphJob::~LinkGraphJob()
|
||||
/* Delete old flows for source stations which have been deleted
|
||||
* from the new flows. This avoids flow cycles between old and
|
||||
* new flows. */
|
||||
while (!erased.IsEmpty()) geflows.erase(StationID{erased.Pop()});
|
||||
while (!erased.IsEmpty()) geflows.erase(erased.Pop());
|
||||
} else if ((*lg)[node_id][dest_id].last_unrestricted_update == EconomyTime::INVALID_DATE) {
|
||||
/* Edge is fully restricted. */
|
||||
flows.RestrictFlows(to);
|
||||
|
||||
@@ -167,7 +167,7 @@ protected:
|
||||
std::atomic<bool> job_completed = false; ///< Is the job still running. This is accessed by multiple threads and reads may be stale.
|
||||
std::atomic<bool> job_aborted = false; ///< Has the job been aborted. This is accessed by multiple threads and reads may be stale.
|
||||
|
||||
void EraseFlows(NodeID from);
|
||||
void EraseFlows(StationID from);
|
||||
void JoinThread();
|
||||
void SpawnThread();
|
||||
|
||||
@@ -299,7 +299,7 @@ public:
|
||||
* @param total Total capacity.
|
||||
* @return free * 16 / max(total, 1).
|
||||
*/
|
||||
inline static int GetCapacityRatio(int free, uint total)
|
||||
static inline int GetCapacityRatio(int free, uint total)
|
||||
{
|
||||
return Clamp(free, PATH_CAP_MIN_FREE, PATH_CAP_MAX_FREE) * PATH_CAP_MULTIPLIER / std::max(total, 1U);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ void LinkGraphSchedule::JoinNext()
|
||||
delete next; // implicitly joins the thread
|
||||
if (LinkGraph::IsValidID(id)) {
|
||||
LinkGraph *lg = LinkGraph::Get(id);
|
||||
this->Unqueue(lg); // Unqueue to avoid double-queueing recycled IDs.
|
||||
this->Dequeue(lg); // Dequeue to avoid double-queueing recycled IDs.
|
||||
this->Queue(lg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
* Remove a link graph from the execution queue.
|
||||
* @param lg Link graph to be removed.
|
||||
*/
|
||||
void Unqueue(LinkGraph *lg) { this->schedule.remove(lg); }
|
||||
void Dequeue(LinkGraph *lg) { this->schedule.remove(lg); }
|
||||
};
|
||||
|
||||
void StateGameLoop_LinkGraphPauseControl();
|
||||
|
||||
@@ -134,7 +134,7 @@ private:
|
||||
LinkGraphJob &job; ///< Link graph job we're working with.
|
||||
|
||||
/** Lookup table for getting NodeIDs from StationIDs. */
|
||||
ReferenceThroughBaseContainer<std::vector<NodeID>> station_to_node;
|
||||
TypedIndexContainer<std::vector<NodeID>, StationID> station_to_node;
|
||||
|
||||
/** Current iterator in the shares map. */
|
||||
FlowStat::SharesMap::const_iterator it;
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
if (v->orders == nullptr) return;
|
||||
|
||||
/* Make sure the first order is a useful order. */
|
||||
const Order *first = v->orders->GetNextDecisionNode(v->GetOrder(v->cur_implicit_order_index), 0);
|
||||
if (first == nullptr) return;
|
||||
VehicleOrderID first = v->orders->GetNextDecisionNode(v->cur_implicit_order_index, 0);
|
||||
if (first == INVALID_VEH_ORDER_ID) return;
|
||||
|
||||
HopSet seen_hops;
|
||||
LinkRefresher refresher(v, &seen_hops, allow_merge, is_full_loading);
|
||||
@@ -138,22 +138,25 @@ void LinkRefresher::ResetRefit()
|
||||
* @param num_hops Number of hops already taken by recursive calls to this method.
|
||||
* @return new next Order.
|
||||
*/
|
||||
const Order *LinkRefresher::PredictNextOrder(const Order *cur, const Order *next, RefreshFlags flags, uint num_hops)
|
||||
VehicleOrderID LinkRefresher::PredictNextOrder(VehicleOrderID cur, VehicleOrderID next, RefreshFlags flags, uint num_hops)
|
||||
{
|
||||
assert(this->vehicle->orders != nullptr);
|
||||
const OrderList &orderlist = *this->vehicle->orders;
|
||||
auto orders = orderlist.GetOrders();
|
||||
|
||||
/* next is good if it's either nullptr (then the caller will stop the
|
||||
* evaluation) or if it's not conditional and the caller allows it to be
|
||||
* chosen (by setting RefreshFlag::UseNext). */
|
||||
while (next != nullptr && (!flags.Test(RefreshFlag::UseNext) || next->IsType(OT_CONDITIONAL))) {
|
||||
while (next < orderlist.GetNumOrders() && (!flags.Test(RefreshFlag::UseNext) || orders[next].IsType(OT_CONDITIONAL))) {
|
||||
|
||||
/* After the first step any further non-conditional order is good,
|
||||
* regardless of previous RefreshFlag::UseNext settings. The case of cur and next or
|
||||
* their respective stations being equal is handled elsewhere. */
|
||||
flags.Set(RefreshFlag::UseNext);
|
||||
|
||||
if (next->IsType(OT_CONDITIONAL)) {
|
||||
const Order *skip_to = this->vehicle->orders->GetNextDecisionNode(
|
||||
this->vehicle->orders->GetOrderAt(next->GetConditionSkipToOrder()), num_hops);
|
||||
if (skip_to != nullptr && num_hops < this->vehicle->orders->GetNumOrders()) {
|
||||
if (orders[next].IsType(OT_CONDITIONAL)) {
|
||||
VehicleOrderID skip_to = orderlist.GetNextDecisionNode(orders[next].GetConditionSkipToOrder(), num_hops);
|
||||
if (skip_to != INVALID_VEH_ORDER_ID && num_hops < orderlist.GetNumOrders()) {
|
||||
/* Make copies of capacity tracking lists. There is potential
|
||||
* for optimization here: If the vehicle never refits we don't
|
||||
* need to copy anything. Also, if we've seen the branched link
|
||||
@@ -165,8 +168,7 @@ const Order *LinkRefresher::PredictNextOrder(const Order *cur, const Order *next
|
||||
|
||||
/* Reassign next with the following stop. This can be a station or a
|
||||
* depot.*/
|
||||
next = this->vehicle->orders->GetNextDecisionNode(
|
||||
this->vehicle->orders->GetNext(next), num_hops++);
|
||||
next = orderlist.GetNextDecisionNode(orderlist.GetNext(next), num_hops++);
|
||||
}
|
||||
return next;
|
||||
}
|
||||
@@ -176,10 +178,14 @@ const Order *LinkRefresher::PredictNextOrder(const Order *cur, const Order *next
|
||||
* @param cur Last stop where the consist could interact with cargo.
|
||||
* @param next Next order to be processed.
|
||||
*/
|
||||
void LinkRefresher::RefreshStats(const Order *cur, const Order *next)
|
||||
void LinkRefresher::RefreshStats(VehicleOrderID cur, VehicleOrderID next)
|
||||
{
|
||||
StationID next_station = next->GetDestination().ToStationID();
|
||||
Station *st = Station::GetIfValid(cur->GetDestination().ToStationID());
|
||||
assert(this->vehicle->orders != nullptr);
|
||||
const OrderList &orderlist = *this->vehicle->orders;
|
||||
auto orders = orderlist.GetOrders();
|
||||
|
||||
StationID next_station = orders[next].GetDestination().ToStationID();
|
||||
Station *st = Station::GetIfValid(orders[cur].GetDestination().ToStationID());
|
||||
if (st != nullptr && next_station != StationID::Invalid() && next_station != st->index) {
|
||||
Station *st_to = Station::Get(next_station);
|
||||
for (CargoType cargo = 0; cargo < NUM_CARGO; ++cargo) {
|
||||
@@ -197,7 +203,7 @@ void LinkRefresher::RefreshStats(const Order *cur, const Order *next)
|
||||
}
|
||||
|
||||
/* A link is at least partly restricted if a vehicle can't load at its source. */
|
||||
EdgeUpdateMode restricted_mode = (cur->GetLoadType() & OLFB_NO_LOAD) == 0 ?
|
||||
EdgeUpdateMode restricted_mode = (orders[cur].GetLoadType() & OLFB_NO_LOAD) == 0 ?
|
||||
EdgeUpdateMode::Unrestricted : EdgeUpdateMode::Restricted;
|
||||
/* This estimates the travel time of the link as the time needed
|
||||
* to travel between the stations at half the max speed of the consist.
|
||||
@@ -240,14 +246,17 @@ void LinkRefresher::RefreshStats(const Order *cur, const Order *next)
|
||||
* @param flags RefreshFlags to give hints about the previous link and state carried over from that.
|
||||
* @param num_hops Number of hops already taken by recursive calls to this method.
|
||||
*/
|
||||
void LinkRefresher::RefreshLinks(const Order *cur, const Order *next, RefreshFlags flags, uint num_hops)
|
||||
void LinkRefresher::RefreshLinks(VehicleOrderID cur, VehicleOrderID next, RefreshFlags flags, uint num_hops)
|
||||
{
|
||||
while (next != nullptr) {
|
||||
assert(this->vehicle->orders != nullptr);
|
||||
const OrderList &orderlist = *this->vehicle->orders;
|
||||
while (next < orderlist.GetNumOrders()) {
|
||||
const Order *next_order = orderlist.GetOrderAt(next);
|
||||
|
||||
if ((next->IsType(OT_GOTO_DEPOT) || next->IsType(OT_GOTO_STATION)) && next->IsRefit()) {
|
||||
if ((next_order->IsType(OT_GOTO_DEPOT) || next_order->IsType(OT_GOTO_STATION)) && next_order->IsRefit()) {
|
||||
flags.Set(RefreshFlag::WasRefit);
|
||||
if (!next->IsAutoRefit()) {
|
||||
this->HandleRefit(next->GetRefitCargo());
|
||||
if (!next_order->IsAutoRefit()) {
|
||||
this->HandleRefit(next_order->GetRefitCargo());
|
||||
} else if (!flags.Test(RefreshFlag::InAutorefit)) {
|
||||
flags.Set(RefreshFlag::InAutorefit);
|
||||
LinkRefresher backup(*this);
|
||||
@@ -263,34 +272,38 @@ void LinkRefresher::RefreshLinks(const Order *cur, const Order *next, RefreshFla
|
||||
/* Only reset the refit capacities if the "previous" next is a station,
|
||||
* meaning that either the vehicle was refit at the previous station or
|
||||
* it wasn't at all refit during the current hop. */
|
||||
if (flags.Test(RefreshFlag::WasRefit) && (next->IsType(OT_GOTO_STATION) || next->IsType(OT_IMPLICIT))) {
|
||||
if (flags.Test(RefreshFlag::WasRefit) && (next_order->IsType(OT_GOTO_STATION) || next_order->IsType(OT_IMPLICIT))) {
|
||||
flags.Set(RefreshFlag::ResetRefit);
|
||||
} else {
|
||||
flags.Reset(RefreshFlag::ResetRefit);
|
||||
}
|
||||
|
||||
next = this->PredictNextOrder(cur, next, flags, num_hops);
|
||||
if (next == nullptr) break;
|
||||
Hop hop(cur->index, next->index, this->cargo);
|
||||
if (next == INVALID_VEH_ORDER_ID) break;
|
||||
Hop hop(cur, next, this->cargo);
|
||||
if (this->seen_hops->find(hop) != this->seen_hops->end()) {
|
||||
break;
|
||||
} else {
|
||||
this->seen_hops->insert(hop);
|
||||
}
|
||||
|
||||
next_order = orderlist.GetOrderAt(next);
|
||||
|
||||
/* Don't use the same order again, but choose a new one in the next round. */
|
||||
flags.Reset(RefreshFlag::UseNext);
|
||||
|
||||
/* Skip resetting and link refreshing if next order won't do anything with cargo. */
|
||||
if (!next->IsType(OT_GOTO_STATION) && !next->IsType(OT_IMPLICIT)) continue;
|
||||
if (!next_order->IsType(OT_GOTO_STATION) && !next_order->IsType(OT_IMPLICIT)) continue;
|
||||
|
||||
if (flags.Test(RefreshFlag::ResetRefit)) {
|
||||
this->ResetRefit();
|
||||
flags.Reset({RefreshFlag::ResetRefit, RefreshFlag::WasRefit});
|
||||
}
|
||||
|
||||
if (cur->IsType(OT_GOTO_STATION) || cur->IsType(OT_IMPLICIT)) {
|
||||
if (cur->CanLeaveWithCargo(flags.Test(RefreshFlag::HasCargo))) {
|
||||
const Order *cur_order = orderlist.GetOrderAt(cur);
|
||||
|
||||
if (cur_order->IsType(OT_GOTO_STATION) || cur_order->IsType(OT_IMPLICIT)) {
|
||||
if (cur_order->CanLeaveWithCargo(flags.Test(RefreshFlag::HasCargo))) {
|
||||
flags.Set(RefreshFlag::HasCargo);
|
||||
this->RefreshStats(cur, next);
|
||||
} else {
|
||||
|
||||
@@ -56,8 +56,8 @@ protected:
|
||||
* line.
|
||||
*/
|
||||
struct Hop {
|
||||
OrderID from; ///< Last order where vehicle could interact with cargo or absolute first order.
|
||||
OrderID to; ///< Next order to be processed.
|
||||
VehicleOrderID from; ///< Last order where vehicle could interact with cargo or absolute first order.
|
||||
VehicleOrderID to; ///< Next order to be processed.
|
||||
CargoType cargo; ///< Cargo the consist is probably carrying or INVALID_CARGO if unknown.
|
||||
|
||||
/**
|
||||
@@ -72,7 +72,7 @@ protected:
|
||||
* @param to Second order of the hop.
|
||||
* @param cargo Cargo the consist is probably carrying when passing the hop.
|
||||
*/
|
||||
Hop(OrderID from, OrderID to, CargoType cargo) : from(from), to(to), cargo(cargo) {}
|
||||
Hop(VehicleOrderID from, VehicleOrderID to, CargoType cargo) : from(from), to(to), cargo(cargo) {}
|
||||
|
||||
constexpr auto operator<=>(const Hop &) const noexcept = default;
|
||||
};
|
||||
@@ -92,10 +92,10 @@ protected:
|
||||
|
||||
bool HandleRefit(CargoType refit_cargo);
|
||||
void ResetRefit();
|
||||
void RefreshStats(const Order *cur, const Order *next);
|
||||
const Order *PredictNextOrder(const Order *cur, const Order *next, RefreshFlags flags, uint num_hops = 0);
|
||||
void RefreshStats(VehicleOrderID cur, VehicleOrderID next);
|
||||
VehicleOrderID PredictNextOrder(VehicleOrderID cur, VehicleOrderID next, RefreshFlags flags, uint num_hops = 0);
|
||||
|
||||
void RefreshLinks(const Order *cur, const Order *next, RefreshFlags flags, uint num_hops = 0);
|
||||
void RefreshLinks(VehicleOrderID cur, VehicleOrderID next, RefreshFlags flags, uint num_hops = 0);
|
||||
};
|
||||
|
||||
#endif /* REFRESH_H */
|
||||
|
||||
Reference in New Issue
Block a user