diff src/town_cmd.cpp @ 17325:46688a193806 draft

(svn r22065) -Fix [FS#4500]: pool allocation checks triggered when towns could not be built
author rubidium <rubidium@openttd.org>
date Sat, 12 Feb 2011 18:41:24 +0000
parents 84f869ec145a
children ed4333ee5e4b
line wrap: on
line diff
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -1756,6 +1756,12 @@
 		 * 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;