summaryrefslogtreecommitdiff
path: root/src/oldpool.h
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-05-22 14:23:36 +0000
committersmatz <smatz@openttd.org>2009-05-22 14:23:36 +0000
commit04723b240ebc7384954f73590be517ad2a47ce04 (patch)
treeac4bd41288d9d96a256ea0c702d1a75502bfecd9 /src/oldpool.h
parentb687ac51ee5e8628ed56319df573c903c0c86ef3 (diff)
downloadopenttd-04723b240ebc7384954f73590be517ad2a47ce04.tar.xz
(svn r16377) -Codechange: unify FOR_ALL_* macros, use separate index variable instead of var->index
Diffstat (limited to 'src/oldpool.h')
-rw-r--r--src/oldpool.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/oldpool.h b/src/oldpool.h
index ab496d2c3..17b791ed7 100644
--- a/src/oldpool.h
+++ b/src/oldpool.h
@@ -376,4 +376,10 @@ public:
template type *PoolItem<type, type##ID, &_##name##_pool>::AllocateSafeRaw(uint &first); \
template bool PoolItem<type, type##ID, &_##name##_pool>::CanAllocateItem(uint count);
+#define FOR_ALL_ITEMS_FROM(type, iter, var, start) \
+ for (size_t iter = start; var = NULL, iter < type::GetPoolSize(); iter++) \
+ if ((var = type::Get(iter))->IsValid())
+
+#define FOR_ALL_ITEMS(type, iter, var) FOR_ALL_ITEMS_FROM(type, iter, var, 0)
+
#endif /* OLDPOOL_H */