summaryrefslogtreecommitdiff
path: root/src/station.cpp
diff options
context:
space:
mode:
authorcelestar <celestar@openttd.org>2007-01-25 08:58:09 +0000
committercelestar <celestar@openttd.org>2007-01-25 08:58:09 +0000
commit600cb8a314eb1165bcef1309ebe3b7fd237e9778 (patch)
treee292edda60dfc48c8bacab52f28e2230d012785c /src/station.cpp
parente85cd647e18cb916f008d2c6c7ce985f29f78e9f (diff)
downloadopenttd-600cb8a314eb1165bcef1309ebe3b7fd237e9778.tar.xz
(svn r8401) -Codechange: Make 'IsValidRoadStop' a method of RoadStop and rename it to 'IsValid'
-Codechange: While I'm at it, put 'RoadStop::AllocateRaw' into the protected section
Diffstat (limited to 'src/station.cpp')
-rw-r--r--src/station.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/station.cpp b/src/station.cpp
index 80b039d78..416c41ea1 100644
--- a/src/station.cpp
+++ b/src/station.cpp
@@ -403,7 +403,7 @@ RoadStop *RoadStop::AllocateRaw( void )
/* We don't use FOR_ALL here, because FOR_ALL skips invalid items.
* TODO - This is just a temporary stage, this will be removed. */
for (rs = GetRoadStop(0); rs != NULL; rs = (rs->index + 1U < GetRoadStopPoolSize()) ? GetRoadStop(rs->index + 1U) : NULL) {
- if (!IsValidRoadStop(rs)) {
+ if (!rs->IsValid()) {
RoadStopID index = rs->index;
memset(rs, 0, sizeof(*rs));
@@ -418,3 +418,9 @@ RoadStop *RoadStop::AllocateRaw( void )
return NULL;
}
+
+/** Determines whether a RoadStop is a valid (i.e. existing) one */
+bool RoadStop::IsValid() const
+{
+ return xy != INVALID_TILE;
+}