summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authorfonsinchen <fonsinchen@openttd.org>2014-03-06 21:19:41 +0000
committerfonsinchen <fonsinchen@openttd.org>2014-03-06 21:19:41 +0000
commit5d3fcce72596dddbaac3229b400bfc9023489e1c (patch)
tree6e9913649c61679d720ff567632b42e357e20542 /src/station_cmd.cpp
parentaee9444c1bdfbc589c99fd2daf3c61868cb7fa4b (diff)
downloadopenttd-5d3fcce72596dddbaac3229b400bfc9023489e1c.tar.xz
(svn r26393) -Fix: Update distances between link graph nodes when station sign is moved
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 1aa9ab0de..55b6fae14 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -641,6 +641,14 @@ static void UpdateStationSignCoord(BaseStation *st)
/* clamp sign coord to be inside the station rect */
st->xy = TileXY(ClampU(TileX(st->xy), r->left, r->right), ClampU(TileY(st->xy), r->top, r->bottom));
st->UpdateVirtCoord();
+
+ if (!Station::IsExpected(st)) return;
+ Station *full_station = Station::From(st);
+ for (CargoID c = 0; c < NUM_CARGO; ++c) {
+ LinkGraphID lg = full_station->goods[c].link_graph;
+ if (!LinkGraph::IsValidID(lg)) continue;
+ LinkGraph::Get(lg)->UpdateDistances(full_station->goods[c].node, st->xy);
+ }
}
/**