Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
This commit is contained in:
@@ -204,16 +204,16 @@ void DemandCalculator::CalcDemand(LinkGraphJob &job, Tscaler scaler)
|
||||
continue;
|
||||
}
|
||||
|
||||
int32 supply = scaler.EffectiveSupply(job[from_id], job[to_id]);
|
||||
int32_t supply = scaler.EffectiveSupply(job[from_id], job[to_id]);
|
||||
assert(supply > 0);
|
||||
|
||||
/* Scale the distance by mod_dist around max_distance */
|
||||
int32 distance = this->max_distance - (this->max_distance -
|
||||
(int32)DistanceMaxPlusManhattan(job[from_id].base.xy, job[to_id].base.xy)) *
|
||||
int32_t distance = this->max_distance - (this->max_distance -
|
||||
(int32_t)DistanceMaxPlusManhattan(job[from_id].base.xy, job[to_id].base.xy)) *
|
||||
this->mod_dist / 100;
|
||||
|
||||
/* Scale the accuracy by distance around accuracy / 2 */
|
||||
int32 divisor = this->accuracy * (this->mod_dist - 50) / 100 +
|
||||
int32_t divisor = this->accuracy * (this->mod_dist - 50) / 100 +
|
||||
this->accuracy * distance / this->max_distance + 1;
|
||||
|
||||
assert(divisor > 0);
|
||||
|
@@ -14,9 +14,9 @@ public:
|
||||
DemandCalculator(LinkGraphJob &job);
|
||||
|
||||
private:
|
||||
int32 max_distance; ///< Maximum distance possible on the map.
|
||||
int32 mod_dist; ///< Distance modifier, determines how much demands decrease with distance.
|
||||
int32 accuracy; ///< Accuracy of the calculation.
|
||||
int32_t max_distance; ///< Maximum distance possible on the map.
|
||||
int32_t mod_dist; ///< Distance modifier, determines how much demands decrease with distance.
|
||||
int32_t accuracy; ///< Accuracy of the calculation.
|
||||
|
||||
template<class Tscaler>
|
||||
void CalcDemand(LinkGraphJob &job, Tscaler scaler);
|
||||
|
@@ -74,7 +74,7 @@ void LinkGraph::Compress()
|
||||
if (edge.capacity < (1 << 16)) {
|
||||
edge.travel_time_sum = edge.travel_time_sum * new_capacity / edge.capacity;
|
||||
} else if (edge.travel_time_sum != 0) {
|
||||
edge.travel_time_sum = std::max<uint64>(1, edge.travel_time_sum / 2);
|
||||
edge.travel_time_sum = std::max<uint64_t>(1, edge.travel_time_sum / 2);
|
||||
}
|
||||
edge.capacity = new_capacity;
|
||||
edge.usage /= 2;
|
||||
@@ -164,14 +164,14 @@ NodeID LinkGraph::AddNode(const Station *st)
|
||||
* @param usage Usage to be added.
|
||||
* @param mode Update mode to be used.
|
||||
*/
|
||||
void LinkGraph::BaseNode::AddEdge(NodeID to, uint capacity, uint usage, uint32 travel_time, EdgeUpdateMode mode)
|
||||
void LinkGraph::BaseNode::AddEdge(NodeID to, uint capacity, uint usage, uint32_t travel_time, EdgeUpdateMode mode)
|
||||
{
|
||||
assert(!this->HasEdgeTo(to));
|
||||
|
||||
BaseEdge &edge = *this->edges.emplace(std::upper_bound(this->edges.begin(), this->edges.end(), to), to);
|
||||
edge.capacity = capacity;
|
||||
edge.usage = usage;
|
||||
edge.travel_time_sum = static_cast<uint64>(travel_time) * capacity;
|
||||
edge.travel_time_sum = static_cast<uint64_t>(travel_time) * capacity;
|
||||
if (mode & EUM_UNRESTRICTED) edge.last_unrestricted_update = TimerGameCalendar::date;
|
||||
if (mode & EUM_RESTRICTED) edge.last_restricted_update = TimerGameCalendar::date;
|
||||
}
|
||||
@@ -183,7 +183,7 @@ void LinkGraph::BaseNode::AddEdge(NodeID to, uint capacity, uint usage, uint32 t
|
||||
* @param usage Usage to be added.
|
||||
* @param mode Update mode to be used.
|
||||
*/
|
||||
void LinkGraph::BaseNode::UpdateEdge(NodeID to, uint capacity, uint usage, uint32 travel_time, EdgeUpdateMode mode)
|
||||
void LinkGraph::BaseNode::UpdateEdge(NodeID to, uint capacity, uint usage, uint32_t travel_time, EdgeUpdateMode mode)
|
||||
{
|
||||
assert(capacity > 0);
|
||||
assert(usage <= capacity);
|
||||
@@ -214,25 +214,25 @@ void LinkGraph::BaseNode::RemoveEdge(NodeID to)
|
||||
* @param travel_time Travel time to be added, in ticks.
|
||||
* @param mode Update mode to be applied.
|
||||
*/
|
||||
void LinkGraph::BaseEdge::Update(uint capacity, uint usage, uint32 travel_time, EdgeUpdateMode mode)
|
||||
void LinkGraph::BaseEdge::Update(uint capacity, uint usage, uint32_t travel_time, EdgeUpdateMode mode)
|
||||
{
|
||||
assert(this->capacity > 0);
|
||||
assert(capacity >= usage);
|
||||
|
||||
if (mode & EUM_INCREASE) {
|
||||
if (this->travel_time_sum == 0) {
|
||||
this->travel_time_sum = static_cast<uint64>(this->capacity + capacity) * travel_time;
|
||||
this->travel_time_sum = static_cast<uint64_t>(this->capacity + capacity) * travel_time;
|
||||
} else if (travel_time == 0) {
|
||||
this->travel_time_sum += this->travel_time_sum / this->capacity * capacity;
|
||||
} else {
|
||||
this->travel_time_sum += static_cast<uint64>(travel_time) * capacity;
|
||||
this->travel_time_sum += static_cast<uint64_t>(travel_time) * capacity;
|
||||
}
|
||||
this->capacity += capacity;
|
||||
this->usage += usage;
|
||||
} else if (mode & EUM_REFRESH) {
|
||||
if (this->travel_time_sum == 0) {
|
||||
this->capacity = std::max(this->capacity, capacity);
|
||||
this->travel_time_sum = static_cast<uint64>(travel_time) * this->capacity;
|
||||
this->travel_time_sum = static_cast<uint64_t>(travel_time) * this->capacity;
|
||||
} else if (capacity > this->capacity) {
|
||||
this->travel_time_sum = this->travel_time_sum / this->capacity * capacity;
|
||||
this->capacity = capacity;
|
||||
|
@@ -43,7 +43,7 @@ public:
|
||||
struct BaseEdge {
|
||||
uint capacity; ///< Capacity of the link.
|
||||
uint usage; ///< Usage of the link.
|
||||
uint64 travel_time_sum; ///< Sum of the travel times of the link, in ticks.
|
||||
uint64_t travel_time_sum; ///< Sum of the travel times of the link, in ticks.
|
||||
TimerGameCalendar::Date last_unrestricted_update; ///< When the unrestricted part of the link was last updated.
|
||||
TimerGameCalendar::Date last_restricted_update; ///< When the restricted part of the link was last updated.
|
||||
NodeID dest_node; ///< Destination of the edge.
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
* Get edge's average travel time.
|
||||
* @return Travel time, in ticks.
|
||||
*/
|
||||
uint32 TravelTime() const { return this->travel_time_sum / this->capacity; }
|
||||
uint32_t TravelTime() const { return this->travel_time_sum / this->capacity; }
|
||||
|
||||
/**
|
||||
* Get the date of the last update to any part of the edge's capacity.
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
*/
|
||||
TimerGameCalendar::Date LastUpdate() const { return std::max(this->last_unrestricted_update, this->last_restricted_update); }
|
||||
|
||||
void Update(uint capacity, uint usage, uint32 time, EdgeUpdateMode mode);
|
||||
void Update(uint capacity, uint usage, uint32_t time, EdgeUpdateMode mode);
|
||||
void Restrict() { this->last_unrestricted_update = INVALID_DATE; }
|
||||
void Release() { this->last_restricted_update = INVALID_DATE; }
|
||||
|
||||
@@ -127,8 +127,8 @@ public:
|
||||
this->demand = demand;
|
||||
}
|
||||
|
||||
void AddEdge(NodeID to, uint capacity, uint usage, uint32 time, EdgeUpdateMode mode);
|
||||
void UpdateEdge(NodeID to, uint capacity, uint usage, uint32 time, EdgeUpdateMode mode);
|
||||
void AddEdge(NodeID to, uint capacity, uint usage, uint32_t time, EdgeUpdateMode mode);
|
||||
void UpdateEdge(NodeID to, uint capacity, uint usage, uint32_t time, EdgeUpdateMode mode);
|
||||
void RemoveEdge(NodeID to);
|
||||
|
||||
/**
|
||||
|
@@ -27,7 +27,7 @@
|
||||
* Colours for the various "load" states of links. Ordered from "unused" to
|
||||
* "overloaded".
|
||||
*/
|
||||
const uint8 LinkGraphOverlay::LINK_COLOURS[][12] = {
|
||||
const uint8_t LinkGraphOverlay::LINK_COLOURS[][12] = {
|
||||
{
|
||||
0x0f, 0xd1, 0xd0, 0x57,
|
||||
0x55, 0x53, 0xbf, 0xbd,
|
||||
@@ -149,19 +149,19 @@ inline bool LinkGraphOverlay::IsLinkVisible(Point pta, Point ptb, const DrawPixe
|
||||
* See: https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm
|
||||
*/
|
||||
|
||||
const uint8 INSIDE = 0; // 0000
|
||||
const uint8 LEFT = 1; // 0001
|
||||
const uint8 RIGHT = 2; // 0010
|
||||
const uint8 BOTTOM = 4; // 0100
|
||||
const uint8 TOP = 8; // 1000
|
||||
const uint8_t INSIDE = 0; // 0000
|
||||
const uint8_t LEFT = 1; // 0001
|
||||
const uint8_t RIGHT = 2; // 0010
|
||||
const uint8_t BOTTOM = 4; // 0100
|
||||
const uint8_t TOP = 8; // 1000
|
||||
|
||||
int x0 = pta.x;
|
||||
int y0 = pta.y;
|
||||
int x1 = ptb.x;
|
||||
int y1 = ptb.y;
|
||||
|
||||
auto out_code = [&](int x, int y) -> uint8 {
|
||||
uint8 out = INSIDE;
|
||||
auto out_code = [&](int x, int y) -> uint8_t {
|
||||
uint8_t out = INSIDE;
|
||||
if (x < left) {
|
||||
out |= LEFT;
|
||||
} else if (x > right) {
|
||||
@@ -175,24 +175,24 @@ inline bool LinkGraphOverlay::IsLinkVisible(Point pta, Point ptb, const DrawPixe
|
||||
return out;
|
||||
};
|
||||
|
||||
uint8 c0 = out_code(x0, y0);
|
||||
uint8 c1 = out_code(x1, y1);
|
||||
uint8_t c0 = out_code(x0, y0);
|
||||
uint8_t c1 = out_code(x1, y1);
|
||||
|
||||
while (true) {
|
||||
if (c0 == 0 || c1 == 0) return true;
|
||||
if ((c0 & c1) != 0) return false;
|
||||
|
||||
if (c0 & TOP) { // point 0 is above the clip window
|
||||
x0 = x0 + (int)(((int64) (x1 - x0)) * ((int64) (top - y0)) / ((int64) (y1 - y0)));
|
||||
x0 = x0 + (int)(((int64_t) (x1 - x0)) * ((int64_t) (top - y0)) / ((int64_t) (y1 - y0)));
|
||||
y0 = top;
|
||||
} else if (c0 & BOTTOM) { // point 0 is below the clip window
|
||||
x0 = x0 + (int)(((int64) (x1 - x0)) * ((int64) (bottom - y0)) / ((int64) (y1 - y0)));
|
||||
x0 = x0 + (int)(((int64_t) (x1 - x0)) * ((int64_t) (bottom - y0)) / ((int64_t) (y1 - y0)));
|
||||
y0 = bottom;
|
||||
} else if (c0 & RIGHT) { // point 0 is to the right of clip window
|
||||
y0 = y0 + (int)(((int64) (y1 - y0)) * ((int64) (right - x0)) / ((int64) (x1 - x0)));
|
||||
y0 = y0 + (int)(((int64_t) (y1 - y0)) * ((int64_t) (right - x0)) / ((int64_t) (x1 - x0)));
|
||||
x0 = right;
|
||||
} else if (c0 & LEFT) { // point 0 is to the left of clip window
|
||||
y0 = y0 + (int)(((int64) (y1 - y0)) * ((int64) (left - x0)) / ((int64) (x1 - x0)));
|
||||
y0 = y0 + (int)(((int64_t) (y1 - y0)) * ((int64_t) (left - x0)) / ((int64_t) (x1 - x0)));
|
||||
x0 = left;
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ void LinkGraphOverlay::AddLinks(const Station *from, const Station *to)
|
||||
* @param new_shared If the new link is shared.
|
||||
* @param cargo LinkProperties to write the information to.
|
||||
*/
|
||||
/* static */ void LinkGraphOverlay::AddStats(CargoID new_cargo, uint new_cap, uint new_usg, uint new_plan, uint32 time, bool new_shared, LinkProperties &cargo)
|
||||
/* static */ void LinkGraphOverlay::AddStats(CargoID new_cargo, uint new_cap, uint new_usg, uint new_plan, uint32_t time, bool new_shared, LinkProperties &cargo)
|
||||
{
|
||||
/* multiply the numbers by 32 in order to avoid comparing to 0 too often. */
|
||||
if (cargo.capacity == 0 ||
|
||||
@@ -369,8 +369,8 @@ bool LinkGraphOverlay::ShowTooltip(Point pt, TooltipCloseCondition close_cond)
|
||||
|
||||
/* Check the distance from the cursor to the line defined by the two stations. */
|
||||
Point ptb = this->GetStationMiddle(Station::Get(j->first));
|
||||
float dist = std::abs((int64)(ptb.x - pta.x) * (int64)(pta.y - pt.y) - (int64)(pta.x - pt.x) * (int64)(ptb.y - pta.y)) /
|
||||
std::sqrt((int64)(ptb.x - pta.x) * (int64)(ptb.x - pta.x) + (int64)(ptb.y - pta.y) * (int64)(ptb.y - pta.y));
|
||||
float dist = std::abs((int64_t)(ptb.x - pta.x) * (int64_t)(pta.y - pt.y) - (int64_t)(pta.x - pt.x) * (int64_t)(ptb.y - pta.y)) /
|
||||
std::sqrt((int64_t)(ptb.x - pta.x) * (int64_t)(ptb.x - pta.x) + (int64_t)(ptb.y - pta.y) * (int64_t)(ptb.y - pta.y));
|
||||
const auto &link = j->second;
|
||||
if (dist <= 4 && link.Usage() > 0 &&
|
||||
pt.x + 2 >= std::min(pta.x, ptb.x) &&
|
||||
@@ -380,7 +380,7 @@ bool LinkGraphOverlay::ShowTooltip(Point pt, TooltipCloseCondition close_cond)
|
||||
static std::string tooltip_extension;
|
||||
tooltip_extension.clear();
|
||||
/* Fill buf with more information if this is a bidirectional link. */
|
||||
uint32 back_time = 0;
|
||||
uint32_t back_time = 0;
|
||||
auto k = this->cached_links[j->first].find(i->first);
|
||||
if (k != this->cached_links[j->first].end()) {
|
||||
const auto &back = k->second;
|
||||
@@ -617,7 +617,7 @@ void LinkGraphLegendWindow::DrawWidget(const Rect &r, int widget) const
|
||||
DrawCompanyIcon(cid, CenterBounds(br.left, br.right, sprite_size.width), CenterBounds(br.top, br.bottom, sprite_size.height));
|
||||
}
|
||||
if (IsInsideMM(widget, WID_LGL_SATURATION_FIRST, WID_LGL_SATURATION_LAST + 1)) {
|
||||
uint8 colour = LinkGraphOverlay::LINK_COLOURS[_settings_client.gui.linkgraph_colours][widget - WID_LGL_SATURATION_FIRST];
|
||||
uint8_t 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) {
|
||||
@@ -663,7 +663,7 @@ bool LinkGraphLegendWindow::OnTooltip(Point pt, int widget, TooltipCloseConditio
|
||||
*/
|
||||
void LinkGraphLegendWindow::UpdateOverlayCompanies()
|
||||
{
|
||||
uint32 mask = 0;
|
||||
uint32_t mask = 0;
|
||||
for (uint c = 0; c < MAX_COMPANIES; c++) {
|
||||
if (this->IsWidgetDisabled(c + WID_LGL_COMPANY_FIRST)) continue;
|
||||
if (!this->IsWidgetLowered(c + WID_LGL_COMPANY_FIRST)) continue;
|
||||
|
@@ -30,7 +30,7 @@ struct LinkProperties {
|
||||
uint capacity; ///< Capacity of the link.
|
||||
uint usage; ///< Actual usage of the link.
|
||||
uint planned; ///< Planned usage of the link.
|
||||
uint32 time; ///< Travel time of the link.
|
||||
uint32_t time; ///< Travel time of the link.
|
||||
bool shared; ///< If this is a shared link to be drawn dashed.
|
||||
};
|
||||
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
typedef std::map<StationID, StationLinkMap> LinkMap;
|
||||
typedef std::vector<std::pair<StationID, uint> > StationSupplyList;
|
||||
|
||||
static const uint8 LINK_COLOURS[][12];
|
||||
static const uint8_t LINK_COLOURS[][12];
|
||||
|
||||
/**
|
||||
* Create a link graph overlay for the specified window.
|
||||
@@ -94,7 +94,7 @@ protected:
|
||||
void GetWidgetDpi(DrawPixelInfo *dpi) const;
|
||||
void RebuildCache();
|
||||
|
||||
static void AddStats(CargoID new_cargo, uint new_cap, uint new_usg, uint new_flow, uint32 time, bool new_shared, LinkProperties &cargo);
|
||||
static void AddStats(CargoID 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);
|
||||
};
|
||||
|
||||
|
@@ -10,13 +10,13 @@
|
||||
#ifndef LINKGRAPH_TYPE_H
|
||||
#define LINKGRAPH_TYPE_H
|
||||
|
||||
typedef uint16 LinkGraphID;
|
||||
typedef uint16_t LinkGraphID;
|
||||
static const LinkGraphID INVALID_LINK_GRAPH = UINT16_MAX;
|
||||
|
||||
typedef uint16 LinkGraphJobID;
|
||||
typedef uint16_t LinkGraphJobID;
|
||||
static const LinkGraphJobID INVALID_LINK_GRAPH_JOB = UINT16_MAX;
|
||||
|
||||
typedef uint16 NodeID;
|
||||
typedef uint16_t NodeID;
|
||||
static const NodeID INVALID_NODE = UINT16_MAX;
|
||||
|
||||
enum DistributionType : byte {
|
||||
|
@@ -101,7 +101,7 @@ LinkGraphJob::~LinkGraphJob()
|
||||
/* Link graph has been merged into another one. */
|
||||
if (!LinkGraph::IsValidID(this->link_graph.index)) return;
|
||||
|
||||
uint16 size = this->Size();
|
||||
uint16_t size = this->Size();
|
||||
for (NodeID node_id = 0; node_id < size; ++node_id) {
|
||||
NodeAnnotation &from = this->nodes[node_id];
|
||||
|
||||
|
@@ -258,7 +258,7 @@ void MultiCommodityFlow::Dijkstra(NodeID source_node, PathVector &paths)
|
||||
{
|
||||
typedef std::set<Tannotation *, typename Tannotation::Comparator> AnnoSet;
|
||||
Tedge_iterator iter(this->job);
|
||||
uint16 size = this->job.Size();
|
||||
uint16_t size = this->job.Size();
|
||||
AnnoSet annos;
|
||||
paths.resize(size, nullptr);
|
||||
for (NodeID node = 0; node < size; ++node) {
|
||||
@@ -481,7 +481,7 @@ bool MCF1stPass::EliminateCycles(PathVector &path, NodeID origin_id, NodeID next
|
||||
bool MCF1stPass::EliminateCycles()
|
||||
{
|
||||
bool cycles_found = false;
|
||||
uint16 size = this->job.Size();
|
||||
uint16_t size = this->job.Size();
|
||||
PathVector path(size, nullptr);
|
||||
for (NodeID node = 0; node < size; ++node) {
|
||||
/* Starting at each node in the graph find all cycles involving this
|
||||
@@ -499,7 +499,7 @@ bool MCF1stPass::EliminateCycles()
|
||||
MCF1stPass::MCF1stPass(LinkGraphJob &job) : MultiCommodityFlow(job)
|
||||
{
|
||||
PathVector paths;
|
||||
uint16 size = job.Size();
|
||||
uint16_t size = job.Size();
|
||||
uint accuracy = job.Settings().accuracy;
|
||||
bool more_loops;
|
||||
std::vector<bool> finished_sources(size);
|
||||
@@ -548,7 +548,7 @@ MCF2ndPass::MCF2ndPass(LinkGraphJob &job) : MultiCommodityFlow(job)
|
||||
{
|
||||
this->max_saturation = UINT_MAX; // disable artificial cap on saturation
|
||||
PathVector paths;
|
||||
uint16 size = job.Size();
|
||||
uint16_t size = job.Size();
|
||||
uint accuracy = job.Settings().accuracy;
|
||||
bool demand_left = true;
|
||||
std::vector<bool> finished_sources(size);
|
||||
|
@@ -106,7 +106,7 @@ bool LinkRefresher::HandleRefit(CargoID refit_cargo)
|
||||
v->cargo_type = this->cargo;
|
||||
v->cargo_subtype = GetBestFittingSubType(v, v, this->cargo);
|
||||
|
||||
uint16 mail_capacity = 0;
|
||||
uint16_t mail_capacity = 0;
|
||||
uint amount = e->DetermineCapacity(v, &mail_capacity);
|
||||
|
||||
/* Restore the original cargo type */
|
||||
@@ -160,7 +160,7 @@ 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, uint8 flags, uint num_hops)
|
||||
const Order *LinkRefresher::PredictNextOrder(const Order *cur, const Order *next, uint8_t flags, uint num_hops)
|
||||
{
|
||||
/* 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
|
||||
@@ -224,7 +224,7 @@ void LinkRefresher::RefreshStats(const Order *cur, const Order *next)
|
||||
/* 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.
|
||||
* The result is in tiles/tick (= 2048 km-ish/h). */
|
||||
uint32 time_estimate = DistanceManhattan(st->xy, st_to->xy) * 4096U / this->vehicle->GetDisplayMaxSpeed();
|
||||
uint32_t time_estimate = DistanceManhattan(st->xy, st_to->xy) * 4096U / this->vehicle->GetDisplayMaxSpeed();
|
||||
|
||||
/* If the vehicle is currently full loading, increase the capacities at the station
|
||||
* where it is loading by an estimate of what it would have transported if it wasn't
|
||||
@@ -263,7 +263,7 @@ 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, uint8 flags, uint num_hops)
|
||||
void LinkRefresher::RefreshLinks(const Order *cur, const Order *next, uint8_t flags, uint num_hops)
|
||||
{
|
||||
while (next != nullptr) {
|
||||
|
||||
|
@@ -38,9 +38,9 @@ protected:
|
||||
*/
|
||||
struct RefitDesc {
|
||||
CargoID cargo; ///< Cargo type the vehicle will be carrying.
|
||||
uint16 capacity; ///< Capacity the vehicle will have.
|
||||
uint16 remaining; ///< Capacity remaining from before the previous refit.
|
||||
RefitDesc(CargoID cargo, uint16 capacity, uint16 remaining) :
|
||||
uint16_t capacity; ///< Capacity the vehicle will have.
|
||||
uint16_t remaining; ///< Capacity remaining from before the previous refit.
|
||||
RefitDesc(CargoID cargo, uint16_t capacity, uint16_t remaining) :
|
||||
cargo(cargo), capacity(capacity), remaining(remaining) {}
|
||||
};
|
||||
|
||||
@@ -90,9 +90,9 @@ protected:
|
||||
bool HandleRefit(CargoID refit_cargo);
|
||||
void ResetRefit();
|
||||
void RefreshStats(const Order *cur, const Order *next);
|
||||
const Order *PredictNextOrder(const Order *cur, const Order *next, uint8 flags, uint num_hops = 0);
|
||||
const Order *PredictNextOrder(const Order *cur, const Order *next, uint8_t flags, uint num_hops = 0);
|
||||
|
||||
void RefreshLinks(const Order *cur, const Order *next, uint8 flags, uint num_hops = 0);
|
||||
void RefreshLinks(const Order *cur, const Order *next, uint8_t flags, uint num_hops = 0);
|
||||
};
|
||||
|
||||
#endif /* REFRESH_H */
|
||||
|
Reference in New Issue
Block a user