|
@@ -11,13 +11,13 @@
|
|
|
#define LINKGRAPH_H
|
|
|
|
|
|
#include "../core/pool_type.hpp"
|
|
|
#include "../core/smallmap_type.hpp"
|
|
|
#include "../station_base.h"
|
|
|
#include "../cargotype.h"
|
|
|
#include "../date_func.h"
|
|
|
#include "../timer/timer_game_calendar.h"
|
|
|
#include "../saveload/saveload.h"
|
|
|
#include "linkgraph_type.h"
|
|
|
#include <utility>
|
|
|
|
|
|
class LinkGraph;
|
|
|
|
|
@@ -103,13 +103,13 @@ public:
|
|
|
* Update the node's supply and set last_update to the current date.
|
|
|
* @param supply Supply to be added.
|
|
|
*/
|
|
|
void UpdateSupply(uint supply)
|
|
|
{
|
|
|
this->supply += supply;
|
|
|
this->last_update = _date;
|
|
|
this->last_update = TimerGameCalendar::date;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* Update the node's location on the map.
|
|
|
* @param xy New location.
|
|
|
*/
|
|
@@ -192,13 +192,13 @@ public:
|
|
|
/** Bare constructor, only for save/load. */
|
|
|
LinkGraph() : cargo(INVALID_CARGO), last_compression(0) {}
|
|
|
/**
|
|
|
* Real constructor.
|
|
|
* @param cargo Cargo the link graph is about.
|
|
|
*/
|
|
|
LinkGraph(CargoID cargo) : cargo(cargo), last_compression(_date) {}
|
|
|
LinkGraph(CargoID cargo) : cargo(cargo), last_compression(TimerGameCalendar::date) {}
|
|
|
|
|
|
void Init(uint size);
|
|
|
void ShiftDates(int interval);
|
|
|
void Compress();
|
|
|
void Merge(LinkGraph *other);
|
|
|
|
|
@@ -246,13 +246,13 @@ public:
|
|
|
* Scale a value to its monthly equivalent, based on last compression.
|
|
|
* @param base Value to be scaled.
|
|
|
* @return Scaled value.
|
|
|
*/
|
|
|
inline uint Monthly(uint base) const
|
|
|
{
|
|
|
return base * 30 / (_date - this->last_compression + 1);
|
|
|
return base * 30 / (TimerGameCalendar::date - this->last_compression + 1);
|
|
|
}
|
|
|
|
|
|
NodeID AddNode(const Station *st);
|
|
|
void RemoveNode(NodeID id);
|
|
|
|
|
|
protected:
|