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

📄 eventconnection.h

📁 五行MMORPG引擎系统V1.0
💻 H
字号:
//-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------

#ifndef _CONNECTIONEVENT_H_
#define _CONNECTIONEVENT_H_

//#ifndef _MPOINT_H_
//#include "math/mPoint.h"
//#endif
//#ifndef _NETOBJECT_H_
//#include "sim/netObject.h"
//#endif
//#ifndef _NETSTRINGTABLE_H_
//#include "sim/netStringTable.h"
//#endif
#ifndef _RPGNETEVENT_H_
#include "server/conn/RPGNetEvent.h"
#endif

#ifndef _RPGNETCONNECTION_H_
#include "server/conn/RPGNetConnection.h"
#endif



//#ifndef _DNET_H_
//#include "core/dnet.h"
//#endif
//
//#ifndef _H_CONNECTIONSTRINGTABLE
//#include "sim/connectionStringTable.h"
//#endif

class NetObject;
class BitStream;
class ResizeBitStream;
class Stream;
class Point3F;

//namespace CS
//{

//class  NetConnection;
//struct PacketNotify;

//struct GhostInfo;
//struct SubPacketRef; // defined in NetConnection subclass


//----------------------------------------------------------------------------

class EventConnection :public NetConnection
{
	friend class NetConnection;
   typedef NetConnection Parent;

public:

   static void consoleInit();

   void onRemove();

   EventConnection();
   ~EventConnection();


protected:
   virtual void readPacket(BitStream *bstream);
   virtual void writePacket(BitStream *bstream, PacketNotify *note);
   virtual void packetReceived(PacketNotify *note);
   virtual void packetDropped(PacketNotify *note);
   //virtual void connectionError(const char *errorString);

   virtual void writeDemoStartBlock(ResizeBitStream *stream);
   virtual bool readDemoStartBlock(BitStream *stream);
   //virtual void demoPlaybackComplete();

public:
   void setSendingEvents(bool sending);   ///< Sets whether this side actually sends the events that are posted to it.

	virtual void setRemoteConnectionObject(EventConnection *connection) { mRemoteConnection = connection; Parent::setRemoteConnectionObject(connection);};
protected:
   SimObjectPtr<EventConnection> mRemoteConnection;

//----------------------------------------------------------------
/// @name Event Manager
/// @{

private:
   NetEventNote *mSendEventQueueHead;
   NetEventNote *mSendEventQueueTail;
   NetEventNote *mUnorderedSendEventQueueHead;
   NetEventNote *mUnorderedSendEventQueueTail;
   NetEventNote *mWaitSeqEvents;
   NetEventNote *mNotifyEventList;

   static FreeListChunker<NetEventNote> mEventNoteChunker;

   bool mSendingEvents;

   S32 mNextSendEventSeq;
   S32 mNextRecvEventSeq;
   S32 mLastAckedEventSeq;

   enum NetEventConstants {
      InvalidSendEventSeq = -1,
      FirstValidSendEventSeq = 0
   };

   void eventOnRemove();

   void eventPacketDropped(PacketNotify *notify);
   void eventPacketReceived(PacketNotify *notify);

   void eventWritePacket(BitStream *bstream, PacketNotify *notify);
   void eventReadPacket(BitStream *bstream);

   void eventWriteStartBlock(ResizeBitStream *stream);
   void eventReadStartBlock(BitStream *stream);
public:
   /// Post an event to this connection.
   bool postNetEvent(NetEvent *event);

/// @}


};



//};//namespace CS
#endif


⌨️ 快捷键说明

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