summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-02-12 18:41:24 +0000
committerrubidium <rubidium@openttd.org>2011-02-12 18:41:24 +0000
commit2d4d43d00ce098d9f3de47ce878aa8477fd1f6c8 (patch)
treebbadbc20b14a2c28997e9e5816fddbc1240dc0a6 /src
parentd8cada7563228809936c0a2b21c5c098848636eb (diff)
downloadopenttd-2d4d43d00ce098d9f3de47ce878aa8477fd1f6c8.tar.xz
(svn r22065) -Fix [FS#4500]: pool allocation checks triggered when towns could not be built
Diffstat (limited to 'src')
-rw-r--r--src/town_cmd.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index ff4a10ae9..43961273d 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -1756,6 +1756,12 @@ static Town *CreateRandomTown(uint attempts, uint32 townnameparts, TownSize size
* placement is so bad it couldn't grow at all */
if (t->population > 0) return t;
DoCommand(t->xy, t->index, 0, DC_EXEC, CMD_DELETE_TOWN);
+
+ /* We already know that we can allocate a single town when
+ * entering this function. However, we create and delete
+ * a town which "resets" the allocation checks. As such we
+ * need to check again when assertions are enabled. */
+ assert(Town::CanAllocateItem());
} while (--attempts != 0);
return NULL;