summaryrefslogtreecommitdiff
path: root/src/core/pool_func.hpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2011-02-09 18:55:51 +0000
committersmatz <smatz@openttd.org>2011-02-09 18:55:51 +0000
commitfbfb0ffbf24b7ea2630b4b3caee63d09964da75b (patch)
tree67be7735e5e0c92c21dd572a6349b16e62d88f23 /src/core/pool_func.hpp
parent67cbee4f6476874e5a657412b9ec0033a443562f (diff)
downloadopenttd-fbfb0ffbf24b7ea2630b4b3caee63d09964da75b.tar.xz
(svn r22041) -Codechange: add a check that we called PoolItem::CanAllocateItem() before actually allocating it
Diffstat (limited to 'src/core/pool_func.hpp')
-rw-r--r--src/core/pool_func.hpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/pool_func.hpp b/src/core/pool_func.hpp
index 2f87d3de2..299aee86c 100644
--- a/src/core/pool_func.hpp
+++ b/src/core/pool_func.hpp
@@ -123,6 +123,10 @@ DEFINE_POOL_METHOD(void *)::GetNew(size_t size)
{
size_t index = this->FindFirstFree();
+#ifdef OTTD_ASSERT
+ assert(this->checked != 0);
+ this->checked--;
+#endif /* OTTD_ASSERT */
if (index == NO_FREE_ITEM) {
error("%s: no more free items", this->name);
}