diff options
author | rubidium <rubidium@openttd.org> | 2007-01-10 18:56:51 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-01-10 18:56:51 +0000 |
commit | f35ed4bbc2b05f1b83476b60948d64375f77f1b4 (patch) | |
tree | 1a1c59c13ddb1d152052f3a3a0bcffe4fb531173 /src/oldloader.cpp | |
parent | a332d10fd938f345fff18e5f4a662a58f692f734 (diff) | |
download | openttd-f35ed4bbc2b05f1b83476b60948d64375f77f1b4.tar.xz |
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
Diffstat (limited to 'src/oldloader.cpp')
-rw-r--r-- | src/oldloader.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/oldloader.cpp b/src/oldloader.cpp index f6a56fdd6..98a1e9223 100644 --- a/src/oldloader.cpp +++ b/src/oldloader.cpp @@ -80,6 +80,8 @@ typedef enum OldChunkTypes { OC_END = 0 ///< End of the whole chunk, all 32bits set to zero } OldChunkType; +DECLARE_ENUM_AS_BIT_SET(OldChunkType); + typedef bool OldChunkProc(LoadgameState *ls, int num); typedef struct OldChunks { @@ -97,9 +99,9 @@ assert_compile(sizeof(TileIndex) == 4); static uint32 _bump_assert_value; static bool _read_ttdpatch_flags; -static OldChunkType GetOldChunkType(OldChunkType type) {return GB(type, 0, 8);} -static OldChunkType GetOldChunkVarType(OldChunkType type) {return GB(type, 8, 8) << 8;} -static OldChunkType GetOldChunkFileType(OldChunkType type) {return GB(type, 16, 8) << 16;} +static OldChunkType GetOldChunkType(OldChunkType type) {return (OldChunkType)GB(type, 0, 8);} +static OldChunkType GetOldChunkVarType(OldChunkType type) {return (OldChunkType)(GB(type, 8, 8) << 8);} +static OldChunkType GetOldChunkFileType(OldChunkType type) {return (OldChunkType)(GB(type, 16, 8) << 16);} static inline byte CalcOldVarLen(OldChunkType type) { @@ -189,10 +191,10 @@ static inline uint32 ReadUint32(LoadgameState *ls) static bool LoadChunk(LoadgameState *ls, void *base, const OldChunks *chunks) { const OldChunks *chunk = chunks; - byte *base_ptr = base; + byte *base_ptr = (byte*)base; while (chunk->type != OC_END) { - byte* ptr = chunk->ptr; + byte* ptr = (byte*)chunk->ptr; uint i; for (i = 0; i < chunk->amount; i++) { @@ -959,9 +961,9 @@ static const OldChunks player_chunk[] = { static bool LoadOldPlayer(LoadgameState *ls, int num) { - Player *p = GetPlayer(num); + Player *p = GetPlayer((PlayerID)num); - _current_player_id = num; + _current_player_id = (PlayerID)num; if (!LoadChunk(ls, p, player_chunk)) return false; @@ -996,7 +998,7 @@ static bool LoadOldPlayer(LoadgameState *ls, int num) * really figured out as of now, p->ai.cur_veh; needed for 'sell vehicle' * is NULL and the function will crash. To fix this, just change the state * to some harmless state, like 'loop vehicle'; 1 */ - if (!IsHumanPlayer(num) && p->ai.state == 20) p->ai.state = 1; + if (!IsHumanPlayer((PlayerID)num) && p->ai.state == 20) p->ai.state = 1; if (p->is_ai && (!_networking || _network_server) && _ai.enabled) AI_StartNewAI(p->index); |