diff --git a/src/linkgraph/linkgraph.h b/src/linkgraph/linkgraph.h --- a/src/linkgraph/linkgraph.h +++ b/src/linkgraph/linkgraph.h @@ -13,7 +13,7 @@ #include "../core/pool_type.hpp" #include "../station_base.h" #include "../cargotype.h" -#include "../timer/timer_game_calendar.h" +#include "../timer/timer_game_economy.h" #include "../saveload/saveload.h" #include "linkgraph_type.h" #include @@ -43,8 +43,8 @@ public: uint capacity; ///< Capacity of the link. uint usage; ///< Usage of the link. 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. + TimerGameEconomy::Date last_unrestricted_update; ///< When the unrestricted part of the link was last updated. + TimerGameEconomy::Date last_restricted_update; ///< When the restricted part of the link was last updated. NodeID dest_node; ///< Destination of the edge. BaseEdge(NodeID dest_node = INVALID_NODE); @@ -59,11 +59,11 @@ public: * Get the date of the last update to any part of the edge's capacity. * @return Last update. */ - TimerGameCalendar::Date LastUpdate() const { return std::max(this->last_unrestricted_update, this->last_restricted_update); } + TimerGameEconomy::Date LastUpdate() const { return std::max(this->last_unrestricted_update, this->last_restricted_update); } void Update(uint capacity, uint usage, uint32_t time, EdgeUpdateMode mode); - void Restrict() { this->last_unrestricted_update = CalendarTime::INVALID_DATE; } - void Release() { this->last_restricted_update = CalendarTime::INVALID_DATE; } + void Restrict() { this->last_unrestricted_update = EconomyTime::INVALID_DATE; } + void Release() { this->last_restricted_update = EconomyTime::INVALID_DATE; } /** Comparison operator based on \c dest_node. */ bool operator <(const BaseEdge &rhs) const @@ -92,7 +92,7 @@ public: uint demand; ///< Acceptance at the station. StationID station; ///< Station ID. TileIndex xy; ///< Location of the station referred to by the node. - TimerGameCalendar::Date last_update; ///< When the supply was last updated. + TimerGameEconomy::Date last_update; ///< When the supply was last updated. std::vector edges; ///< Sorted list of outgoing edges from this node. @@ -105,7 +105,7 @@ public: void UpdateSupply(uint supply) { this->supply += supply; - this->last_update = TimerGameCalendar::date; + this->last_update = TimerGameEconomy::date; } /** @@ -170,10 +170,10 @@ public: static const uint MIN_TIMEOUT_DISTANCE = 32; /** Number of days before deleting links served only by vehicles stopped in depot. */ - static constexpr TimerGameCalendar::Date STALE_LINK_DEPOT_TIMEOUT = 1024; + static constexpr TimerGameEconomy::Date STALE_LINK_DEPOT_TIMEOUT = 1024; /** Minimum number of days between subsequent compressions of a LG. */ - static constexpr TimerGameCalendar::Date COMPRESSION_INTERVAL = 256; + static constexpr TimerGameEconomy::Date COMPRESSION_INTERVAL = 256; /** * Scale a value from a link graph of age orig_age for usage in one of age @@ -183,7 +183,7 @@ public: * @param orig_age Age of the original link graph. * @return scaled value. */ - inline static uint Scale(uint val, TimerGameCalendar::Date target_age, TimerGameCalendar::Date orig_age) + inline static 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; } @@ -194,10 +194,10 @@ public: * Real constructor. * @param cargo Cargo the link graph is about. */ - LinkGraph(CargoID cargo) : cargo(cargo), last_compression(TimerGameCalendar::date) {} + LinkGraph(CargoID cargo) : cargo(cargo), last_compression(TimerGameEconomy::date) {} void Init(uint size); - void ShiftDates(TimerGameCalendar::Date interval); + void ShiftDates(TimerGameEconomy::Date interval); void Compress(); void Merge(LinkGraph *other); @@ -233,7 +233,7 @@ public: * Get date of last compression. * @return Date of last compression. */ - inline TimerGameCalendar::Date LastCompression() const { return this->last_compression; } + inline TimerGameEconomy::Date LastCompression() const { return this->last_compression; } /** * Get the cargo ID this component's link graph refers to. @@ -248,7 +248,7 @@ public: */ inline uint Monthly(uint base) const { - return base * 30 / (TimerGameCalendar::date - this->last_compression + 1).base(); + return base * 30 / (TimerGameEconomy::date - this->last_compression + 1).base(); } NodeID AddNode(const Station *st); @@ -262,7 +262,7 @@ protected: friend class LinkGraphJob; CargoID cargo; ///< Cargo of this component's link graph. - TimerGameCalendar::Date last_compression; ///< Last time the capacities and supplies were compressed. + TimerGameEconomy::Date last_compression; ///< Last time the capacities and supplies were compressed. NodeVector nodes; ///< Nodes in the component. };