@@ -170,27 +170,27 @@ 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;
static inline bool IsTownIndex(uint index)
static inline bool IsValidTownID(uint index)
return index < GetTownPoolSize();
return index < GetTownPoolSize() && IsValidTown(GetTown(index));
#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(t) FOR_ALL_TOWNS_FROM(t, 0)
VARDEF uint _total_towns; // For the AI: the amount of towns active
VARDEF bool _town_sort_dirty;
VARDEF byte _town_sort_order;
VARDEF Town *_cleared_town;
VARDEF int _cleared_town_rating;