From 2d4d43d00ce098d9f3de47ce878aa8477fd1f6c8 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 12 Feb 2011 18:41:24 +0000 Subject: (svn r22065) -Fix [FS#4500]: pool allocation checks triggered when towns could not be built --- src/town_cmd.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') 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; -- cgit v1.2.3-54-g00ecf