summaryrefslogtreecommitdiff
path: root/src/gfxinit.cpp
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-02-25 20:06:11 +0000
committeryexo <yexo@openttd.org>2010-02-25 20:06:11 +0000
commit7ff55502f04f9f75b01879ea04518c14d4706046 (patch)
treef48f911cf9861a0053bd35b92bf1e0ece0a5bf58 /src/gfxinit.cpp
parenta9c8dbc0a0e1f1fc4434cf0c83ff658ab8d9e3d9 (diff)
downloadopenttd-7ff55502f04f9f75b01879ea04518c14d4706046.tar.xz
(svn r19256) -Codechange: use a constructor/destructor for GRFConfig to make sure all members are properly initialized
Diffstat (limited to 'src/gfxinit.cpp')
-rw-r--r--src/gfxinit.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp
index f2678ae09..6ba87eee1 100644
--- a/src/gfxinit.cpp
+++ b/src/gfxinit.cpp
@@ -178,8 +178,7 @@ static void LoadSpriteTables()
* so we have to manually add it, and then remove it later.
*/
GRFConfig *top = _grfconfig;
- GRFConfig *master = CallocT<GRFConfig>(1);
- master->filename = strdup(used_set->files[GFT_EXTRA].filename);
+ GRFConfig *master = new GRFConfig(used_set->files[GFT_EXTRA].filename);
FillGRFDetails(master, false);
master->windows_paletted = (used_set->palette == PAL_WINDOWS);
ClrBit(master->flags, GCF_INIT_ONLY);
@@ -189,7 +188,7 @@ static void LoadSpriteTables()
LoadNewGRF(SPR_NEWGRFS_BASE, i);
/* Free and remove the top element. */
- ClearGRFConfig(&master);
+ delete master;
_grfconfig = top;
}