diff options
author | lukaslw | 2014-10-09 17:54:46 +0200 |
---|---|---|
committer | lukaslw | 2014-10-09 17:54:46 +0200 |
commit | 9db1d77d478fafe1ecd2d2723d4374a80bfba90e (patch) | |
tree | 3091d7eca9a5edf4eec14880bb22f7b80d035c0b /engines/prince/script.h | |
parent | f80d72d10ae78c29b21a4ca0533a2f1b05e729ac (diff) | |
download | scummvm-rg350-9db1d77d478fafe1ecd2d2723d4374a80bfba90e.tar.gz scummvm-rg350-9db1d77d478fafe1ecd2d2723d4374a80bfba90e.tar.bz2 scummvm-rg350-9db1d77d478fafe1ecd2d2723d4374a80bfba90e.zip |
PRINCE: Remove readScript and LittleEndianReader templates from Script
Change all of READ_UINT16 to READ_LE_UINT16 and all READ_UINT32 to READ_LE_UINT32 for endian-safety
Diffstat (limited to 'engines/prince/script.h')
-rw-r--r-- | engines/prince/script.h | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/engines/prince/script.h b/engines/prince/script.h index fa7f9b7469..4799e84944 100644 --- a/engines/prince/script.h +++ b/engines/prince/script.h @@ -39,13 +39,6 @@ struct Anim; struct BackgroundAnim; struct Mask; -// TODO - change this to sth else? -namespace Detail { - template <typename T> T LittleEndianReader(void *data); - template <> inline uint16 LittleEndianReader<uint16>(void *data) { return READ_LE_UINT16(data); } - template <> inline uint32 LittleEndianReader<uint32>(void *data) { return READ_LE_UINT32(data); } -} - class Room { public: Room(); @@ -125,11 +118,8 @@ public: bool loadStream(Common::SeekableReadStream &stream); - template <typename T> - T read(uint32 address) { - assert((_data + address + sizeof(T)) <= (_data + _dataSize)); - return Detail::LittleEndianReader<T>(&_data[address]); - } + uint16 readScript16(uint32 address); + uint32 readScript32(uint32 address); uint32 getStartGameOffset(); uint32 getLocationInitScript(int initRoomTableOffset, int roomNr); @@ -240,14 +230,12 @@ private: // Helper functions uint32 step(uint32 opcodePC); - + uint16 readScript16(); + uint32 readScript32(); int32 readScriptFlagValue(); Flags::Id readScriptFlagId(); int checkSeq(byte *string); - // instantiation not needed here - template <typename T> T readScript(); - void debugInterpreter(const char *s, ...); typedef void (Interpreter::*OpcodeFunc)(); |