summaryrefslogtreecommitdiff
path: root/src/waypoint.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-07-17 20:21:24 +0000
committerrubidium <rubidium@openttd.org>2009-07-17 20:21:24 +0000
commit06ea681b5fa361b34000351bcd248ee46c2a939e (patch)
treebcda240773c51bf9617fea6bf60e11631c74e150 /src/waypoint.cpp
parent84df3ba2b40054b751fd9d39c3a9b3a7589422b8 (diff)
downloadopenttd-06ea681b5fa361b34000351bcd248ee46c2a939e.tar.xz
(svn r16860) -Codechange: introduce a helper to assign a station spec to Waypoints
Diffstat (limited to 'src/waypoint.cpp')
-rw-r--r--src/waypoint.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/waypoint.cpp b/src/waypoint.cpp
index e245627e5..015ca8941 100644
--- a/src/waypoint.cpp
+++ b/src/waypoint.cpp
@@ -91,6 +91,25 @@ Waypoint::~Waypoint()
this->sign.MarkDirty();
}
+/**
+ * Assign a station spec to this waypoint.
+ * @param index the index of the spec from the waypoint specs
+ */
+void Waypoint::AssignStationSpec(uint index)
+{
+ const StationSpec *statspec = GetCustomStationSpec(STAT_CLASS_WAYP, index);
+
+ if (statspec != NULL) {
+ this->spec.spec = statspec;
+ this->spec.grfid = statspec->grffile->grfid;
+ this->spec.localidx = statspec->localidx;
+ } else {
+ this->spec.spec = NULL;
+ this->spec.grfid = 0;
+ this->spec.localidx = 0;
+ }
+}
+
void InitializeWaypoints()
{
_waypoint_pool.CleanPool();