(svn r26646) -Fix [FS#6041]: Save locations instead of distances in link graphs to reduce size.

This commit is contained in:
fonsinchen
2014-06-14 13:35:39 +00:00
parent e8e5cdde03
commit 957f5ca117
7 changed files with 71 additions and 52 deletions

View File

@@ -49,8 +49,9 @@ public:
uint supply; ///< Supply at the station.
uint demand; ///< Acceptance at the station.
StationID station; ///< Station ID.
TileIndex xy; ///< Location of the station referred to by the node.
Date last_update; ///< When the supply was last updated.
void Init(StationID st = INVALID_STATION, uint demand = 0);
void Init(TileIndex xy = INVALID_TILE, StationID st = INVALID_STATION, uint demand = 0);
};
/**
@@ -60,13 +61,12 @@ public:
* the column as next_edge.
*/
struct BaseEdge {
uint distance; ///< Length of the link.
uint capacity; ///< Capacity of the link.
uint usage; ///< Usage of the link.
Date last_unrestricted_update; ///< When the unrestricted part of the link was last updated.
Date last_restricted_update; ///< When the restricted part of the link was last updated.
NodeID next_edge; ///< Destination of next valid edge starting at the same source node.
void Init(uint distance = 0);
void Init();
};
/**
@@ -98,12 +98,6 @@ public:
*/
uint Usage() const { return this->edge.usage; }
/**
* Get edge's distance.
* @return Distance.
*/
uint Distance() const { return this->edge.distance; }
/**
* Get the date of the last update to the edge's unrestricted capacity.
* @return Last update.
@@ -169,6 +163,12 @@ public:
* @return Last update.
*/
Date LastUpdate() const { return this->node.last_update; }
/**
* Get the location of the station associated with the node.
* @return Location of the station.
*/
TileIndex XY() const { return this->node.xy; }
};
/**
@@ -412,6 +412,15 @@ public:
this->node.last_update = _date;
}
/**
* Update the node's location on the map.
* @param xy New location.
*/
void UpdateLocation(TileIndex xy)
{
this->node.xy = xy;
}
/**
* Set the node's demand.
* @param demand New demand for the node.
@@ -513,7 +522,6 @@ public:
NodeID AddNode(const Station *st);
void RemoveNode(NodeID id);
void UpdateDistances(NodeID id, TileIndex xy);
protected:
friend class LinkGraph::ConstNode;