From 4cb479e083d8edd3005b8db00f350b9fdb3bf2a6 Mon Sep 17 00:00:00 2001 From: tron Date: Sat, 28 Oct 2006 11:32:45 +0000 Subject: (svn r6979) Use the pool macros for the Industry pool --- industry.h | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'industry.h') diff --git a/industry.h b/industry.h index cc2ee4576..7369450db 100644 --- a/industry.h +++ b/industry.h @@ -80,7 +80,7 @@ typedef struct IndustrySpec { const IndustrySpec *GetIndustrySpec(IndustryType thistype); -extern MemoryPool _industry_pool; +DECLARE_POOL(Industry, Industry, 3, 8000) /** * Check if an Industry really exists. @@ -90,22 +90,6 @@ static inline bool IsValidIndustry(const Industry *industry) return industry->xy != 0; } -/** - * Get the pointer to the industry with index 'index' - */ -static inline Industry *GetIndustry(uint index) -{ - return (Industry*)GetItemFromPool(&_industry_pool, index); -} - -/** - * Get the current size of the IndustryPool - */ -static inline uint16 GetIndustryPoolSize(void) -{ - return _industry_pool.total_items; -} - VARDEF int _total_industries; static inline IndustryID GetIndustryArraySize(void) @@ -150,7 +134,7 @@ static inline void DeleteIndustry(Industry *i) i->xy = 0; } -#define FOR_ALL_INDUSTRIES_FROM(i, start) for (i = GetIndustry(start); i != NULL; i = (i->index + 1 < GetIndustryPoolSize()) ? GetIndustry(i->index + 1) : NULL) if (IsValidIndustry(i)) +#define FOR_ALL_INDUSTRIES_FROM(i, start) for (i = GetIndustry(start); i != NULL; i = (i->index + 1U < GetIndustryPoolSize()) ? GetIndustry(i->index + 1U) : NULL) if (IsValidIndustry(i)) #define FOR_ALL_INDUSTRIES(i) FOR_ALL_INDUSTRIES_FROM(i, 0) VARDEF const Industry** _industry_sort; -- cgit v1.2.3-70-g09d2