mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r22065) -Fix [FS#4500]: pool allocation checks triggered when towns could not be built
This commit is contained in:
parent
d8cada7563
commit
2d4d43d00c
|
@ -1756,6 +1756,12 @@ static Town *CreateRandomTown(uint attempts, uint32 townnameparts, TownSize size
|
||||||
* placement is so bad it couldn't grow at all */
|
* placement is so bad it couldn't grow at all */
|
||||||
if (t->population > 0) return t;
|
if (t->population > 0) return t;
|
||||||
DoCommand(t->xy, t->index, 0, DC_EXEC, CMD_DELETE_TOWN);
|
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);
|
} while (--attempts != 0);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
Loading…
Reference in New Issue