mirror of https://github.com/OpenTTD/OpenTTD
(svn r7477) -Fix (7451): Allocate(Industry|Town) get called twice when trying to build an industry/town via a command, thus incrementing the number of towns/industries twice when created via a command.
parent
c3d65805e7
commit
8d2c82bc2a
|
@ -1362,8 +1362,6 @@ static Industry *AllocateIndustry(void)
|
||||||
|
|
||||||
if (IsValidIndustry(i)) continue;
|
if (IsValidIndustry(i)) continue;
|
||||||
|
|
||||||
_total_industries++;
|
|
||||||
|
|
||||||
memset(i, 0, sizeof(*i));
|
memset(i, 0, sizeof(*i));
|
||||||
i->index = index;
|
i->index = index;
|
||||||
|
|
||||||
|
@ -1380,6 +1378,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const Ind
|
||||||
uint32 r;
|
uint32 r;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
|
_total_industries++;
|
||||||
i->xy = tile;
|
i->xy = tile;
|
||||||
i->width = i->height = 0;
|
i->width = i->height = 0;
|
||||||
i->type = type;
|
i->type = type;
|
||||||
|
|
|
@ -915,6 +915,7 @@ static void DoCreateTown(Town *t, TileIndex tile, uint32 townnameparts, uint siz
|
||||||
i = t->index;
|
i = t->index;
|
||||||
memset(t, 0, sizeof(Town));
|
memset(t, 0, sizeof(Town));
|
||||||
t->index = i;
|
t->index = i;
|
||||||
|
_total_towns++;
|
||||||
|
|
||||||
t->xy = tile;
|
t->xy = tile;
|
||||||
t->num_houses = 0;
|
t->num_houses = 0;
|
||||||
|
@ -984,8 +985,6 @@ static Town *AllocateTown(void)
|
||||||
if (!IsValidTown(t)) {
|
if (!IsValidTown(t)) {
|
||||||
TownID index = t->index;
|
TownID index = t->index;
|
||||||
|
|
||||||
_total_towns++;
|
|
||||||
|
|
||||||
memset(t, 0, sizeof(Town));
|
memset(t, 0, sizeof(Town));
|
||||||
t->index = index;
|
t->index = index;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue