summaryrefslogtreecommitdiff
path: root/waypoint.h
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-10-28 11:59:10 +0000
committertron <tron@openttd.org>2006-10-28 11:59:10 +0000
commit821c97b747de6266aa813b0d636ada1e00e6f9aa (patch)
treeda124f7555cdb90b1b0ed0f0796b95df3e49750f /waypoint.h
parent7a984c44cc5cf9d6c4df745253ddea452e14e647 (diff)
downloadopenttd-821c97b747de6266aa813b0d636ada1e00e6f9aa.tar.xz
(svn r6987) Use the pool macros for the Waypoint pool
Diffstat (limited to 'waypoint.h')
-rw-r--r--waypoint.h20
1 files changed, 2 insertions, 18 deletions
diff --git a/waypoint.h b/waypoint.h
index da3106656..59ffa84ad 100644
--- a/waypoint.h
+++ b/waypoint.h
@@ -24,23 +24,7 @@ struct Waypoint {
byte deleted; ///< Delete counter. If greater than 0 then it is decremented until it reaches 0; the waypoint is then is deleted.
};
-extern MemoryPool _waypoint_pool;
-
-/**
- * Get the pointer to the waypoint with index 'index'
- */
-static inline Waypoint *GetWaypoint(WaypointID index)
-{
- return (Waypoint*)GetItemFromPool(&_waypoint_pool, index);
-}
-
-/**
- * Get the current size of the WaypointPool
- */
-static inline uint16 GetWaypointPoolSize(void)
-{
- return _waypoint_pool.total_items;
-}
+DECLARE_POOL(Waypoint, Waypoint, 3, 8000)
/**
* Check if a Waypoint really exists.
@@ -63,7 +47,7 @@ static inline void DeleteWaypoint(Waypoint *wp)
wp->xy = 0;
}
-#define FOR_ALL_WAYPOINTS_FROM(wp, start) for (wp = GetWaypoint(start); wp != NULL; wp = (wp->index + 1 < GetWaypointPoolSize()) ? GetWaypoint(wp->index + 1) : NULL) if (IsValidWaypoint(wp))
+#define FOR_ALL_WAYPOINTS_FROM(wp, start) for (wp = GetWaypoint(start); wp != NULL; wp = (wp->index + 1U < GetWaypointPoolSize()) ? GetWaypoint(wp->index + 1U) : NULL) if (IsValidWaypoint(wp))
#define FOR_ALL_WAYPOINTS(wp) FOR_ALL_WAYPOINTS_FROM(wp, 0)