summaryrefslogtreecommitdiff
path: root/src/newgrf.cpp
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2009-07-05 20:59:42 +0000
committeryexo <yexo@openttd.org>2009-07-05 20:59:42 +0000
commit1cf14caee034c585647e87431e1385f0cc89b6b8 (patch)
tree20780d8f40c9ea8b895f45b576ac28d90ec62985 /src/newgrf.cpp
parented549f7563e1ecf9c79f8dbedd1e2e3fd94257e6 (diff)
downloadopenttd-1cf14caee034c585647e87431e1385f0cc89b6b8.tar.xz
(svn r16755) -Codechange: apply some codestyle to newgrf.cpp
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r--src/newgrf.cpp64
1 files changed, 25 insertions, 39 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index cd772f5d5..fa56cfe8e 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -5420,12 +5420,9 @@ static void ResetCustomStations()
static void ResetCustomHouses()
{
- GRFFile *file;
- uint i;
-
- for (file = _first_grffile; file != NULL; file = file->next) {
+ for (GRFFile *file = _first_grffile; file != NULL; file = file->next) {
if (file->housespec == NULL) continue;
- for (i = 0; i < HOUSE_MAX; i++) {
+ for (uint i = 0; i < HOUSE_MAX; i++) {
free(file->housespec[i]);
}
@@ -5436,56 +5433,45 @@ static void ResetCustomHouses()
static void ResetCustomIndustries()
{
- GRFFile *file;
-
- for (file = _first_grffile; file != NULL; file = file->next) {
- uint i;
+ for (GRFFile *file = _first_grffile; file != NULL; file = file->next) {
/* We are verifiying both tiles and industries specs loaded from the grf file
* First, let's deal with industryspec */
if (file->industryspec != NULL) {
- for (i = 0; i < NUM_INDUSTRYTYPES; i++) {
+ for (uint i = 0; i < NUM_INDUSTRYTYPES; i++) {
IndustrySpec *ind = file->industryspec[i];
+ if (ind == NULL) continue;
- 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 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((void*)ind->table[j]);
- }
- }
- /* remove the layouts pointers */
- free((void*)ind->table);
- ind->table = NULL;
+ /* 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 */
+ free((void*)ind->table[j]);
}
-
- free(ind);
- ind = NULL;
+ /* remove the layouts pointers */
+ free((void*)ind->table);
+ ind->table = NULL;
}
+
+ free(ind);
}
free(file->industryspec);
file->industryspec = NULL;
}
- if (file->indtspec != NULL) {
- for (i = 0; i < NUM_INDUSTRYTILES; i++) {
- if (file->indtspec[i] != NULL) {
- free(file->indtspec[i]);
- file->indtspec[i] = NULL;
- }
- }
-
- free(file->indtspec);
- file->indtspec = NULL;
+ if (file->indtspec == NULL) continue;
+ for (uint i = 0; i < NUM_INDUSTRYTILES; i++) {
+ free(file->indtspec[i]);
}
+
+ free(file->indtspec);
+ file->indtspec = NULL;
}
}