summaryrefslogtreecommitdiff
path: root/src/oldpool_func.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-01-09 15:01:15 +0000
committerrubidium <rubidium@openttd.org>2009-01-09 15:01:15 +0000
commit0464e9f864da7b71fdf7b568916596fbb8a614bb (patch)
tree86ecd22a30e9df98841e74d530337206a9a322c9 /src/oldpool_func.h
parent07c5fb2a028dbb97e3c28d267c49131aaba4facb (diff)
downloadopenttd-0464e9f864da7b71fdf7b568916596fbb8a614bb.tar.xz
(svn r14935) -Fix [FS#2498]: the new operator may not return NULL, so don't.
Diffstat (limited to 'src/oldpool_func.h')
-rw-r--r--src/oldpool_func.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/oldpool_func.h b/src/oldpool_func.h
index 3fbed16a7..82b451617 100644
--- a/src/oldpool_func.h
+++ b/src/oldpool_func.h
@@ -11,7 +11,8 @@
* Allocate a pool item; possibly allocate a new block in the pool.
* @param first the first pool item to start searching
* @pre first <= Tpool->GetSize()
- * @return the allocated pool item (or NULL when the pool is full).
+ * @pre CanAllocateItem()
+ * @return the allocated pool item
*/
template<typename T, typename Tid, OldMemoryPool<T> *Tpool> T *PoolItem<T, Tid, Tpool>::AllocateSafeRaw(uint &first)
{
@@ -31,7 +32,8 @@ template<typename T, typename Tid, OldMemoryPool<T> *Tpool> T *PoolItem<T, Tid,
/* Check if we can add a block to the pool */
if (Tpool->AddBlockToPool()) return AllocateRaw(first);
- return NULL;
+ /* One should *ALWAYS* be sure to have enough space before making vehicles! */
+ NOT_REACHED();
}
/**