⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 connectionmessageevent.h

📁 五行MMORPG引擎系统V1.0
💻 H
字号:
//connectionMessageEvent.h
/*/////////////////////////////////////////////////////////////////

   李亦
	2006-7-3
/*/////////////////////////////////////////////////////////////////
#ifndef _CONNECTIONMESSAGEEVENT_H_
#define _CONNECTIONMESSAGEEVENT_H_


#ifndef _RPGNETEVENT_H_
#include "server/conn/RPGNetEvent.h"
#endif

#ifndef _CONNECTIONGHOST_H_
#include "server/conn/GhostConnection.h"
#endif
///////////////////////////////////////////////////////////////////////////////
/// ConnectionMessageEvent
///
/// This event is used inside by the connection and subclasses to message
/// itself when sequencing events occur.  Right now, the message event
/// only uses 6 bits to transmit the message, so
class ConnectionMessageEvent : public NetEvent
{
   U32 sequence;
   U32 message;
   U32 ghostCount;
public:
   ConnectionMessageEvent(U32 msg=0, U32 seq=0, U32 gc=0)
      { message = msg; sequence = seq; ghostCount = gc;}
   void pack(NetConnection *, BitStream *bstream)
   {
      bstream->write(sequence);
      bstream->writeInt(message, 3);
      bstream->writeInt(ghostCount, GhostConnection::GhostIdBitSize + 1);
   }
   void write(NetConnection *, BitStream *bstream)
   {
      bstream->write(sequence);
      bstream->writeInt(message, 3);
      bstream->writeInt(ghostCount, GhostConnection::GhostIdBitSize + 1);
   }
   void unpack(NetConnection *, BitStream *bstream)
   {
      bstream->read(&sequence);
      message = bstream->readInt(3);
      ghostCount = bstream->readInt(GhostConnection::GhostIdBitSize + 1);
   }
   void process(NetConnection *ps)
   {
			ps->handleConnectionMessage(message, sequence, ghostCount);
   }
   DECLARE_CONOBJECT(ConnectionMessageEvent);
};



#endif //_CONNECTIONMESSAGEEVENT_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -