diff options
author | tron <tron@openttd.org> | 2006-10-28 11:55:29 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-10-28 11:55:29 +0000 |
commit | e397b721cda24507068a2028db58f28d7198fce9 (patch) | |
tree | 0353b720b14d64966c30ec3e7f905a9eecfa4aca /town.h | |
parent | 02ae75b380ee26b7c12837b28f753894522fb0a6 (diff) | |
download | openttd-e397b721cda24507068a2028db58f28d7198fce9.tar.xz |
(svn r6986) Use the pool macros for the Town pool
Diffstat (limited to 'town.h')
-rw-r--r-- | town.h | 20 |
1 files changed, 2 insertions, 18 deletions
@@ -152,7 +152,7 @@ bool CheckforTownRating(uint32 flags, Town *t, byte type); VARDEF const Town** _town_sort; -extern MemoryPool _town_pool; +DECLARE_POOL(Town, Town, 3, 8000) /** * Check if a Town really exists. @@ -162,22 +162,6 @@ static inline bool IsValidTown(const Town* town) return town->xy != 0; } -/** - * Get the pointer to the town with index 'index' - */ -static inline Town *GetTown(uint index) -{ - return (Town*)GetItemFromPool(&_town_pool, index); -} - -/** - * Get the current size of the TownPool - */ -static inline uint16 GetTownPoolSize(void) -{ - return _town_pool.total_items; -} - VARDEF uint _total_towns; static inline TownID GetTownArraySize(void) @@ -225,7 +209,7 @@ static inline void DeleteTown(Town *t) t->xy = 0; } -#define FOR_ALL_TOWNS_FROM(t, start) for (t = GetTown(start); t != NULL; t = (t->index + 1 < GetTownPoolSize()) ? GetTown(t->index + 1) : NULL) if (IsValidTown(t)) +#define FOR_ALL_TOWNS_FROM(t, start) for (t = GetTown(start); t != NULL; t = (t->index + 1U < GetTownPoolSize()) ? GetTown(t->index + 1U) : NULL) if (IsValidTown(t)) #define FOR_ALL_TOWNS(t) FOR_ALL_TOWNS_FROM(t, 0) VARDEF bool _town_sort_dirty; |