diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-04-17 09:19:52 +0200 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-04-18 08:53:51 +0200 |
commit | 1c19fb5173c59b8dd7de10af93347bc9d9279e7e (patch) | |
tree | 48e1f3cf9ab986de82d2becd0dbb35f21c2f8ec2 /src/net/tmwa/messagein.cpp | |
parent | aecbf876cd0a7894396a2e5034af9d93bf028aa0 (diff) | |
download | mana-1c19fb5173c59b8dd7de10af93347bc9d9279e7e.tar.gz mana-1c19fb5173c59b8dd7de10af93347bc9d9279e7e.tar.bz2 mana-1c19fb5173c59b8dd7de10af93347bc9d9279e7e.tar.xz mana-1c19fb5173c59b8dd7de10af93347bc9d9279e7e.zip |
Simplify TmwAthena::MessageOut
Since for tmwAthena we're writing messages directly into the output
buffer, the MessageOut implementation does not need any members.
Also used SDL_SwapLE16 and SDL_SwapLE32 for convenience.
Diffstat (limited to 'src/net/tmwa/messagein.cpp')
-rw-r--r-- | src/net/tmwa/messagein.cpp | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/net/tmwa/messagein.cpp b/src/net/tmwa/messagein.cpp index 899b135d..7c142619 100644 --- a/src/net/tmwa/messagein.cpp +++ b/src/net/tmwa/messagein.cpp @@ -21,7 +21,6 @@ #include "net/tmwa/messagein.h" -#include <SDL.h> #include <SDL_endian.h> #define MAKEWORD(low,high) \ @@ -55,13 +54,8 @@ uint16_t MessageIn::readInt16() uint16_t value = 0; if (mPos + 2 <= mLength) { -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - uint16_t swap; - memcpy(&swap, mData + mPos, sizeof(uint16_t)); - value = SDL_Swap16(swap); -#else memcpy(&value, mData + mPos, sizeof(uint16_t)); -#endif + value = SDL_SwapLE16(value); } mPos += 2; return value; @@ -72,13 +66,8 @@ uint32_t MessageIn::readInt32() uint32_t value = 0; if (mPos + 4 <= mLength) { -#if SDL_BYTEORDER == SDL_BIG_ENDIAN - uint32_t swap; - memcpy(&swap, mData + mPos, sizeof(uint32_t)); - value = SDL_Swap32(swap); -#else memcpy(&value, mData + mPos, sizeof(uint32_t)); -#endif + value = SDL_SwapLE32(value); } mPos += 4; return value; |