diff options
author | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-12-30 16:27:24 +0000 |
---|---|---|
committer | Eugenio Favalli <elvenprogrammer@gmail.com> | 2005-12-30 16:27:24 +0000 |
commit | ea653b2e9e1b46a07440833f96b3d2b788592c61 (patch) | |
tree | 252bb23d2064d14d4aa0796aa159f94873cb6419 /src/net | |
parent | 57d63f1dd5df0beb1a3d81f014686a2f80dfe7fc (diff) | |
download | mana-ea653b2e9e1b46a07440833f96b3d2b788592c61.tar.gz mana-ea653b2e9e1b46a07440833f96b3d2b788592c61.tar.bz2 mana-ea653b2e9e1b46a07440833f96b3d2b788592c61.tar.xz mana-ea653b2e9e1b46a07440833f96b3d2b788592c61.zip |
Added a new item, improved smooth login sequence, added a registration window (a lot of duplicated code to be removed).
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/network.cpp | 25 | ||||
-rw-r--r-- | src/net/network.h | 3 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/net/network.cpp b/src/net/network.cpp index e94acee7..4504a944 100644 --- a/src/net/network.cpp +++ b/src/net/network.cpp @@ -332,6 +332,31 @@ unsigned short readWord(int pos) #endif } +bool packetReady() +{ + bool ret = false; + if (in_size >= 2) + { + int length = packet_lengths[readWord(0)]; + if (length == -1) + { + if (in_size >= 4) + { + length = readWord(2); + if (in_size >= length) + { + ret = true; + } + } + } + else if (in_size >= length) + { + ret = true; + } + } + return ret; +} + MessageIn get_next_message() { diff --git a/src/net/network.h b/src/net/network.h index 50638683..db95d7c3 100644 --- a/src/net/network.h +++ b/src/net/network.h @@ -47,6 +47,9 @@ void closeConnection(); /** Send and receive data waiting in the buffers */ void flush(); +/** Check if a packet is complete */ +bool packetReady(); + /** * Returns the next arriving message, waiting for it if necessary. */ |