diff options
author | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-02-13 12:31:13 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <bjorn@lindeijer.nl> | 2024-02-13 20:56:48 +0100 |
commit | 92a6fd04d44bcd405641d7297a0167e2d5aba26f (patch) | |
tree | 06df1fca07892be18a35e446965f25bcfc236d19 /src/net/tmwa/network.h | |
parent | 10da00488a37cb04a2cb515c94acde7104e74506 (diff) | |
download | Mana-92a6fd04d44bcd405641d7297a0167e2d5aba26f.tar.gz Mana-92a6fd04d44bcd405641d7297a0167e2d5aba26f.tar.bz2 Mana-92a6fd04d44bcd405641d7297a0167e2d5aba26f.tar.xz Mana-92a6fd04d44bcd405641d7297a0167e2d5aba26f.zip |
Updated tmwAthena network protocol
* The code defining the message IDs and sizes are now generated by the
tools/protocol.py script in the tmwAthena repository.
* Reduced client version from 20 to 6, because that is currently the
minimum supported version, and any adjustments needed for later likely
still need to be made.
* Removed use of no longer handled messages:
- CMSG_SKILL_USE_BEING
- CMSG_SKILL_USE_POSITION
- CMSG_SKILL_USE_MAP
- SMSG_PARTY_MOVE
- CMSG_WHO_REQUEST
- SMSG_WHO_ANSWER
- SMSG_MVP
- SMSG_BEING_MOVE2
- SMSG_BEING_CHANGE_LOOKS
* Some messages were renamed to match the server side
- CMSG_PLAYER_ATTACK -> CMSG_PLAYER_CHANGE_ACT
- CMSG_PLAYER_RESTART -> CMSG_PLAYER_REBOOT
- SMSG_ADMIN_IP -> SMSG_BEING_IP_RESPONSE
Part of addressing issues #55 and #47, which we now know are about
handling SMSG_PLAYER_HP and SMSG_NPC_COMMAND respectively. The client
will now ignore them (with a warning) instead of crash.
Diffstat (limited to 'src/net/tmwa/network.h')
-rw-r--r-- | src/net/tmwa/network.h | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/src/net/tmwa/network.h b/src/net/tmwa/network.h index 4df44b75..36d8cafd 100644 --- a/src/net/tmwa/network.h +++ b/src/net/tmwa/network.h @@ -27,7 +27,6 @@ #include "net/serverinfo.h" #include "net/tmwa/messagehandler.h" -#include "net/tmwa/messagein.h" #include "net/tmwa/messageout.h" #include <SDL_net.h> @@ -35,6 +34,7 @@ #include <map> #include <string> +#include <unordered_map> /** * Protocol version, reported to the eAthena char and mapserver who can adjust @@ -45,6 +45,8 @@ namespace TmwAthena { +struct PacketInfo; + class Network { public: @@ -75,10 +77,6 @@ class Network void skip(int len); - bool messageReady(); - - MessageIn getNextMessage(); - void dispatchMessages(); void flush(); @@ -106,24 +104,24 @@ class Network void receive(); - TCPsocket mSocket; + TCPsocket mSocket = nullptr; ServerInfo mServer; char *mInBuffer, *mOutBuffer; - unsigned int mInSize, mOutSize; + unsigned int mInSize = 0; + unsigned int mOutSize = 0; - unsigned int mToSkip; + unsigned int mToSkip = 0; - int mState; + int mState = IDLE; std::string mError; - SDL_Thread *mWorkerThread; + SDL_Thread *mWorkerThread = nullptr; Mutex mMutex; - using MessageHandlers = std::map<Uint16, MessageHandler *>; - using MessageHandlerIterator = MessageHandlers::iterator; - MessageHandlers mMessageHandlers; + std::unordered_map<uint16_t, const PacketInfo*> mPacketInfo; + std::map<uint16_t, MessageHandler *> mMessageHandlers; static Network *mInstance; }; |