summaryrefslogtreecommitdiff
path: root/station.h
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2006-08-26 19:14:02 +0000
committertruelight <truelight@openttd.org>2006-08-26 19:14:02 +0000
commitd417827516505e27319ae4ab630161e404cc1a58 (patch)
treed964a18446017288b6c371384ad079567e48d21f /station.h
parent587b2a8826274242e400124eb5bb8704a046ff81 (diff)
downloadopenttd-d417827516505e27319ae4ab630161e404cc1a58.tar.xz
(svn r6151) -Codechange: DeleteStation/DeleteRoadStop removes a station/RoadStop from the pool
-Codechange: DestroyStation/DestroyRoadStop is called by DeleteStation/DeleteRoadStop to remove all things where a station/RoadStop depends on. Last 2 changes to prepare for new pool system. Not pretty now, will be soon.
Diffstat (limited to 'station.h')
-rw-r--r--station.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/station.h b/station.h
index 36b7334e5..3c6bab008 100644
--- a/station.h
+++ b/station.h
@@ -184,6 +184,14 @@ static inline bool IsValidStationID(StationID index)
return index < GetStationPoolSize() && IsValidStation(GetStation(index));
}
+void DestroyStation(Station *st);
+
+static inline void DeleteStation(Station *st)
+{
+ DestroyStation(st);
+ st->xy = 0;
+}
+
#define FOR_ALL_STATIONS_FROM(st, start) for (st = GetStation(start); st != NULL; st = (st->index + 1 < GetStationPoolSize()) ? GetStation(st->index + 1) : NULL) if (IsValidStation(st))
#define FOR_ALL_STATIONS(st) FOR_ALL_STATIONS_FROM(st, 0)
@@ -216,6 +224,14 @@ static inline bool IsValidRoadStop(const RoadStop *rs)
return rs->used;
}
+void DestroyRoadStop(RoadStop* rs);
+
+static inline void DeleteRoadStop(RoadStop *rs)
+{
+ DestroyRoadStop(rs);
+ rs->used = false;
+}
+
#define FOR_ALL_ROADSTOPS_FROM(rs, start) for (rs = GetRoadStop(start); rs != NULL; rs = (rs->index + 1 < GetRoadStopPoolSize()) ? GetRoadStop(rs->index + 1) : NULL) if (IsValidRoadStop(rs))
#define FOR_ALL_ROADSTOPS(rs) FOR_ALL_ROADSTOPS_FROM(rs, 0)