diff options
author | smatz <smatz@openttd.org> | 2009-05-17 11:47:56 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-05-17 11:47:56 +0000 |
commit | 76784501a8aacb3a4096310e61c85d9ca82e6044 (patch) | |
tree | 8b3fce07e1bd0336bc424cf38a6b88eba7ced2dc /src/saveload | |
parent | 4876e346d5d3ce43def851ea8d96aa8857d810b4 (diff) | |
download | openttd-76784501a8aacb3a4096310e61c85d9ca82e6044.tar.xz |
(svn r16335) -Codechange: indenting fixes in saveload.cpp
Diffstat (limited to 'src/saveload')
-rw-r--r-- | src/saveload/saveload.cpp | 94 |
1 files changed, 47 insertions, 47 deletions
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index c0d1ac6ae..e7091b6bf 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -381,11 +381,11 @@ int SlIterateArray() _next_offs = SlGetOffs() + length; switch (_sl.block_mode) { - case CH_SPARSE_ARRAY: index = (int)SlReadSparseIndex(); break; - case CH_ARRAY: index = _sl.array_index++; break; - default: - DEBUG(sl, 0, "SlIterateArray error"); - return -1; // error + case CH_SPARSE_ARRAY: index = (int)SlReadSparseIndex(); break; + case CH_ARRAY: index = _sl.array_index++; break; + default: + DEBUG(sl, 0, "SlIterateArray error"); + return -1; // error } if (length != 0) return index; @@ -475,17 +475,17 @@ size_t SlGetFieldLength() {return _sl.obj_len;} int64 ReadValue(const void *ptr, VarType conv) { switch (GetVarMemType(conv)) { - case SLE_VAR_BL: return (*(bool*)ptr != 0); - case SLE_VAR_I8: return *(int8* )ptr; - case SLE_VAR_U8: return *(byte* )ptr; - case SLE_VAR_I16: return *(int16* )ptr; - case SLE_VAR_U16: return *(uint16*)ptr; - case SLE_VAR_I32: return *(int32* )ptr; - case SLE_VAR_U32: return *(uint32*)ptr; - case SLE_VAR_I64: return *(int64* )ptr; - case SLE_VAR_U64: return *(uint64*)ptr; - case SLE_VAR_NULL:return 0; - default: NOT_REACHED(); + case SLE_VAR_BL: return (*(bool *)ptr != 0); + case SLE_VAR_I8: return *(int8 *)ptr; + case SLE_VAR_U8: return *(byte *)ptr; + case SLE_VAR_I16: return *(int16 *)ptr; + case SLE_VAR_U16: return *(uint16*)ptr; + case SLE_VAR_I32: return *(int32 *)ptr; + case SLE_VAR_U32: return *(uint32*)ptr; + case SLE_VAR_I64: return *(int64 *)ptr; + case SLE_VAR_U64: return *(uint64*)ptr; + case SLE_VAR_NULL:return 0; + default: NOT_REACHED(); } /* useless, but avoids compiler warning this way */ @@ -500,18 +500,18 @@ int64 ReadValue(const void *ptr, VarType conv) void WriteValue(void *ptr, VarType conv, int64 val) { switch (GetVarMemType(conv)) { - case SLE_VAR_BL: *(bool *)ptr = (val != 0); break; - case SLE_VAR_I8: *(int8 *)ptr = val; break; - case SLE_VAR_U8: *(byte *)ptr = val; break; - case SLE_VAR_I16: *(int16 *)ptr = val; break; - case SLE_VAR_U16: *(uint16*)ptr = val; break; - case SLE_VAR_I32: *(int32 *)ptr = val; break; - case SLE_VAR_U32: *(uint32*)ptr = val; break; - case SLE_VAR_I64: *(int64 *)ptr = val; break; - case SLE_VAR_U64: *(uint64*)ptr = val; break; - case SLE_VAR_NAME: *(char**)ptr = CopyFromOldName(val); break; - case SLE_VAR_NULL: break; - default: NOT_REACHED(); + case SLE_VAR_BL: *(bool *)ptr = (val != 0); break; + case SLE_VAR_I8: *(int8 *)ptr = val; break; + case SLE_VAR_U8: *(byte *)ptr = val; break; + case SLE_VAR_I16: *(int16 *)ptr = val; break; + case SLE_VAR_U16: *(uint16*)ptr = val; break; + case SLE_VAR_I32: *(int32 *)ptr = val; break; + case SLE_VAR_U32: *(uint32*)ptr = val; break; + case SLE_VAR_I64: *(int64 *)ptr = val; break; + case SLE_VAR_U64: *(uint64*)ptr = val; break; + case SLE_VAR_NAME: *(char**)ptr = CopyFromOldName(val); break; + case SLE_VAR_NULL: break; + default: NOT_REACHED(); } } @@ -990,26 +990,26 @@ static void SlLoadChunk(const ChunkHandler *ch) _sl.obj_len = 0; switch (m) { - case CH_ARRAY: - _sl.array_index = 0; - ch->load_proc(); - break; - case CH_SPARSE_ARRAY: - ch->load_proc(); - break; - default: - if ((m & 0xF) == CH_RIFF) { - /* Read length */ - len = (SlReadByte() << 16) | ((m >> 4) << 24); - len += SlReadUint16(); - _sl.obj_len = len; - endoffs = SlGetOffs() + len; + case CH_ARRAY: + _sl.array_index = 0; ch->load_proc(); - if (SlGetOffs() != endoffs) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, "Invalid chunk size"); - } else { - SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, "Invalid chunk type"); - } - break; + break; + case CH_SPARSE_ARRAY: + ch->load_proc(); + break; + default: + if ((m & 0xF) == CH_RIFF) { + /* Read length */ + len = (SlReadByte() << 16) | ((m >> 4) << 24); + len += SlReadUint16(); + _sl.obj_len = len; + endoffs = SlGetOffs() + len; + ch->load_proc(); + if (SlGetOffs() != endoffs) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, "Invalid chunk size"); + } else { + SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, "Invalid chunk type"); + } + break; } } |