(svn r6058) -Fix: Get(Industry|Town)ArraySize could never return 0

Note: _total_towns and _total_industries willb e removed soon, so this 'hack' is okay, for now ;)
This commit is contained in:
truelight
2006-08-22 21:17:19 +00:00
parent a21b2750bd
commit 42a0c0b3fe
4 changed files with 6 additions and 8 deletions

View File

@@ -952,8 +952,7 @@ static Town *AllocateTown(void)
if (!IsValidTown(t)) {
TownID index = t->index;
if (t->index > _total_towns)
_total_towns = t->index;
if (t->index >= _total_towns) _total_towns = t->index + 1;
memset(t, 0, sizeof(Town));
t->index = index;
@@ -1956,8 +1955,7 @@ static void Load_TOWN(void)
t = GetTown(index);
SlObject(t, _town_desc);
if ((uint)index > _total_towns)
_total_towns = index;
if ((uint)index >= _total_towns) _total_towns = index + 1;
}
/* This is to ensure all pointers are within the limits of