diff options
author | belugas <belugas@openttd.org> | 2007-05-31 15:40:36 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2007-05-31 15:40:36 +0000 |
commit | f8da1b6e1a0216315b1e84fe54a94779dd288754 (patch) | |
tree | 082f8e8242493f956b635dfb21392821d27de0e2 /src/newgrf.cpp | |
parent | 253aa1b0b03aed312581de35d7e35bc17b96190f (diff) | |
download | openttd-f8da1b6e1a0216315b1e84fe54a94779dd288754.tar.xz |
(svn r10001) -Codechange: Add support for removing dynamically allocated newgrf data
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r-- | src/newgrf.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp index cc44682d0..8d50fef12 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -4326,6 +4326,24 @@ static void ResetCustomIndustries() IndustrySpec *ind = file->industryspec[i]; if (ind != NULL) { + /* We need to remove the sounds array */ + if (HASBIT(ind->cleanup_flag, CLEAN_RANDOMSOUNDS)) { + free((void*)ind->random_sounds); + } + + /* We need to remove the tiles layouts */ + if (HASBIT(ind->cleanup_flag, CLEAN_TILELSAYOUT) && ind->table != NULL) { + for (int j = 0; j < ind->num_table; j++) { + /* remove the individual layouts */ + if (ind->table[j] != NULL) { + free((IndustryTileTable*)ind->table[j]); + } + } + /* remove the layouts pointers */ + free((IndustryTileTable**)ind->table); + ind->table = NULL; + } + free(ind); ind = NULL; } |