summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-07-24 10:14:39 +0000
committeralberth <alberth@openttd.org>2010-07-24 10:14:39 +0000
commitbe6c0584240caf420b2475a0be036391e842e8af (patch)
tree6111751cf5526e1eb41176782d84766c4e9ed185 /src/saveload
parent645b6ce77345867fa96861843197481131566c46 (diff)
downloadopenttd-be6c0584240caf420b2475a0be036391e842e8af.tar.xz
(svn r20211) -Codechange: Indented code should have curly braces around it.
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp3
-rw-r--r--src/saveload/oldloader_sl.cpp3
-rw-r--r--src/saveload/saveload.cpp13
-rw-r--r--src/saveload/vehicle_sl.cpp3
4 files changed, 13 insertions, 9 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index b768e33ef..56cb20a3c 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -638,8 +638,9 @@ bool AfterLoadGame()
* a company does not exist yet. So create one here.
* 1 exeption: network-games. Those can have 0 companies
* But this exeption is not true for non dedicated network_servers! */
- if (!Company::IsValidID(COMPANY_FIRST) && (!_networking || (_networking && _network_server && !_network_dedicated)))
+ if (!Company::IsValidID(COMPANY_FIRST) && (!_networking || (_networking && _network_server && !_network_dedicated))) {
DoStartupNewCompany(false);
+ }
/* Fix the cache for cargo payments. */
CargoPayment *cp;
diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp
index 0bef6045a..cabbcb0ac 100644
--- a/src/saveload/oldloader_sl.cpp
+++ b/src/saveload/oldloader_sl.cpp
@@ -993,8 +993,9 @@ static bool LoadOldCompany(LoadgameState *ls, int num)
if (num == 0) {
/* If the first company has no name, make sure we call it UNNAMED */
- if (c->name_1 == 0)
+ if (c->name_1 == 0) {
c->name_1 = STR_SV_UNNAMED;
+ }
} else {
/* Beside some multiplayer maps (1 on 1), which we don't official support,
* all other companys are an AI.. mark them as such */
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index c44703157..ac37c9566 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -409,8 +409,9 @@ static uint SlReadSimpleGamma()
i &= ~0x40;
if (HasBit(i, 5)) {
i &= ~0x20;
- if (HasBit(i, 4))
+ if (HasBit(i, 4)) {
SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, "Unsupported gamma");
+ }
i = (i << 8) | SlReadByte();
}
i = (i << 8) | SlReadByte();
@@ -538,8 +539,9 @@ void SlSetLength(size_t length)
break;
case CH_ARRAY:
assert(_sl.last_array_index <= _sl.array_index);
- while (++_sl.last_array_index <= _sl.array_index)
+ while (++_sl.last_array_index <= _sl.array_index) {
SlWriteArrayLength(1);
+ }
SlWriteArrayLength(length + 1);
break;
case CH_SPARSE_ARRAY:
@@ -1520,8 +1522,7 @@ static size_t ReadZlib()
/* inflate the data */
r = inflate(&_z, 0);
- if (r == Z_STREAM_END)
- break;
+ if (r == Z_STREAM_END) break;
if (r != Z_OK) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, "inflate() failed");
} while (_z.avail_out);
@@ -1569,8 +1570,8 @@ static void WriteZlibLoop(z_streamp z, byte *p, size_t len, int mode)
if ((n = sizeof(buf) - z->avail_out) != 0) {
if (fwrite(buf, n, 1, _sl.fh) != 1) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_WRITEABLE);
}
- if (r == Z_STREAM_END)
- break;
+ if (r == Z_STREAM_END) break;
+
if (r != Z_OK) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, "zlib returned error code");
} while (z->avail_in || !z->avail_out);
}
diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp
index f8786d49e..45eb2293b 100644
--- a/src/saveload/vehicle_sl.cpp
+++ b/src/saveload/vehicle_sl.cpp
@@ -733,8 +733,9 @@ void Load_VEHS()
}
/* Old savegames used 'last_station_visited = 0xFF' */
- if (CheckSavegameVersion(5) && v->last_station_visited == 0xFF)
+ if (CheckSavegameVersion(5) && v->last_station_visited == 0xFF) {
v->last_station_visited = INVALID_STATION;
+ }
if (CheckSavegameVersion(5)) {
/* Convert the current_order.type (which is a mix of type and flags, because