diff options
author | truelight <truelight@openttd.org> | 2006-08-22 20:41:26 +0000 |
---|---|---|
committer | truelight <truelight@openttd.org> | 2006-08-22 20:41:26 +0000 |
commit | 5fd9aeb12b75a3971e86e5b7d1701115f57fbc12 (patch) | |
tree | c177232d70dec4fb6d7cd2dbac79206e86ee2daa /town.h | |
parent | 2e0d16026b77d0ef2ed233f16beb25bbaf836941 (diff) | |
download | openttd-5fd9aeb12b75a3971e86e5b7d1701115f57fbc12.tar.xz |
(svn r6055) -Codechange: added GetXXXArraySize, which returns HighestID + 1 (or, will do that).
It isn't the best name, but we couldn't find any better.
This unifies the pool-system even more.
Diffstat (limited to 'town.h')
-rw-r--r-- | town.h | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -179,6 +179,18 @@ static inline uint16 GetTownPoolSize(void) return _town_pool.total_items; } +VARDEF uint _total_towns; + +static inline TownID GetTownArraySize(void) +{ + /* TODO - This isn't the real content of the function, but + * with the new pool-system this will be replaced with one that + * _really_ returns the highest index + 1. Now it just returns + * the next safe value we are sure about everything is below. + */ + return _total_towns + 1; +} + static inline bool IsValidTownID(uint index) { return index < GetTownPoolSize() && IsValidTown(GetTown(index)); @@ -187,8 +199,6 @@ static inline bool IsValidTownID(uint 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; |