summaryrefslogtreecommitdiff
path: root/src/messageout.h
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-07-16 18:37:38 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-07-16 18:37:38 +0000
commit49bc551cc81f23c6e5243e1ddb0ddf6d0159c544 (patch)
tree7cb6958a430334830c6fa2ef14eafb0051ecc54b /src/messageout.h
parentb38bedf85a7582d20a1fee993cc6078f9463b40a (diff)
downloadmanaserv-49bc551cc81f23c6e5243e1ddb0ddf6d0159c544.tar.gz
manaserv-49bc551cc81f23c6e5243e1ddb0ddf6d0159c544.tar.bz2
manaserv-49bc551cc81f23c6e5243e1ddb0ddf6d0159c544.tar.xz
manaserv-49bc551cc81f23c6e5243e1ddb0ddf6d0159c544.zip
Removed a lot of tabs used for indenting (please don't do that...), redid
MessageOut a bit so that it uses SDL_net, writes strings correctly and doesn't rely on Packet to be expandable. Also specified message IDs explicitly.
Diffstat (limited to 'src/messageout.h')
-rw-r--r--src/messageout.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/messageout.h b/src/messageout.h
index d48cb899..7d1da2f8 100644
--- a/src/messageout.h
+++ b/src/messageout.h
@@ -28,6 +28,9 @@
#include "packet.h"
+/**
+ * Used for building an outgoing message.
+ */
class MessageOut
{
public:
@@ -53,12 +56,25 @@ class MessageOut
/**
* Returns an instance of Packet derived from the written data. Use for
- * sending the packet.
+ * sending the packet. No more writing to the packet may be done after
+ * a call to this method.
*/
const Packet *getPacket();
private:
- Packet *packet; /**< Created packet. */
+ /**
+ * Expand the packet data to be able to hold more data.
+ *
+ * NOTE: For performance enhancements this method could allocate extra
+ * memory in advance instead of expanding size every time more data is
+ * added.
+ */
+ void expand(unsigned int size);
+
+ Packet *mPacket; /**< Created packet. */
+ char *mData; /**< Data building up. */
+ unsigned int mDataSize; /**< Size of data. */
+ unsigned int mPos; /**< Position in the data. */
};
#endif