(svn r19256) -Codechange: use a constructor/destructor for GRFConfig to make sure all members are properly initialized

This commit is contained in:
yexo
2010-02-25 20:06:11 +00:00
parent b21278659c
commit daf89297fe
7 changed files with 32 additions and 33 deletions

View File

@@ -44,7 +44,7 @@ static void Load_NGRF()
{
ClearGRFConfigList(&_grfconfig);
while (SlIterateArray() != -1) {
GRFConfig *c = CallocT<GRFConfig>(1);
GRFConfig *c = new GRFConfig();
SlObject(c, _grfconfig_desc);
if (CheckSavegameVersion(101)) c->windows_paletted = (_use_palette == PAL_WINDOWS);
AppendToGRFConfigList(&_grfconfig, c);

View File

@@ -1519,9 +1519,8 @@ static bool LoadTTDPatchExtraChunks(LoadgameState *ls, int num)
uint32 grfid = ReadUint32(ls);
if (ReadByte(ls) == 1) {
GRFConfig *c = CallocT<GRFConfig>(1);
GRFConfig *c = new GRFConfig("TTDP game, no information");
c->ident.grfid = grfid;
c->filename = strdup("TTDP game, no information");
AppendToGRFConfigList(&_grfconfig, c);
DEBUG(oldloader, 3, "TTDPatch game using GRF file with GRFID %0X", BSWAP32(c->ident.grfid));