mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-17 10:52:46 +00:00
Initial Commit of CyanWorlds.com Engine Open Source Client/Plugin
This commit is contained in:
@ -0,0 +1,83 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plNetCommonMessage_inc
|
||||
#define plNetCommonMessage_inc
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "hsSafeRefCnt.h"
|
||||
|
||||
//
|
||||
// refcntable data
|
||||
//
|
||||
class plNetCommonMessageData : public hsSafeRefCnt
|
||||
{
|
||||
private:
|
||||
char *fData; // sent
|
||||
public:
|
||||
plNetCommonMessageData(char* d) : fData(d) {}
|
||||
~plNetCommonMessageData()
|
||||
{
|
||||
hsAssert(RefCnt()==1, "illegal refcnt");
|
||||
delete [] fData;
|
||||
}
|
||||
|
||||
char* GetData() const { return fData; }
|
||||
};
|
||||
|
||||
//
|
||||
// basic msg payload w/ refcntable data
|
||||
//
|
||||
class plNetCommonMessage
|
||||
{
|
||||
plNetCommonMessage(const plNetCommonMessage & other);
|
||||
private:
|
||||
plNetCommonMessageData* fMsgData;
|
||||
protected:
|
||||
UInt32 fLen; // sent
|
||||
public:
|
||||
plNetCommonMessage() : fLen(0),fMsgData(nil) {}
|
||||
virtual ~plNetCommonMessage() { hsRefCnt_SafeUnRef(fMsgData); }
|
||||
|
||||
// setters
|
||||
void SetData(char *d)
|
||||
{
|
||||
plNetCommonMessageData* n = d ? TRACKED_NEW plNetCommonMessageData(d) : nil;
|
||||
hsRefCnt_SafeAssign(fMsgData, n);
|
||||
hsRefCnt_SafeUnRef(n);
|
||||
}
|
||||
void SetMsgData(plNetCommonMessageData* d)
|
||||
{
|
||||
hsRefCnt_SafeAssign(fMsgData, d);
|
||||
}
|
||||
void SetLen(UInt32 l) { fLen=l; }
|
||||
|
||||
// getters
|
||||
char* GetData() const { return fMsgData ? fMsgData->GetData() : nil; }
|
||||
virtual UInt32 GetDataLen() { return fLen; }
|
||||
UInt32 GetLen() const { return fLen; }
|
||||
plNetCommonMessageData* GetMsgData() const { return fMsgData; }
|
||||
};
|
||||
#endif // plNetCommonMessage_inc
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,997 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plNetMessage_h_inc
|
||||
#define plNetMessage_h_inc
|
||||
|
||||
#include "hsUtils.h"
|
||||
#include "hsTypes.h"
|
||||
#include "hsStlUtils.h"
|
||||
#include "hsStream.h"
|
||||
#include "hsBitVector.h"
|
||||
#include "hsTemplates.h"
|
||||
#include "plGeneric.h"
|
||||
#include "../pnNetCommon/plNetServers.h"
|
||||
#include "../pnNetCommon/plNetGroup.h"
|
||||
#include "../pnFactory/plCreatable.h"
|
||||
#include "../pnFactory/plFactory.h"
|
||||
#include "../plUnifiedTime/plClientUnifiedTime.h"
|
||||
#include "../plNetCommon/plNetServerSessionInfo.h"
|
||||
#include "../plNetCommon/plNetCommon.h"
|
||||
#include "../plNetCommon/plNetCommonHelpers.h"
|
||||
#include "../plNetCommon/plNetCommonConstants.h"
|
||||
|
||||
#include "../plStreamLogger/plStreamLogger.h"
|
||||
|
||||
#include "plNetMsgHelpers.h"
|
||||
|
||||
#include "../pnNetBase/pnNetBase.h"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
class plMessage;
|
||||
class plUUID;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// Base class for application network messages.
|
||||
// These become the data in a plNetCommonMessage when sent over the network.
|
||||
//
|
||||
class plNetCommonMessage;
|
||||
class plKey;
|
||||
|
||||
class plNetMessage : public plCreatable
|
||||
{
|
||||
friend class plNetServerMsgPlsRoutableMsg;
|
||||
|
||||
UInt32 fFlags; // indicates what is present in the message, always transmitted
|
||||
plUnifiedTime fTimeSent; // time msg was sent (in sender's unified timeSpace), always transmitted to and from the client
|
||||
double fTimeRecvd; // time msg was recvd (in rcvrs timeSpace), never transmitted
|
||||
UInt32 fBytesRead; // amount of data we've already read, never transmitted
|
||||
UInt32 fContext; // set by sender, included in reply. Only written if kHasContext flag set
|
||||
UInt32 fTransactionID; // set by originator, included in reply. Only written if kHasTransactionID flag set
|
||||
UInt32 fPlayerID; // set by originator. Only written if kHasPlayerID flag set
|
||||
plUUID fAcctUUID; // set by sender (app level). Only written if kHasAcctUUID flag set
|
||||
const plNetCommonMessage* fNetCoreMsg; // not sent, set by the receiver
|
||||
UInt32 fPeekStatus; // not sent. set on PeekBuffer, cleared on PokeBuffer
|
||||
UInt8 fProtocolVerMajor; // conditionally sent
|
||||
UInt8 fProtocolVerMinor; // conditionally sent
|
||||
ENetProtocol fNetProtocol; // the server this msg should be sent to. this value is not sent over wire.
|
||||
|
||||
enum ContentFlags
|
||||
{
|
||||
kNetMsgFlags,
|
||||
kNetMsgTimeSent,
|
||||
kNetMsgContext,
|
||||
kNetMsgTransactionID,
|
||||
kNetMsgPlayerID,
|
||||
kNetMsgVersion,
|
||||
};
|
||||
|
||||
protected:
|
||||
virtual int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
virtual int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
|
||||
void IWriteClassIndex(hsStream* stream);
|
||||
void IReadClassIndex(hsStream* stream);
|
||||
|
||||
bool IPeeked() const { return fPeekStatus==kFullyPeeked;}
|
||||
void ISetPeekStatus(UInt32 s) { fPeekStatus=s; }
|
||||
|
||||
public:
|
||||
typedef UInt16 plStrLen;
|
||||
static const UInt8 kVerMajor, kVerMinor; // version of the networking code
|
||||
|
||||
typedef UInt16 ClassIndexType; // the type returned by plCreatable::ClassIndex()
|
||||
enum
|
||||
{
|
||||
kMaxNameLen=32
|
||||
};
|
||||
enum BitVectorFlags // indicates what is present in the message, always transmitted
|
||||
{
|
||||
kHasTimeSent = 0x1, // means fTimeSent need sending
|
||||
kHasGameMsgRcvrs = 0x2, // means that this is a direct (not bcast) game msg
|
||||
kEchoBackToSender = 0x4, // if broadcasting, echo packet back to sender
|
||||
kRequestP2P = 0x8, // sent to gameServer on joinReq
|
||||
kAllowTimeOut = 0x10, // sent to gameServer on joinReq (if release code)
|
||||
kIndirectMember = 0x20, // sent to client on joinAck if he is behind a firewall
|
||||
// This flag is used when the servers are firewalled and NAT'ed
|
||||
// It tells a game or lobby server to ask the lookup for an external address
|
||||
kPublicIPClient = 0x40, // set on a client coming from a public IP
|
||||
kHasContext = 0x80, // whether or not to write fContext field
|
||||
// Used with StartProcess server msgs. Whether or not the ServerAgent
|
||||
// must first ask the vault for a game state associated with the
|
||||
// game about to be instanced.
|
||||
kAskVaultForGameState =0x100,
|
||||
kHasTransactionID = 0x200, // whether or not to write fTransactionID field
|
||||
kNewSDLState = 0x400, // set by client on first state packet sent, may not be necessary anymore
|
||||
kInitialAgeStateRequest = 0x800,// initial request for the age state
|
||||
kHasPlayerID = 0x1000, // is fPlayerID set
|
||||
kUseRelevanceRegions= 0x2000, // if players use relevance regions are used, this will be filtered by region, currently set on avatar physics and control msgs
|
||||
kHasAcctUUID = 0x4000, // is fAcctUUID set
|
||||
kInterAgeRouting = 0x8000, // give to pls for routing.
|
||||
kHasVersion = 0x10000, // if version is set
|
||||
kIsSystemMessage = 0x20000,
|
||||
kNeedsReliableSend = 0x40000,
|
||||
kRouteToAllPlayers = 0x80000, // send this message to all online players.
|
||||
};
|
||||
enum PeekOptions // options for partial peeking
|
||||
{
|
||||
kSkipStream = 1<<0, // means we should not read the actual stream, just the stream info
|
||||
kBaseClassOnly = 1<<1, // only peek or poke the baseclass info
|
||||
kPartialPeekMask = kSkipStream | kBaseClassOnly,
|
||||
// plNetServerMsgWithRoutingInfo derived classes need to check this
|
||||
// in their PeekBuffer methods.
|
||||
kJustRoutingInfo = 1<<2,
|
||||
kDontClearBuffer = 1<<3,
|
||||
// don't call base class peek/poke. plNetMsgOmnibus/plNetMsgVault uses this.
|
||||
kDEAD_NoBaseClass = 1<<4,
|
||||
// don't worry about compressing/uncompressing things. used by plNetMsgStreamHelper, and plNetMsgOmnibus.
|
||||
kDontCompress = 1<<5,
|
||||
kWantVersion = 1<<6,
|
||||
kFullyPeeked = 0xffffffff // default fPeekStatus, set if not partial peeking
|
||||
};
|
||||
enum CompressionType // currently only used for plNetMsgStreams
|
||||
{
|
||||
kCompressionNone, // not compressed
|
||||
kCompressionFailed, // failed to compress
|
||||
kCompressionZlib, // zlib compressed
|
||||
kCompressionDont // don't compress
|
||||
};
|
||||
|
||||
CLASSNAME_REGISTER( plNetMessage );
|
||||
GETINTERFACE_ANY( plNetMessage, plCreatable );
|
||||
|
||||
// plCreatable
|
||||
void Read(hsStream* s, hsResMgr* mgr);
|
||||
void Write(hsStream* s, hsResMgr* mgr);
|
||||
|
||||
void ReadVersion(hsStream* s, hsResMgr* mgr);
|
||||
void WriteVersion(hsStream* s, hsResMgr* mgr);
|
||||
|
||||
// ctor
|
||||
plNetMessage();
|
||||
virtual ~plNetMessage();
|
||||
|
||||
static plNetMessage* CreateAndRead(const plNetCommonMessage*, plStreamLogger::EventList* el = nil);
|
||||
static plNetMessage* Create(const plNetCommonMessage*);
|
||||
int PokeBuffer(char* buf, int bufLen, UInt32 peekOptions=0); // put msg in buffer
|
||||
int PeekBuffer(const char* buf, int bufLen, UInt32 peekOptions=0, bool forcePeek=false, plStreamLogger::EventList* el = nil); // get msg out of buffer
|
||||
bool NeedsReliableSend() const { return IsBitSet(kNeedsReliableSend); }
|
||||
bool IsSystemMessage() const { return IsBitSet(kIsSystemMessage); }
|
||||
virtual void ValidatePoke() const;
|
||||
virtual void ValidatePeek() const;
|
||||
virtual bool NeedsBroadcast() const { return false; } // should game server broadcast this message to other clients?
|
||||
virtual int ValidationSchemeID() const { return 1; }
|
||||
|
||||
// getters
|
||||
int GetPackSize();
|
||||
const plUnifiedTime& GetTimeSent() const { return fTimeSent; }
|
||||
bool GetHasTimeSent() const { return IsBitSet(kHasTimeSent); }
|
||||
double GetTimeReceived() const { return fTimeRecvd; }
|
||||
bool IsBitSet(int b) const { return (fFlags & b) != 0; }
|
||||
const plNetCommonMessage* GetNetCoreMsg() const { return fNetCoreMsg; }
|
||||
UInt32 GetNetCoreMsgLen() const;
|
||||
bool GetHasContext() const { return IsBitSet(kHasContext);}
|
||||
UInt32 GetContext() const { return fContext;}
|
||||
bool GetHasTransactionID() const { return IsBitSet(kHasTransactionID);}
|
||||
UInt32 GetTransactionID() const { return fTransactionID;}
|
||||
bool GetHasPlayerID() const { return IsBitSet(kHasPlayerID);}
|
||||
UInt32 GetPlayerID() const { hsAssert(GetHasPlayerID(), "uninit playerID"); return fPlayerID; }
|
||||
UInt32 JustGetPlayerID() const { return fPlayerID; }
|
||||
bool GetHasAcctUUID() const { return IsBitSet(kHasAcctUUID); }
|
||||
const plUUID * GetAcctUUID() const { return &fAcctUUID; }
|
||||
UInt8 GetVersionMajor() const { return fProtocolVerMajor; }
|
||||
UInt8 GetVersionMinor() const { return fProtocolVerMinor; }
|
||||
ENetProtocol GetNetProtocol () const { return fNetProtocol; }
|
||||
|
||||
// setters
|
||||
void SetTimeSent(const plUnifiedTime& t) { fTimeSent=t;SetHasTimeSent(true); }
|
||||
void SetHasTimeSent(bool value) { SetBit( kHasTimeSent, value ); }
|
||||
void SetTimeReceived(double t) { fTimeRecvd=t; }
|
||||
void SetBit(int b, bool on=true) { if (on) fFlags |= b; else fFlags &= ~b; }
|
||||
void SetNetCoreMsg(const plNetCommonMessage* ncmsg) { fNetCoreMsg=ncmsg; }
|
||||
void SetHasContext(bool value) { SetBit(kHasContext,value);}
|
||||
void SetContext(UInt32 value) { fContext=value; SetHasContext(true);}
|
||||
void SetHasTransactionID(bool value) { SetBit(kHasTransactionID,value);}
|
||||
void SetTransactionID(UInt32 value) { fTransactionID=value; SetHasTransactionID(true);}
|
||||
void SetHasPlayerID(bool value) { SetBit(kHasPlayerID,value);}
|
||||
void SetPlayerID(UInt32 value) { fPlayerID=value; SetHasPlayerID(true);}
|
||||
void SetHasAcctUUID( bool v ) { SetBit( kHasAcctUUID,v ); }
|
||||
void SetAcctUUID(const plUUID * v ) { fAcctUUID.CopyFrom(v); SetHasAcctUUID(true); }
|
||||
void SetVersion(UInt8 maj=kVerMajor, UInt8 min=kVerMinor) { SetBit(kHasVersion); fProtocolVerMajor=maj; fProtocolVerMinor=min; }
|
||||
void SetNetProtocol (ENetProtocol v ) { fNetProtocol = v; }
|
||||
|
||||
// init fContext, fTransactionID, etc. if needed.
|
||||
void InitReplyFieldsFrom(plNetMessage * msg);
|
||||
|
||||
// debug
|
||||
virtual std::string AsStdString() const
|
||||
{
|
||||
char * delim = "";
|
||||
|
||||
std::stringstream ss;
|
||||
if ( GetHasPlayerID() )
|
||||
{
|
||||
ss << delim << "p:" << GetPlayerID();
|
||||
delim = ",";
|
||||
}
|
||||
if ( GetHasTransactionID() )
|
||||
{
|
||||
ss << delim << "x:" << GetTransactionID();
|
||||
delim = ",";
|
||||
}
|
||||
if ( GetHasAcctUUID() )
|
||||
{
|
||||
ss << delim << "a:" << GetAcctUUID()->AsStdString();
|
||||
delim = ",";
|
||||
}
|
||||
if ( IsBitSet(kHasVersion) )
|
||||
{
|
||||
ss << delim << "v:" << (int)fProtocolVerMajor << "." << (int)fProtocolVerMinor;
|
||||
delim = ",";
|
||||
}
|
||||
|
||||
return ss.str().c_str();
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// for msgs which only go from the gameserver to the client
|
||||
//
|
||||
class plNetMsgServerToClient : public plNetMessage
|
||||
{
|
||||
public:
|
||||
plNetMsgServerToClient() { SetBit(kIsSystemMessage|kNeedsReliableSend); }
|
||||
|
||||
CLASSNAME_REGISTER( plNetMsgServerToClient );
|
||||
GETINTERFACE_ANY( plNetMsgServerToClient, plNetMessage );
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Stream msg - abstract base class built with plNetMsgStreamHelper
|
||||
//
|
||||
class plNetMsgStream : public plNetMessage
|
||||
{
|
||||
protected:
|
||||
plNetMsgStreamHelper fStreamHelper;
|
||||
|
||||
int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
public:
|
||||
CLASSNAME_REGISTER( plNetMsgStream );
|
||||
GETINTERFACE_ANY_AUX(plNetMsgStream,plNetMessage,plNetMsgStreamHelper,fStreamHelper)
|
||||
|
||||
plNetMsgStreamHelper* StreamInfo() { return &fStreamHelper; }
|
||||
const plNetMsgStreamHelper* StreamInfo() const { return &fStreamHelper; }
|
||||
};
|
||||
|
||||
//
|
||||
// Object info msg - abstract base class built with plNetMsgObjectHelper
|
||||
//
|
||||
class plNetMsgObject : public plNetMessage
|
||||
{
|
||||
private:
|
||||
enum ContentFlags
|
||||
{
|
||||
kNetMsgObjectHelper,
|
||||
};
|
||||
protected:
|
||||
plNetMsgObjectHelper fObjectHelper;
|
||||
int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
public:
|
||||
CLASSNAME_REGISTER( plNetMsgObject );
|
||||
GETINTERFACE_ANY_AUX(plNetMsgObject,plNetMessage,plNetMsgObjectHelper,fObjectHelper)
|
||||
|
||||
plNetMsgObjectHelper* ObjectInfo() { return &fObjectHelper; }
|
||||
const plNetMsgObjectHelper* ObjectInfo() const { return &fObjectHelper; }
|
||||
|
||||
void ReadVersion(hsStream* s, hsResMgr* mgr);
|
||||
void WriteVersion(hsStream* s, hsResMgr* mgr);
|
||||
|
||||
// debug
|
||||
std::string AsStdString() const
|
||||
{
|
||||
std::string s;
|
||||
char tmp[256];
|
||||
xtl::format(s,"object=%s, %s",fObjectHelper.GetUoid().StringIze(tmp), plNetMessage::AsStdString().c_str());
|
||||
return s;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
// abstract baseclass which has both object and stream info
|
||||
//
|
||||
class plNetMsgStreamedObject : public plNetMsgObject
|
||||
{
|
||||
private:
|
||||
enum ContentFlags
|
||||
{
|
||||
kStreamHelper
|
||||
};
|
||||
protected:
|
||||
plNetMsgStreamHelper fStreamHelper;
|
||||
|
||||
int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
public:
|
||||
plNetMsgStreamedObject() {}
|
||||
~plNetMsgStreamedObject() {}
|
||||
|
||||
CLASSNAME_REGISTER( plNetMsgStreamedObject );
|
||||
GETINTERFACE_ANY_AUX(plNetMsgStreamedObject,plNetMsgObject,plNetMsgStreamHelper,fStreamHelper)
|
||||
|
||||
plNetMsgStreamHelper* StreamInfo() { return &fStreamHelper; }
|
||||
const plNetMsgStreamHelper* StreamInfo() const { return &fStreamHelper; }
|
||||
|
||||
//virtuals
|
||||
void ReadVersion(hsStream* s, hsResMgr* mgr);
|
||||
void WriteVersion(hsStream* s, hsResMgr* mgr);
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
// New SaveState system
|
||||
//
|
||||
class plNetMsgSDLState : public plNetMsgStreamedObject
|
||||
{
|
||||
private:
|
||||
enum ContentFlags
|
||||
{
|
||||
kSDLStateStream,
|
||||
kSDLIsInitialState,
|
||||
kSDLPersist,
|
||||
kSDLAvatarState,
|
||||
};
|
||||
|
||||
void ISetDescName() const;
|
||||
bool fIsInitialState;
|
||||
|
||||
protected:
|
||||
int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
|
||||
bool fPersistOnServer;
|
||||
bool fIsAvatarState;
|
||||
mutable std::string fDescName; // for debugging output only, not read/written
|
||||
public:
|
||||
CLASSNAME_REGISTER( plNetMsgSDLState );
|
||||
GETINTERFACE_ANY(plNetMsgSDLState, plNetMsgStreamedObject);
|
||||
|
||||
plNetMsgSDLState() : fIsInitialState(0), fPersistOnServer(true), fIsAvatarState(false) { SetBit(kNeedsReliableSend); }
|
||||
|
||||
bool PersistOnServer() const { return fPersistOnServer != 0; }
|
||||
void SetPersistOnServer(bool b) { fPersistOnServer = b; }
|
||||
|
||||
bool IsAvatarState() const { return fIsAvatarState != 0; }
|
||||
void SetIsAvatarState(bool b) { fIsAvatarState = b; }
|
||||
|
||||
// debug
|
||||
std::string AsStdString() const;
|
||||
bool IsInitialState() const {return fIsInitialState!=0; }
|
||||
void SetIsInitialState( bool v ) { fIsInitialState=v; }
|
||||
|
||||
void ReadVersion(hsStream* s, hsResMgr* mgr);
|
||||
void WriteVersion(hsStream* s, hsResMgr* mgr);
|
||||
};
|
||||
|
||||
//
|
||||
// New SaveState system
|
||||
//
|
||||
class plNetMsgSDLStateBCast : public plNetMsgSDLState
|
||||
{
|
||||
protected:
|
||||
int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
public:
|
||||
CLASSNAME_REGISTER( plNetMsgSDLStateBCast );
|
||||
GETINTERFACE_ANY(plNetMsgSDLStateBCast, plNetMsgSDLState);
|
||||
|
||||
// virtuals
|
||||
bool NeedsBroadcast() const { return true; }
|
||||
|
||||
void ReadVersion(hsStream* s, hsResMgr* mgr);
|
||||
void WriteVersion(hsStream* s, hsResMgr* mgr);
|
||||
};
|
||||
|
||||
//
|
||||
// Object state request msg
|
||||
//
|
||||
class plNetMsgObjStateRequest : public plNetMsgObject
|
||||
{
|
||||
public:
|
||||
plNetMsgObjStateRequest() { SetBit(kIsSystemMessage|kNeedsReliableSend); }
|
||||
|
||||
CLASSNAME_REGISTER( plNetMsgObjStateRequest );
|
||||
GETINTERFACE_ANY( plNetMsgObjStateRequest, plNetMsgObject );
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// abstract message class which contains a list of rooms
|
||||
//
|
||||
class plNetMsgRoomsList : public plNetMessage
|
||||
{
|
||||
protected:
|
||||
std::vector<plLocation> fRooms;
|
||||
std::vector<char*> fRoomNames; // for debug usage only
|
||||
|
||||
int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
public:
|
||||
plNetMsgRoomsList() {}
|
||||
~plNetMsgRoomsList();
|
||||
|
||||
CLASSNAME_REGISTER( plNetMsgRoomsList );
|
||||
GETINTERFACE_ANY( plNetMsgRoomsList, plNetMessage );
|
||||
|
||||
void AddRoom(plKey rmKey);
|
||||
void AddRoomLocation(plLocation loc, const char* rmName);
|
||||
int FindRoomLocation(plLocation loc);
|
||||
|
||||
int GetNumRooms() const { return fRooms.size(); }
|
||||
plLocation GetRoomLoc(int i) const { return fRooms[i]; }
|
||||
const char* GetRoomName(int i) const { return fRoomNames[i]; } // debug
|
||||
};
|
||||
|
||||
//
|
||||
// Game msg - wraps a plMessage.
|
||||
//
|
||||
class hsResMgr;
|
||||
|
||||
class plNetMsgGameMessage: public plNetMsgStream
|
||||
{
|
||||
protected:
|
||||
plClientUnifiedTime fDeliveryTime; // for future timestamping
|
||||
|
||||
int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
public:
|
||||
plNetMsgGameMessage() { SetBit(kNeedsReliableSend); }
|
||||
|
||||
CLASSNAME_REGISTER( plNetMsgGameMessage );
|
||||
GETINTERFACE_ANY( plNetMsgGameMessage, plNetMsgStream );
|
||||
enum ContentsFlags
|
||||
{
|
||||
kNetGameMsgDeliveryTime,
|
||||
kNetGameMsgGameMsg,
|
||||
};
|
||||
plClientUnifiedTime& GetDeliveryTime() { return fDeliveryTime; }
|
||||
void SetDeliveryTime(plClientUnifiedTime& ut) { fDeliveryTime=ut; }
|
||||
|
||||
plMessage* GetContainedMsg(hsResMgr* resmgr = nil);
|
||||
|
||||
// virtuals
|
||||
bool NeedsBroadcast() const { return true; }
|
||||
void ReadVersion(hsStream* s, hsResMgr* mgr);
|
||||
void WriteVersion(hsStream* s, hsResMgr* mgr);
|
||||
|
||||
// debug
|
||||
std::string AsStdString() const
|
||||
{
|
||||
std::string s;
|
||||
const char* noc=plFactory::GetTheFactory()->GetNameOfClass(StreamInfo()->GetStreamType());
|
||||
xtl::format(s,"%s %s",plNetMsgStream::AsStdString().c_str(), noc ? noc : "?");
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// special game msg for loading clones/avatars
|
||||
//
|
||||
class plNetMsgLoadClone : public plNetMsgGameMessage
|
||||
{
|
||||
private:
|
||||
enum ContentFlags
|
||||
{
|
||||
kObjectHelper,
|
||||
kIsPlayer,
|
||||
kIsLoading,
|
||||
kIsInitialState,
|
||||
};
|
||||
protected:
|
||||
bool fIsPlayer;
|
||||
bool fIsLoading;
|
||||
bool fIsInitialState;
|
||||
plNetMsgObjectHelper fObjectHelper;
|
||||
|
||||
int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
public:
|
||||
|
||||
CLASSNAME_REGISTER( plNetMsgLoadClone );
|
||||
GETINTERFACE_ANY_AUX(plNetMsgLoadClone, plNetMsgGameMessage,plNetMsgObjectHelper,fObjectHelper)
|
||||
|
||||
plNetMsgLoadClone() : fIsPlayer(true),fIsLoading(true),fIsInitialState(false) {}
|
||||
|
||||
void ReadVersion(hsStream* s, hsResMgr* mgr);
|
||||
void WriteVersion(hsStream* s, hsResMgr* mgr);
|
||||
|
||||
plNetMsgObjectHelper* ObjectInfo() { return &fObjectHelper; }
|
||||
const plNetMsgObjectHelper* ObjectInfo() const { return &fObjectHelper; }
|
||||
|
||||
bool GetIsPlayer() const { return fIsPlayer!=0; }
|
||||
bool GetIsLoading() const { return fIsLoading!=0; }
|
||||
bool GetIsInitialState() const { return fIsInitialState!=0; }
|
||||
|
||||
void SetIsPlayer(bool p) { fIsPlayer=p; }
|
||||
void SetIsLoading(bool p) { fIsLoading=p; }
|
||||
void SetIsInitialState(bool p) {fIsInitialState=p; }
|
||||
|
||||
|
||||
// debug
|
||||
std::string AsStdString() const
|
||||
{
|
||||
std::string s;
|
||||
char tmp[256];
|
||||
xtl::format(s,"object=%s initial=%d, %s",fObjectHelper.GetUoid().StringIze(tmp), fIsInitialState,
|
||||
plNetMsgGameMessage::AsStdString().c_str());
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// special msg when a player is paged in/out
|
||||
//
|
||||
class plNetMsgPlayerPage : public plNetMessage
|
||||
{
|
||||
protected:
|
||||
int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
public:
|
||||
plUoid fUoid;
|
||||
bool fUnload;
|
||||
|
||||
plNetMsgPlayerPage() : fUnload(false) { SetBit(kNeedsReliableSend); }
|
||||
plNetMsgPlayerPage(plUoid uoid, hsBool unload) : fUoid(uoid), fUnload(unload) { }
|
||||
|
||||
CLASSNAME_REGISTER( plNetMsgPlayerPage );
|
||||
GETINTERFACE_ANY( plNetMsgPlayerPage, plNetMessage);
|
||||
};
|
||||
|
||||
//
|
||||
// a game message that takes a list of other clients as receivers
|
||||
//
|
||||
class plNetMsgGameMessageDirected : public plNetMsgGameMessage
|
||||
{
|
||||
private:
|
||||
enum ContentFlags
|
||||
{
|
||||
kRecievers,
|
||||
};
|
||||
protected:
|
||||
plNetMsgReceiversListHelper fReceivers;
|
||||
|
||||
int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
public:
|
||||
CLASSNAME_REGISTER( plNetMsgGameMessageDirected );
|
||||
GETINTERFACE_ANY_AUX(plNetMsgGameMessageDirected,plNetMsgGameMessage,
|
||||
plNetMsgReceiversListHelper,fReceivers)
|
||||
|
||||
plNetMsgReceiversListHelper* Receivers() { return &fReceivers; }
|
||||
|
||||
// virtuals
|
||||
void ReadVersion(hsStream* s, hsResMgr* mgr);
|
||||
void WriteVersion(hsStream* s, hsResMgr* mgr);
|
||||
};
|
||||
|
||||
//
|
||||
// Message when a room is paged in/out
|
||||
//
|
||||
class plNetMsgPagingRoom : public plNetMsgRoomsList
|
||||
{
|
||||
public:
|
||||
enum PageFlags
|
||||
{
|
||||
kPagingOut=0x1, // else paging in
|
||||
kResetList=0x2, // server should reset his existing list before using this msg
|
||||
kRequestState=0x4, // also want current room state sent to me
|
||||
kFinalRoomInAge=0x8 // done paging in the age
|
||||
};
|
||||
protected:
|
||||
UInt8 fPageFlags;
|
||||
|
||||
int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
public:
|
||||
plNetMsgPagingRoom() : fPageFlags(0) { SetBit(kIsSystemMessage|kNeedsReliableSend); }
|
||||
~plNetMsgPagingRoom() {}
|
||||
|
||||
CLASSNAME_REGISTER( plNetMsgPagingRoom );
|
||||
GETINTERFACE_ANY( plNetMsgPagingRoom, plNetMsgRoomsList );
|
||||
|
||||
void SetPageFlags(UInt8 f) { fPageFlags=f; }
|
||||
UInt8 GetPageFlags() const { return fPageFlags; }
|
||||
|
||||
void SetPagingOut(hsBool b) { if (b) fPageFlags |= kPagingOut; else fPageFlags&=~kPagingOut; }
|
||||
hsBool GetPagingOut() const { return (fPageFlags & kPagingOut) != 0; }
|
||||
|
||||
void SetResetList(hsBool b) { if (b) fPageFlags |= kResetList; else fPageFlags &=~kResetList; }
|
||||
hsBool GetResetList() const { return (fPageFlags & kResetList) != 0; }
|
||||
|
||||
void SetRequestingState(hsBool b) { if (b) fPageFlags |= kRequestState; else fPageFlags &=~kRequestState; }
|
||||
hsBool GetRequestingState() const { return (fPageFlags & kRequestState) != 0; }
|
||||
|
||||
// debug
|
||||
std::string AsStdString() const
|
||||
{
|
||||
std::string s;
|
||||
xtl::format(s,"pageFlags:%02X, paging %s, requestingState:%s, resetting=%d",fPageFlags,
|
||||
(fPageFlags&kPagingOut)?"out":"in", (fPageFlags&kRequestState)?"yes":"no",
|
||||
(fPageFlags & kResetList)!=0);
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Client requests game state update by rooms.
|
||||
// an empty rooms list means ALL rooms I have loaded.
|
||||
//
|
||||
class plNetMsgGameStateRequest : public plNetMsgRoomsList
|
||||
{
|
||||
public:
|
||||
plNetMsgGameStateRequest() { SetBit(kIsSystemMessage|kNeedsReliableSend); }
|
||||
|
||||
CLASSNAME_REGISTER( plNetMsgGameStateRequest );
|
||||
GETINTERFACE_ANY( plNetMsgGameStateRequest, plNetMsgRoomsList );
|
||||
};
|
||||
|
||||
//
|
||||
// sent by game server to change clients ownership of a netGroup
|
||||
//
|
||||
class plNetMsgGroupOwner: public plNetMsgServerToClient
|
||||
{
|
||||
public:
|
||||
class GroupInfo
|
||||
{
|
||||
public:
|
||||
plNetGroupId fGroupID;
|
||||
bool fOwnIt; // else not the owner
|
||||
|
||||
void Read(hsStream* s) { fGroupID.Read(s); s->LogReadSwap(&fOwnIt,"GroupOwner OwnIt"); }
|
||||
void Write(hsStream* s) { fGroupID.Write(s); s->WriteSwap(fOwnIt); }
|
||||
|
||||
GroupInfo() : fGroupID(plNetGroup::kNetGroupUnknown), fOwnIt(false) {}
|
||||
GroupInfo(plNetGroupId gID, hsBool o) : fGroupID(gID),fOwnIt(o) {}
|
||||
};
|
||||
protected:
|
||||
std::vector<GroupInfo> fGroups;
|
||||
|
||||
int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
public:
|
||||
CLASSNAME_REGISTER( plNetMsgGroupOwner );
|
||||
GETINTERFACE_ANY( plNetMsgGroupOwner, plNetMsgServerToClient );
|
||||
|
||||
// getters
|
||||
int GetNumGroups() const { return fGroups.size(); }
|
||||
GroupInfo GetGroupInfo(int i) const { return fGroups[i]; }
|
||||
|
||||
// setters
|
||||
void AddGroupInfo(GroupInfo gi) { fGroups.push_back(gi); }
|
||||
void ClearGroupInfo() { fGroups.clear(); }
|
||||
|
||||
bool IsOwner() { return fGroups[0].fOwnIt; }
|
||||
};
|
||||
|
||||
//
|
||||
// voice recording buffer
|
||||
//
|
||||
class plNetMsgVoice: public plNetMessage
|
||||
{
|
||||
private:
|
||||
enum ContentFlags
|
||||
{
|
||||
kDead_FrameSize,
|
||||
kReceivers,
|
||||
kVoiceFlags,
|
||||
kVoiceData
|
||||
};
|
||||
protected:
|
||||
UInt8 fFlags; // voice flags
|
||||
UInt8 fNumFrames; // number of frames encoded
|
||||
std::string fVoiceData;
|
||||
|
||||
plNetMsgReceiversListHelper fReceivers;
|
||||
|
||||
int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
public:
|
||||
plNetMsgVoice(): fFlags(0), fNumFrames(0) { }
|
||||
~plNetMsgVoice() {}
|
||||
|
||||
CLASSNAME_REGISTER( plNetMsgVoice );
|
||||
GETINTERFACE_ANY_AUX(plNetMsgVoice,plNetMessage,plNetMsgReceiversListHelper,fReceivers)
|
||||
|
||||
void SetFlag(int f) { fFlags |= f; }
|
||||
int GetFlags() { return fFlags; }
|
||||
|
||||
void SetNumFrames(UInt8 f) { fNumFrames = f; }
|
||||
UInt8 GetNumFrames() const { return fNumFrames; }
|
||||
|
||||
void SetVoiceData(char *data, int len );
|
||||
int GetVoiceDataLen() const { return fVoiceData.length(); }
|
||||
const char *GetVoiceData() const;
|
||||
|
||||
plNetMsgReceiversListHelper* Receivers() { return &fReceivers; }
|
||||
|
||||
// virtuals
|
||||
bool NeedsBroadcast() const { return true; }
|
||||
|
||||
void ReadVersion(hsStream* s, hsResMgr* mgr);
|
||||
void WriteVersion(hsStream* s, hsResMgr* mgr);
|
||||
|
||||
// debug
|
||||
std::string AsStdString() const
|
||||
{
|
||||
std::string s;
|
||||
xtl::format(s,"len=%d",fVoiceData.size());
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// base class for dealing with plNetSharedState
|
||||
//
|
||||
class plNetSharedState;
|
||||
class plNetMsgSharedState : public plNetMsgStreamedObject
|
||||
{
|
||||
private:
|
||||
enum ContentFlags
|
||||
{
|
||||
kLockRequest,
|
||||
};
|
||||
protected:
|
||||
bool fLockRequest;
|
||||
|
||||
int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
public:
|
||||
plNetMsgSharedState() : fLockRequest(false) {}
|
||||
~plNetMsgSharedState() {}
|
||||
|
||||
CLASSNAME_REGISTER( plNetMsgSharedState );
|
||||
GETINTERFACE_ANY(plNetMsgSharedState, plNetMsgStreamedObject);
|
||||
|
||||
void CopySharedState(plNetSharedState* ss);
|
||||
|
||||
void SetLockRequest(hsBool b) { fLockRequest=b; }
|
||||
hsBool GetLockRequest() const { return fLockRequest; }
|
||||
|
||||
void ReadVersion(hsStream* s, hsResMgr* mgr);
|
||||
void WriteVersion(hsStream* s, hsResMgr* mgr);
|
||||
|
||||
// debug
|
||||
std::string AsStdString() const
|
||||
{
|
||||
std::string s;
|
||||
xtl::format(s,"lockReq=%d, %s",fLockRequest, plNetMsgStreamedObject::AsStdString().c_str());
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// attempt to lock/unlock and set generic shared state on server.
|
||||
// lock attempts will generate server reply messages confirming or denying the action.
|
||||
//
|
||||
class plNetMsgTestAndSet : public plNetMsgSharedState
|
||||
{
|
||||
public:
|
||||
plNetMsgTestAndSet() { SetBit(kNeedsReliableSend); }
|
||||
|
||||
CLASSNAME_REGISTER( plNetMsgTestAndSet );
|
||||
GETINTERFACE_ANY(plNetMsgTestAndSet, plNetMsgSharedState);
|
||||
};
|
||||
|
||||
//
|
||||
// provides a way to query sharedState on the server
|
||||
//
|
||||
class plNetMsgGetSharedState : public plNetMsgObject
|
||||
{
|
||||
protected:
|
||||
char fSharedStateName[kMaxNameLen];
|
||||
|
||||
int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
public:
|
||||
plNetMsgGetSharedState() { *fSharedStateName=0; SetBit(kNeedsReliableSend); }
|
||||
~plNetMsgGetSharedState() {}
|
||||
|
||||
CLASSNAME_REGISTER( plNetMsgGetSharedState );
|
||||
GETINTERFACE_ANY( plNetMsgGetSharedState, plNetMsgObject );
|
||||
|
||||
void SetSharedStateName(char* n) { if (n) hsStrncpy(fSharedStateName, n, kMaxNameLen); }
|
||||
char* GetSharedStateName() { return fSharedStateName; }
|
||||
};
|
||||
|
||||
//
|
||||
// msg which sets the update frequency for a group of objects on the server
|
||||
//
|
||||
class plNetMsgObjectUpdateFilter : public plNetMessage
|
||||
{
|
||||
protected:
|
||||
plNetMsgObjectListHelper fObjectListHelper;
|
||||
float fMaxUpdateFreq; // in secs
|
||||
|
||||
int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
public:
|
||||
plNetMsgObjectUpdateFilter() : fMaxUpdateFreq(-1) {}
|
||||
~plNetMsgObjectUpdateFilter() {}
|
||||
|
||||
CLASSNAME_REGISTER( plNetMsgObjectUpdateFilter );
|
||||
GETINTERFACE_ANY_AUX(plNetMsgObjectUpdateFilter,plNetMessage,plNetMsgObjectListHelper,fObjectListHelper)
|
||||
|
||||
plNetMsgObjectListHelper* ObjectListInfo() { return &fObjectListHelper; }
|
||||
|
||||
void SetMaxUpdateFreq(float f) { fMaxUpdateFreq=f; }
|
||||
float GetMaxUpdateFreq() const { return fMaxUpdateFreq; }
|
||||
};
|
||||
|
||||
//
|
||||
// Client wants a list of all members in the session
|
||||
//
|
||||
class plNetMsgMembersListReq : public plNetMessage
|
||||
{
|
||||
public:
|
||||
plNetMsgMembersListReq() { SetBit(kIsSystemMessage|kNeedsReliableSend); }
|
||||
|
||||
CLASSNAME_REGISTER( plNetMsgMembersListReq );
|
||||
GETINTERFACE_ANY( plNetMsgMembersListReq, plNetMessage );
|
||||
};
|
||||
|
||||
//
|
||||
// Server returns a list of all members in the session
|
||||
//
|
||||
class plNetMsgMembersList : public plNetMsgServerToClient
|
||||
{
|
||||
protected:
|
||||
plNetMsgMemberListHelper fMemberListHelper;
|
||||
protected:
|
||||
int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
public:
|
||||
CLASSNAME_REGISTER( plNetMsgMembersList );
|
||||
GETINTERFACE_ANY_AUX(plNetMsgMembersList,plNetMsgServerToClient,plNetMsgMemberListHelper,fMemberListHelper)
|
||||
|
||||
plNetMsgMemberListHelper* MemberListInfo() { return &fMemberListHelper; }
|
||||
};
|
||||
|
||||
//
|
||||
// server tells client to add or remove a session member
|
||||
//
|
||||
class plNetMsgMemberUpdate : public plNetMsgServerToClient
|
||||
{
|
||||
protected:
|
||||
plNetMsgMemberInfoHelper fMemberInfo;
|
||||
bool fAddMember; // else remove member
|
||||
protected:
|
||||
int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
public:
|
||||
CLASSNAME_REGISTER( plNetMsgMemberUpdate );
|
||||
GETINTERFACE_ANY_AUX(plNetMsgMemberUpdate,plNetMsgServerToClient,plNetMsgMemberInfoHelper,fMemberInfo)
|
||||
|
||||
bool AddingMember() { return fAddMember; }
|
||||
void SetAddingMember(bool b) { fAddMember=b; }
|
||||
|
||||
plNetMsgMemberInfoHelper* MemberInfo() { return &fMemberInfo; }
|
||||
bool NeedsBroadcast() const { return true; } // send to all clients
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// ListenList updater msgs. For voice-broadcasting purposes.
|
||||
// Contains a list of other players which I am [not] listening to.
|
||||
// Sent client-client or client-server.
|
||||
//
|
||||
class plNetMsgListenListUpdate : public plNetMessage
|
||||
{
|
||||
private:
|
||||
plNetMsgReceiversListHelper fReceivers; // used by server, the players we're listening to
|
||||
bool fAdding; // else removing
|
||||
|
||||
int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
public:
|
||||
plNetMsgListenListUpdate() : fAdding(false) {}
|
||||
~plNetMsgListenListUpdate() {}
|
||||
|
||||
CLASSNAME_REGISTER( plNetMsgListenListUpdate );
|
||||
GETINTERFACE_ANY_AUX(plNetMsgListenListUpdate,plNetMessage,plNetMsgReceiversListHelper,fReceivers)
|
||||
|
||||
plNetMsgReceiversListHelper* Receivers() { return &fReceivers; }
|
||||
|
||||
bool GetAdding() const { return fAdding; }
|
||||
void SetAdding(bool a) { fAdding=a; }
|
||||
|
||||
// virtuals
|
||||
bool NeedsBroadcast() const { return true; } // use rcvrs list
|
||||
};
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
class plNetMsgInitialAgeStateSent : public plNetMsgServerToClient
|
||||
{
|
||||
UInt32 fNumInitialSDLStates;
|
||||
int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
public:
|
||||
plNetMsgInitialAgeStateSent():fNumInitialSDLStates(0){}
|
||||
CLASSNAME_REGISTER( plNetMsgInitialAgeStateSent );
|
||||
GETINTERFACE_ANY( plNetMsgInitialAgeStateSent, plNetMsgServerToClient);
|
||||
void SetNumInitialSDLStates( UInt32 n ) { fNumInitialSDLStates=n; }
|
||||
UInt32 GetNumInitialSDLStates() const { return fNumInitialSDLStates; }
|
||||
};
|
||||
|
||||
//
|
||||
// msg which sets the update frequency for a group of objects on the server
|
||||
//
|
||||
class plNetMsgRelevanceRegions : public plNetMessage
|
||||
{
|
||||
protected:
|
||||
hsBitVector fRegionsImIn;
|
||||
hsBitVector fRegionsICareAbout;
|
||||
|
||||
int IPokeBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
int IPeekBuffer(hsStream* stream, UInt32 peekOptions=0);
|
||||
public:
|
||||
plNetMsgRelevanceRegions() { SetBit(kNeedsReliableSend); }
|
||||
~plNetMsgRelevanceRegions() {}
|
||||
|
||||
CLASSNAME_REGISTER( plNetMsgRelevanceRegions );
|
||||
GETINTERFACE_ANY(plNetMsgRelevanceRegions, plNetMessage)
|
||||
|
||||
void SetRegionsICareAbout(const hsBitVector& r) { fRegionsICareAbout=r; }
|
||||
void SetRegionsImIn(const hsBitVector& r) { fRegionsImIn=r; }
|
||||
|
||||
const hsBitVector& GetRegionsICareAbout() const { return fRegionsICareAbout; }
|
||||
const hsBitVector& GetRegionsImIn() const { return fRegionsImIn; }
|
||||
|
||||
std::string AsStdString() const
|
||||
{
|
||||
std::string s;
|
||||
std::string b1, b2;
|
||||
int i;
|
||||
for(i=0;i<fRegionsImIn.GetNumBitVectors(); i++)
|
||||
b1 += xtl::format("0x%x ", fRegionsImIn.GetBitVector(i)).c_str();
|
||||
for(i=0;i<fRegionsICareAbout.GetNumBitVectors(); i++)
|
||||
b2 += xtl::format("0x%x ", fRegionsICareAbout.GetBitVector(i)).c_str();
|
||||
xtl::format( s, "rgnsImIn:%s, rgnsICareAbout:%s, %s",
|
||||
b1.c_str(), b2.c_str(), plNetMessage::AsStdString().c_str() );
|
||||
return s;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // plNetMessage_h_inc
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// End.
|
||||
|
||||
|
@ -0,0 +1,77 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plNetMsgCreatable_h
|
||||
#define plNetMsgCreatable_h
|
||||
|
||||
// kept separate for a reason
|
||||
|
||||
#include "../pnFactory/plCreator.h"
|
||||
#include "plNetMessage.h"
|
||||
|
||||
// NON CREATABLES
|
||||
REGISTER_NONCREATABLE(plNetMessage);
|
||||
REGISTER_NONCREATABLE(plNetMsgObject);
|
||||
REGISTER_NONCREATABLE(plNetMsgStream);
|
||||
REGISTER_NONCREATABLE(plNetMsgRoomsList);
|
||||
REGISTER_NONCREATABLE(plNetMsgStreamedObject);
|
||||
REGISTER_NONCREATABLE(plNetMsgSharedState);
|
||||
|
||||
// HELPERS
|
||||
REGISTER_CREATABLE(plNetMsgStreamHelper);
|
||||
REGISTER_CREATABLE(plNetMsgObjectHelper);
|
||||
REGISTER_CREATABLE(plNetMsgObjectListHelper);
|
||||
REGISTER_CREATABLE(plNetMsgMemberInfoHelper);
|
||||
REGISTER_CREATABLE(plNetMsgMemberListHelper);
|
||||
REGISTER_CREATABLE(plNetMsgStreamableHelper);
|
||||
REGISTER_CREATABLE(plNetMsgReceiversListHelper);
|
||||
REGISTER_CREATABLE(plNetMsgCreatableHelper);
|
||||
|
||||
// CLIENT MSGS
|
||||
REGISTER_CREATABLE(plNetMsgGameStateRequest);
|
||||
REGISTER_CREATABLE(plNetMsgSDLState);
|
||||
REGISTER_CREATABLE(plNetMsgSDLStateBCast);
|
||||
REGISTER_CREATABLE(plNetMsgLoadClone);
|
||||
REGISTER_CREATABLE(plNetMsgPlayerPage);
|
||||
REGISTER_CREATABLE(plNetMsgGameMessage);
|
||||
REGISTER_CREATABLE(plNetMsgGameMessageDirected);
|
||||
REGISTER_CREATABLE(plNetMsgPagingRoom);
|
||||
REGISTER_CREATABLE(plNetMsgGroupOwner);
|
||||
REGISTER_CREATABLE(plNetMsgVoice);
|
||||
REGISTER_CREATABLE(plNetMsgTestAndSet);
|
||||
REGISTER_CREATABLE(plNetMsgGetSharedState);
|
||||
REGISTER_CREATABLE(plNetMsgObjStateRequest);
|
||||
REGISTER_CREATABLE(plNetMsgObjectUpdateFilter);
|
||||
REGISTER_CREATABLE(plNetMsgMembersListReq );
|
||||
REGISTER_CREATABLE(plNetMsgMembersList );
|
||||
REGISTER_CREATABLE(plNetMsgServerToClient);
|
||||
REGISTER_CREATABLE(plNetMsgMemberUpdate );
|
||||
REGISTER_CREATABLE(plNetMsgListenListUpdate);
|
||||
|
||||
REGISTER_CREATABLE(plNetMsgInitialAgeStateSent);
|
||||
REGISTER_CREATABLE(plNetMsgRelevanceRegions);
|
||||
|
||||
|
||||
#endif // plNetMsgCreatable_h
|
@ -0,0 +1,547 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#include "plNetMsgHelpers.h"
|
||||
#include "plNetMessage.h"
|
||||
#include "../plCompression/plZlibCompress.h"
|
||||
#include "../pnNetCommon/plNetServers.h"
|
||||
#include "../pnNetCommon/plNetApp.h"
|
||||
#include "../pnKeyedObject/plKey.h"
|
||||
#include "../pnMessage/plMessage.h"
|
||||
#include "hsStream.h"
|
||||
#include <algorithm>
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// plNetMsgStreamableHelper
|
||||
|
||||
plNetMsgStreamableHelper & plNetMsgStreamableHelper::operator =(hsStreamable * value)
|
||||
{
|
||||
fObject = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
int plNetMsgStreamableHelper::Poke(hsStream* stream, UInt32 peekOptions)
|
||||
{
|
||||
hsAssert(fObject, "plNetMsgStreamableHelper::Poke: fObject not set.");
|
||||
fObject->Write(stream);
|
||||
return stream->GetPosition();
|
||||
}
|
||||
|
||||
int plNetMsgStreamableHelper::Peek(hsStream* stream, UInt32 peekOptions)
|
||||
{
|
||||
hsAssert(fObject, "plNetMsgStreamableHelper::Peek: fObject not set.");
|
||||
fObject->Read(stream);
|
||||
return stream->GetPosition();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// plNetMsgCreatableHelper
|
||||
|
||||
plNetMsgCreatableHelper::plNetMsgCreatableHelper(plCreatable * object)
|
||||
:fCreatable(object)
|
||||
,fWeCreatedIt(false)
|
||||
{
|
||||
}
|
||||
|
||||
plNetMsgCreatableHelper::~plNetMsgCreatableHelper()
|
||||
{
|
||||
if (fWeCreatedIt)
|
||||
hsRefCnt_SafeUnRef(fCreatable);
|
||||
}
|
||||
|
||||
plNetMsgCreatableHelper & plNetMsgCreatableHelper::operator =(plCreatable * value)
|
||||
{
|
||||
SetObject(value);
|
||||
return *this;
|
||||
}
|
||||
|
||||
plNetMsgCreatableHelper::operator plCreatable*()
|
||||
{
|
||||
return GetObject();
|
||||
}
|
||||
|
||||
plNetMsgCreatableHelper::operator const plCreatable*()
|
||||
{
|
||||
return GetObject();
|
||||
}
|
||||
|
||||
void plNetMsgCreatableHelper::SetObject(plCreatable * object)
|
||||
{
|
||||
if (fWeCreatedIt)
|
||||
hsRefCnt_SafeUnRef(fCreatable);
|
||||
fCreatable = object;
|
||||
fWeCreatedIt = false;
|
||||
}
|
||||
|
||||
plCreatable * plNetMsgCreatableHelper::GetObject()
|
||||
{
|
||||
return fCreatable;
|
||||
}
|
||||
|
||||
int plNetMsgCreatableHelper::Poke(hsStream * s, UInt32 peekOptions)
|
||||
{
|
||||
hsAssert(fCreatable,"plNetMsgCreatableHelper::Poke: fCreatable not set");
|
||||
UInt16 classIndex = fCreatable->ClassIndex();
|
||||
s->WriteSwap(classIndex);
|
||||
fCreatable->Write(s,nil);
|
||||
return s->GetPosition();
|
||||
}
|
||||
|
||||
int plNetMsgCreatableHelper::Peek(hsStream * s, UInt32 peekOptions)
|
||||
{
|
||||
UInt16 classIndex;
|
||||
s->LogSubStreamStart("push me");
|
||||
s->LogReadSwap(&classIndex,"ClassIdx");
|
||||
SetObject(plFactory::Create(classIndex));
|
||||
fWeCreatedIt = true;
|
||||
hsAssert(fCreatable,"plNetMsgCreatableHelper::Peek: Failed to create plCreatable. Invalid ClassIndex?");
|
||||
fCreatable->Read(s,nil);
|
||||
s->LogSubStreamEnd();
|
||||
return s->GetPosition();
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// NOT A MSG
|
||||
// PL STREAM MSG - HELPER class
|
||||
/////////////////////////////////////////////////////////
|
||||
plNetMsgStreamHelper::plNetMsgStreamHelper() : fStreamBuf(nil), fStreamType(-1), fStreamLen(0),
|
||||
fCompressionType(plNetMessage::kCompressionNone), fUncompressedSize(0),
|
||||
fCompressionThreshold( kDefaultCompressionThreshold )
|
||||
{
|
||||
}
|
||||
|
||||
void plNetMsgStreamHelper::Clear()
|
||||
{
|
||||
delete [] fStreamBuf;
|
||||
fStreamBuf = nil;
|
||||
fStreamType = 0xff;
|
||||
fStreamLen = 0;
|
||||
fCompressionType = plNetMessage::kCompressionNone;
|
||||
fCompressionThreshold = kDefaultCompressionThreshold;
|
||||
}
|
||||
|
||||
int plNetMsgStreamHelper::Poke(hsStream* stream, UInt32 peekOptions)
|
||||
{
|
||||
if ( !(peekOptions & plNetMessage::kDontCompress) )
|
||||
Compress();
|
||||
stream->WriteSwap(fUncompressedSize);
|
||||
stream->WriteSwap(fCompressionType);
|
||||
stream->WriteSwap(fStreamLen);
|
||||
stream->Write(fStreamLen, fStreamBuf);
|
||||
return stream->GetPosition();
|
||||
}
|
||||
|
||||
int plNetMsgStreamHelper::Peek(hsStream* stream, const UInt32 peekOptions)
|
||||
{
|
||||
stream->LogSubStreamStart("Stream Helper");
|
||||
stream->LogReadSwap(&fUncompressedSize,"UncompressedSize");
|
||||
stream->LogReadSwap(&fCompressionType,"CompressionType");
|
||||
stream->LogReadSwap(&fStreamLen,"StreamLen");
|
||||
|
||||
if (fStreamLen) // stream data exists
|
||||
{
|
||||
if (!(peekOptions & plNetMessage::kSkipStream))
|
||||
{
|
||||
if (!fStreamBuf)
|
||||
IAllocStream(fStreamLen);
|
||||
stream->LogRead(fStreamLen, fStreamBuf,"StreamData");
|
||||
if ( !(peekOptions & plNetMessage::kDontCompress) )
|
||||
Uncompress();
|
||||
fStreamType = *(Int16*)fStreamBuf; // grab from start fo stream
|
||||
}
|
||||
else
|
||||
{
|
||||
stream->ReadSwap(&fStreamType); // never compressed, set by reading directly from stream
|
||||
stream->LogSkip(fStreamLen-sizeof(fStreamType),"SkippedStreamHelper");
|
||||
}
|
||||
}
|
||||
stream->LogSubStreamEnd();
|
||||
return stream->GetPosition();
|
||||
}
|
||||
|
||||
void plNetMsgStreamHelper::ReadVersion(hsStream* s, hsResMgr* mgr)
|
||||
{
|
||||
hsBitVector contentFlags;
|
||||
contentFlags.Read(s);
|
||||
|
||||
if (contentFlags.IsBitSet(kUncompressedSize))
|
||||
s->ReadSwap(&fUncompressedSize);
|
||||
if (contentFlags.IsBitSet(kCompressionType))
|
||||
s->ReadSwap(&fCompressionType);
|
||||
if (contentFlags.IsBitSet(kStreamLen))
|
||||
s->ReadSwap(&fStreamLen);
|
||||
if (contentFlags.IsBitSet(kStreamBuf))
|
||||
{
|
||||
if (!fStreamBuf)
|
||||
IAllocStream(fStreamLen);
|
||||
s->Read(fStreamLen,fStreamBuf);
|
||||
}
|
||||
}
|
||||
|
||||
void plNetMsgStreamHelper::WriteVersion(hsStream* s, hsResMgr* mgr)
|
||||
{
|
||||
hsBitVector contentFlags;
|
||||
contentFlags.SetBit(kUncompressedSize);
|
||||
contentFlags.SetBit(kCompressionType);
|
||||
contentFlags.SetBit(kStreamLen);
|
||||
contentFlags.SetBit(kStreamBuf);
|
||||
contentFlags.Write(s);
|
||||
|
||||
s->WriteSwap(fUncompressedSize);
|
||||
s->WriteSwap(fCompressionType);
|
||||
s->WriteSwap(fStreamLen);
|
||||
s->Write(fStreamLen,fStreamBuf);
|
||||
}
|
||||
|
||||
void plNetMsgStreamHelper::IAllocStream(UInt32 len)
|
||||
{
|
||||
delete [] fStreamBuf;
|
||||
fStreamBuf=nil;
|
||||
fStreamLen=len;
|
||||
if (len)
|
||||
fStreamBuf = TRACKED_NEW UInt8[len];
|
||||
}
|
||||
|
||||
void plNetMsgStreamHelper::CopyStream(hsStream* ssStream)
|
||||
{
|
||||
UInt32 len=ssStream->GetEOF();
|
||||
IAllocStream(len);
|
||||
ssStream->CopyToMem(fStreamBuf);
|
||||
fStreamType = *(Int16*)fStreamBuf;
|
||||
}
|
||||
|
||||
void plNetMsgStreamHelper::CopyStream(Int32 len, const void* buf)
|
||||
{
|
||||
IAllocStream(len);
|
||||
memcpy(fStreamBuf, buf, len);
|
||||
fStreamType = *(Int16*)fStreamBuf;
|
||||
}
|
||||
|
||||
void plNetMsgStreamHelper::CopyFrom(const plNetMsgStreamHelper* other)
|
||||
{
|
||||
fUncompressedSize = other->GetUncompressedSize();
|
||||
fCompressionType = other->GetCompressionType();
|
||||
CopyStream(other->GetStreamLen(), other->GetStreamBuf());
|
||||
}
|
||||
|
||||
bool plNetMsgStreamHelper::Compress(int offset)
|
||||
{
|
||||
if ( !IsCompressable() )
|
||||
return true;
|
||||
|
||||
plZlibCompress compressor;
|
||||
UInt8* buf = (UInt8*)GetStreamBuf(); // skip creatable index
|
||||
UInt32 bufLen = GetStreamLen();
|
||||
UInt32 uncompressedSize = bufLen;
|
||||
SetUncompressedSize( uncompressedSize );
|
||||
if ( compressor.Compress( &buf, &bufLen, offset) )
|
||||
{
|
||||
SetCompressionType( plNetMessage::kCompressionZlib );
|
||||
SetStreamLen(bufLen);
|
||||
SetStreamBuf(buf);
|
||||
Int32 diff = uncompressedSize-bufLen;
|
||||
#if 0
|
||||
plNetApp::StaticDebugMsg( "\tCompressed stream: %lu->%lu bytes, (%s %d bytes, %.1f%%)",
|
||||
uncompressedSize, bufLen, (diff>=0)?"shrunk":"GREW?!?", diff, (diff/(float)uncompressedSize)*100 );
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
hsAssert( false, "plNetMsgStreamHelper: Compression failed" );
|
||||
SetCompressionType( plNetMessage::kCompressionFailed );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool plNetMsgStreamHelper::Uncompress(int offset)
|
||||
{
|
||||
if ( !IsCompressed() )
|
||||
return true;
|
||||
|
||||
UInt32 origLen = GetStreamLen();
|
||||
plZlibCompress compressor;
|
||||
UInt8* buf = (UInt8*)GetStreamBuf();
|
||||
UInt32 bufLen = origLen;
|
||||
if ( compressor.Uncompress( &buf, &bufLen, GetUncompressedSize(), offset ) )
|
||||
{
|
||||
SetCompressionType( plNetMessage::kCompressionNone );
|
||||
SetStreamLen(bufLen);
|
||||
SetStreamBuf(buf);
|
||||
Int32 diff = bufLen-origLen;
|
||||
#if 0
|
||||
plNetApp::StaticDebugMsg( "\tUncompressed stream: %lu->%lu bytes, (%s %d bytes, %.1f%%)",
|
||||
origLen, bufLen, (diff>=0)?"grew":"SHRUNK?!?", diff, (diff/(float)bufLen)*100 );
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
hsAssert( false, "plNetMsgStreamHelper: Uncompression failed" );
|
||||
SetCompressionType( plNetMessage::kCompressionFailed );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool plNetMsgStreamHelper::IsCompressed() const
|
||||
{
|
||||
return ( fCompressionType==plNetMessage::kCompressionZlib );
|
||||
}
|
||||
|
||||
bool plNetMsgStreamHelper::IsCompressable() const
|
||||
{
|
||||
return ( fCompressionType==plNetMessage::kCompressionNone
|
||||
&& fStreamLen>fCompressionThreshold );
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// NOT A MSG
|
||||
// plNetMsgObject - HELPER class
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
plNetMsgObjectHelper & plNetMsgObjectHelper::operator =(const plNetMsgObjectHelper & other)
|
||||
{
|
||||
fUoid = other.GetUoid();
|
||||
return *this;
|
||||
}
|
||||
|
||||
int plNetMsgObjectHelper::Poke(hsStream* stream, UInt32 peekOptions)
|
||||
{
|
||||
fUoid.Write(stream);
|
||||
|
||||
return stream->GetPosition();
|
||||
}
|
||||
|
||||
int plNetMsgObjectHelper::Peek(hsStream* stream, const UInt32 peekOptions)
|
||||
{
|
||||
stream->LogSubStreamStart("push me");
|
||||
fUoid.Read(stream);
|
||||
stream->LogSubStreamEnd();
|
||||
return stream->GetPosition();
|
||||
}
|
||||
|
||||
hsBool plNetMsgObjectHelper::SetFromKey(const plKey &key)
|
||||
{
|
||||
if (!key || !key->GetName())
|
||||
return false;
|
||||
|
||||
fUoid = key->GetUoid();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void plNetMsgObjectHelper::ReadVersion(hsStream* s, hsResMgr* mgr)
|
||||
{
|
||||
hsBitVector contentFlags;
|
||||
contentFlags.Read(s);
|
||||
|
||||
if (contentFlags.IsBitSet(kObjHelperUoid))
|
||||
fUoid.Read(s);
|
||||
}
|
||||
|
||||
void plNetMsgObjectHelper::WriteVersion(hsStream* s, hsResMgr* mgr)
|
||||
{
|
||||
hsBitVector contentFlags;
|
||||
contentFlags.SetBit(kObjHelperUoid);
|
||||
contentFlags.Write(s);
|
||||
|
||||
// kObjHelperUoid
|
||||
fUoid.Write(s);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// NOT A MSG
|
||||
// plNetMsgObjectList - HELPER class
|
||||
////////////////////////////////////////////////////////
|
||||
plNetMsgObjectListHelper::~plNetMsgObjectListHelper()
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
|
||||
void plNetMsgObjectListHelper::Reset()
|
||||
{
|
||||
int i;
|
||||
for( i=0 ; i<GetNumObjects() ; i++ )
|
||||
{
|
||||
delete GetObject(i);
|
||||
fObjects[i] = nil;
|
||||
} // for
|
||||
fObjects.clear();
|
||||
}
|
||||
|
||||
int plNetMsgObjectListHelper::Poke(hsStream* stream, UInt32 peekOptions)
|
||||
{
|
||||
Int16 num = GetNumObjects();
|
||||
stream->WriteSwap(num);
|
||||
int i;
|
||||
for( i=0 ;i<num ;i++ )
|
||||
{
|
||||
GetObject(i)->Poke(stream, peekOptions);
|
||||
} // for
|
||||
|
||||
return stream->GetPosition();
|
||||
}
|
||||
|
||||
int plNetMsgObjectListHelper::Peek(hsStream* stream, const UInt32 peekOptions)
|
||||
{
|
||||
Reset();
|
||||
|
||||
stream->LogSubStreamStart("push me");
|
||||
Int16 num;
|
||||
stream->LogReadSwap(&num,"ObjectListHelper Num");
|
||||
|
||||
int i;
|
||||
for( i=0 ;i<num ;i++ )
|
||||
{
|
||||
fObjects.push_back(TRACKED_NEW plNetMsgObjectHelper);
|
||||
GetObject(i)->Peek(stream, peekOptions);
|
||||
} // for
|
||||
stream->LogSubStreamEnd();
|
||||
return stream->GetPosition();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// NOT A MSG
|
||||
// plNetMsgMemberInfoHelper - HELPER class
|
||||
////////////////////////////////////////////////////////
|
||||
plNetMsgMemberInfoHelper::plNetMsgMemberInfoHelper()
|
||||
: fFlags(0)
|
||||
{
|
||||
}
|
||||
|
||||
int plNetMsgMemberInfoHelper::Peek(hsStream* s, const UInt32 peekOptions)
|
||||
{
|
||||
s->LogSubStreamStart("push me");
|
||||
s->LogReadSwap(&fFlags,"MemberInfoHelper Flags");
|
||||
fClientGuid.Read( s, nil );
|
||||
fAvatarUoid.Read(s);
|
||||
s->LogSubStreamEnd();
|
||||
return s->GetPosition();
|
||||
}
|
||||
|
||||
int plNetMsgMemberInfoHelper::Poke(hsStream* s, const UInt32 peekOptions)
|
||||
{
|
||||
s->WriteSwap(fFlags);
|
||||
fClientGuid.Write( s, nil );
|
||||
fAvatarUoid.Write(s);
|
||||
return s->GetPosition();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// NOT A MSG
|
||||
// plNetMsgMemberListHelper - HELPER class
|
||||
////////////////////////////////////////////////////////
|
||||
plNetMsgMemberListHelper::~plNetMsgMemberListHelper()
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<GetNumMembers();i++)
|
||||
delete fMembers[i];
|
||||
}
|
||||
|
||||
int plNetMsgMemberListHelper::Peek(hsStream* stream, const UInt32 peekOptions)
|
||||
{
|
||||
Int16 numMembers;
|
||||
stream->LogSubStreamStart("push me");
|
||||
stream->LogReadSwap(&numMembers,"MemberListHelper NumMembers");
|
||||
fMembers.clear();
|
||||
int i;
|
||||
for(i=0;i<numMembers;i++)
|
||||
{
|
||||
plNetMsgMemberInfoHelper* addr=TRACKED_NEW plNetMsgMemberInfoHelper;
|
||||
addr->Peek(stream, peekOptions);
|
||||
AddMember(addr);
|
||||
}
|
||||
stream->LogSubStreamEnd();
|
||||
return stream->GetPosition();
|
||||
}
|
||||
|
||||
int plNetMsgMemberListHelper::Poke(hsStream* stream, const UInt32 peekOptions)
|
||||
{
|
||||
Int16 numMembers = (Int16)GetNumMembers();
|
||||
stream->WriteSwap(numMembers);
|
||||
|
||||
int i;
|
||||
for(i=0;i<numMembers;i++)
|
||||
{
|
||||
fMembers[i]->GetClientGuid()->SetClientKey("");
|
||||
fMembers[i]->GetClientGuid()->SetAccountUUID(plUUID());
|
||||
fMembers[i]->Poke(stream, peekOptions);
|
||||
}
|
||||
|
||||
return stream->GetPosition();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
// NOT A MSG
|
||||
// plNetMsgReceiversListHelper - HELPER class
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
int plNetMsgReceiversListHelper::Peek(hsStream* stream, const UInt32 peekOptions)
|
||||
{
|
||||
UInt8 numIDs;
|
||||
stream->LogSubStreamStart("push me");
|
||||
stream->LogReadSwap(&numIDs,"ReceiversListHelper NumIDs");
|
||||
|
||||
fPlayerIDList.clear();
|
||||
int i;
|
||||
for(i=0;i<numIDs;i++)
|
||||
{
|
||||
UInt32 ID;
|
||||
stream->LogReadSwap(&ID,"ReceiversListHelper ID");
|
||||
AddReceiverPlayerID(ID);
|
||||
}
|
||||
stream->LogSubStreamEnd();
|
||||
return stream->GetPosition();
|
||||
}
|
||||
|
||||
int plNetMsgReceiversListHelper::Poke(hsStream* stream, const UInt32 peekOptions)
|
||||
{
|
||||
UInt8 numIDs = (UInt8)GetNumReceivers();
|
||||
stream->WriteSwap(numIDs);
|
||||
|
||||
int i;
|
||||
for(i=0;i<numIDs;i++)
|
||||
stream->WriteSwap(GetReceiverPlayerID(i));
|
||||
|
||||
return stream->GetPosition();
|
||||
}
|
||||
|
||||
|
||||
bool plNetMsgReceiversListHelper::RemoveReceiverPlayerID(UInt32 n)
|
||||
{
|
||||
std::vector<UInt32>::iterator res = std::find(fPlayerIDList.begin(), fPlayerIDList.end(), n);
|
||||
if (res != fPlayerIDList.end())
|
||||
{
|
||||
fPlayerIDList.erase(res);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -0,0 +1,327 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef PL_NET_MSG_HELPERS_inc
|
||||
#define PL_NET_MSG_HELPERS_inc
|
||||
|
||||
//
|
||||
// These are not messages per se, but helper classes which are used
|
||||
// in to avoid multiple derivation by net messages.
|
||||
//
|
||||
|
||||
#include "hsTypes.h"
|
||||
#include "hsUtils.h"
|
||||
#include "hsStream.h"
|
||||
#include "hsStlUtils.h"
|
||||
#include "../pnNetCommon/pnNetCommon.h"
|
||||
#include "../pnFactory/plCreatable.h"
|
||||
#include "../pnKeyedObject/plUoid.h"
|
||||
#include "../pnKeyedObject/plKey.h"
|
||||
#include "../plUnifiedTime/plUnifiedTime.h"
|
||||
#include "../plNetCommon/plClientGuid.h"
|
||||
#include <algorithm>
|
||||
|
||||
class plKey;
|
||||
class hsStream;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// plNetMsgStreamableHelper
|
||||
// Will peek/poke anything derived from hsStreamable
|
||||
|
||||
class plNetMsgStreamableHelper : public plCreatable
|
||||
{
|
||||
hsStreamable * fObject;
|
||||
public:
|
||||
plNetMsgStreamableHelper():fObject(nil){}
|
||||
plNetMsgStreamableHelper(hsStreamable * object):fObject(object){}
|
||||
plNetMsgStreamableHelper & operator =(hsStreamable * value);
|
||||
operator hsStreamable *() const { return fObject;}
|
||||
operator const hsStreamable *() const { return fObject;}
|
||||
CLASSNAME_REGISTER( plNetMsgStreamableHelper );
|
||||
GETINTERFACE_ANY(plNetMsgStreamableHelper, plCreatable);
|
||||
void SetObject(hsStreamable * object) { fObject=object;}
|
||||
hsStreamable * GetObject() const { return fObject;}
|
||||
int Poke(hsStream* stream, UInt32 peekOptions=0);
|
||||
int Peek(hsStream* stream, UInt32 peekOptions=0);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// plNetMsgCreatableHelper
|
||||
// Will peek/poke anything derived from plCreatable.
|
||||
// Will create the object upon read if it hasn't been set by SetObject().
|
||||
// When helper goes away, object will be unref-ed if it was created by
|
||||
// the helper, so if you GetObject() and want to keep it longer than the
|
||||
// lifetime of the helper, ref it.
|
||||
|
||||
class plNetMsgCreatableHelper : public plCreatable
|
||||
{
|
||||
plCreatable * fCreatable;
|
||||
bool fWeCreatedIt;
|
||||
public:
|
||||
plNetMsgCreatableHelper(plCreatable * object = nil);
|
||||
~plNetMsgCreatableHelper();
|
||||
plNetMsgCreatableHelper & operator =(plCreatable * value);
|
||||
operator plCreatable*();
|
||||
operator const plCreatable*();
|
||||
CLASSNAME_REGISTER( plNetMsgCreatableHelper );
|
||||
GETINTERFACE_ANY(plNetMsgCreatableHelper, plCreatable);
|
||||
void SetObject(plCreatable * object);
|
||||
plCreatable * GetObject();
|
||||
int Poke(hsStream* stream, UInt32 peekOptions=0);
|
||||
int Peek(hsStream* stream, UInt32 peekOptions=0);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Net msg helper class for a stream buffer of some type (saveState, voice, plMessage...)
|
||||
//
|
||||
class plNetMsgStreamHelper : public plCreatable
|
||||
{
|
||||
private:
|
||||
enum ContentsFlags
|
||||
{
|
||||
kUncompressedSize,
|
||||
kStreamBuf,
|
||||
kStreamLen,
|
||||
kCompressionType,
|
||||
};
|
||||
protected:
|
||||
UInt32 fUncompressedSize;
|
||||
Int16 fStreamType; // set to creatable type, not read/written, gleaned from creatable stream
|
||||
UInt8* fStreamBuf;
|
||||
UInt32 fStreamLen;
|
||||
UInt8 fCompressionType; // see plNetMessage::CompressionType
|
||||
UInt32 fCompressionThreshold; // NOT WRITTEN
|
||||
|
||||
void IAllocStream(UInt32 len);
|
||||
|
||||
public:
|
||||
enum { kDefaultCompressionThreshold = 255 }; // bytes
|
||||
|
||||
plNetMsgStreamHelper();
|
||||
virtual ~plNetMsgStreamHelper() { delete [] fStreamBuf; }
|
||||
|
||||
CLASSNAME_REGISTER( plNetMsgStreamHelper );
|
||||
GETINTERFACE_ANY(plNetMsgStreamHelper, plCreatable);
|
||||
|
||||
virtual int Poke(hsStream* stream, UInt32 peekOptions=0);
|
||||
virtual int Peek(hsStream* stream, UInt32 peekOptions=0);
|
||||
|
||||
// creatable ops
|
||||
virtual void Read(hsStream* s, hsResMgr* mgr) { Peek(s); }
|
||||
virtual void Write(hsStream* s, hsResMgr* mgr) { Poke(s); }
|
||||
|
||||
void ReadVersion(hsStream* s, hsResMgr* mgr);
|
||||
void WriteVersion(hsStream* s, hsResMgr* mgr);
|
||||
|
||||
void Clear();
|
||||
|
||||
// copiers
|
||||
void CopyFrom(const plNetMsgStreamHelper* other);
|
||||
void CopyStream(hsStream* ssStream); // copies to fStream
|
||||
void CopyStream(Int32 len, const void* buf); // copies to fStream
|
||||
|
||||
// setters
|
||||
void SetCompressionType(UInt8 t) { fCompressionType=t; }
|
||||
void SetStreamLen(UInt32 l) { fStreamLen=l; }
|
||||
void SetStreamBuf(UInt8* b) { fStreamBuf=b; }
|
||||
void SetUncompressedSize(UInt32 s) { fUncompressedSize=s; }
|
||||
|
||||
// Getters
|
||||
UInt8 GetCompressionType() const { return fCompressionType; }
|
||||
Int16 GetStreamType() const { return fStreamType; }
|
||||
UInt32 GetStreamLen() const { return fStreamLen; }
|
||||
UInt8* GetStreamBuf() const { return fStreamBuf; }
|
||||
UInt32 GetUncompressedSize() const { return fUncompressedSize; }
|
||||
|
||||
bool Compress(int offset=2 /* skip 2 bytes as creatable index */ );
|
||||
bool Uncompress(int offset=2 /* skip 2 bytes as creatable index */ );
|
||||
bool IsCompressed() const;
|
||||
bool IsCompressable() const;
|
||||
UInt32 GetCompressionThreshold() const { return fCompressionThreshold; }
|
||||
void SetCompressionThreshold( UInt32 v ) { fCompressionThreshold=v; }
|
||||
};
|
||||
|
||||
//
|
||||
// Contains info about a scene object
|
||||
//
|
||||
class plNetMsgObjectHelper : public plCreatable
|
||||
{
|
||||
private:
|
||||
enum ContentFlags
|
||||
{
|
||||
kObjHelperUoid,
|
||||
};
|
||||
protected:
|
||||
// string names for debug purposes only
|
||||
plUoid fUoid;
|
||||
// update operator()= fxn when adding new members
|
||||
public:
|
||||
|
||||
plNetMsgObjectHelper() {}
|
||||
plNetMsgObjectHelper(const plKey key) { SetFromKey(key); }
|
||||
virtual ~plNetMsgObjectHelper() { }
|
||||
CLASSNAME_REGISTER( plNetMsgObjectHelper );
|
||||
GETINTERFACE_ANY(plNetMsgObjectHelper, plCreatable);
|
||||
|
||||
virtual int Poke(hsStream* stream, UInt32 peekOptions=0);
|
||||
virtual int Peek(hsStream* stream, UInt32 peekOptions=0);
|
||||
|
||||
plNetMsgObjectHelper & operator =(const plNetMsgObjectHelper & other);
|
||||
|
||||
// setters
|
||||
hsBool SetFromKey(const plKey &key);
|
||||
void SetUoid(const plUoid &u) { fUoid=u; }
|
||||
|
||||
// getters
|
||||
const char* GetObjectName() const { return fUoid.GetObjectName(); }
|
||||
UInt32 GetPageID() const { return fUoid.GetLocation().GetSequenceNumber(); }
|
||||
const plUoid& GetUoid() const { return fUoid; }
|
||||
|
||||
void ReadVersion(hsStream* s, hsResMgr* mgr);
|
||||
void WriteVersion(hsStream* s, hsResMgr* mgr);
|
||||
};
|
||||
|
||||
//
|
||||
// Contains a list of info about scene objects.
|
||||
//
|
||||
class plNetMsgObjectListHelper : public plCreatable
|
||||
{
|
||||
protected:
|
||||
std::vector<plNetMsgObjectHelper*> fObjects;
|
||||
public:
|
||||
plNetMsgObjectListHelper() {}
|
||||
virtual ~plNetMsgObjectListHelper();
|
||||
|
||||
CLASSNAME_REGISTER( plNetMsgObjectListHelper );
|
||||
GETINTERFACE_ANY(plNetMsgObjectListHelper, plCreatable);
|
||||
|
||||
virtual int Poke(hsStream* stream, UInt32 peekOptions=0);
|
||||
virtual int Peek(hsStream* stream, UInt32 peekOptions=0);
|
||||
|
||||
void Reset();
|
||||
int GetNumObjects() const { return fObjects.size(); }
|
||||
plNetMsgObjectHelper* GetObject(int i) { return fObjects[i]; }
|
||||
void AddObject(plKey key) { fObjects.push_back(TRACKED_NEW plNetMsgObjectHelper(key)); }
|
||||
};
|
||||
|
||||
//
|
||||
// Contains a info about a net member.
|
||||
//
|
||||
class plNetMsgMemberInfoHelper : public plCreatable
|
||||
{
|
||||
protected:
|
||||
UInt32 fFlags;
|
||||
plUoid fAvatarUoid;
|
||||
plClientGuid fClientGuid;
|
||||
public:
|
||||
plNetMsgMemberInfoHelper();
|
||||
|
||||
CLASSNAME_REGISTER( plNetMsgMemberInfoHelper );
|
||||
GETINTERFACE_ANY( plNetMsgMemberInfoHelper, plCreatable);
|
||||
|
||||
virtual int Poke(hsStream* stream, UInt32 peekOptions=0);
|
||||
virtual int Peek(hsStream* stream, UInt32 peekOptions=0);
|
||||
|
||||
const plClientGuid * GetClientGuid() const { return &fClientGuid; }
|
||||
plClientGuid * GetClientGuid() { return &fClientGuid; }
|
||||
|
||||
UInt32 GetFlags() const { return fFlags; }
|
||||
plUoid GetAvatarUoid() const { return fAvatarUoid; }
|
||||
|
||||
void SetFlags(UInt32 v) { fFlags=v; }
|
||||
void SetAvatarUoid(plUoid u) { fAvatarUoid=u; }
|
||||
};
|
||||
|
||||
//
|
||||
// Contains a info about a list of net members.
|
||||
// This is sent from server to client.
|
||||
//
|
||||
class plNetMsgMemberListHelper : public plCreatable
|
||||
{
|
||||
public:
|
||||
typedef std::vector<plNetMsgMemberInfoHelper*> MemberInfoHelperVec;
|
||||
struct MatchesPlayerID
|
||||
{
|
||||
UInt32 fID;
|
||||
MatchesPlayerID( UInt32 id ): fID( id ){}
|
||||
bool operator()( const plNetMsgMemberInfoHelper * mbr ) const
|
||||
{
|
||||
return ( mbr && mbr->GetClientGuid()->GetPlayerID()==fID );
|
||||
}
|
||||
};
|
||||
|
||||
protected:
|
||||
MemberInfoHelperVec fMembers;
|
||||
|
||||
public:
|
||||
plNetMsgMemberListHelper() {}
|
||||
virtual ~plNetMsgMemberListHelper();
|
||||
|
||||
CLASSNAME_REGISTER( plNetMsgMemberListHelper );
|
||||
GETINTERFACE_ANY( plNetMsgMemberListHelper, plCreatable);
|
||||
|
||||
virtual int Poke(hsStream* stream, UInt32 peekOptions=0);
|
||||
virtual int Peek(hsStream* stream, UInt32 peekOptions=0);
|
||||
|
||||
int GetNumMembers() const { return fMembers.size(); }
|
||||
const plNetMsgMemberInfoHelper* GetMember(int i) const { return fMembers[i]; }
|
||||
void AddMember(plNetMsgMemberInfoHelper* a) { fMembers.push_back(a); }
|
||||
const MemberInfoHelperVec * GetMembers() const { return &fMembers;}
|
||||
};
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
||||
//
|
||||
// Contains a list of other players (members).
|
||||
// This is commonly used to route p2p msgs to groups of players.
|
||||
// Sent client to server.
|
||||
//
|
||||
class plNetMsgReceiversListHelper : public plCreatable
|
||||
{
|
||||
protected:
|
||||
std::vector<UInt32> fPlayerIDList;
|
||||
public:
|
||||
plNetMsgReceiversListHelper() {}
|
||||
virtual ~plNetMsgReceiversListHelper() {}
|
||||
|
||||
CLASSNAME_REGISTER( plNetMsgReceiversListHelper );
|
||||
GETINTERFACE_ANY( plNetMsgReceiversListHelper, plCreatable);
|
||||
|
||||
virtual int Poke(hsStream* stream, UInt32 peekOptions=0);
|
||||
virtual int Peek(hsStream* stream, UInt32 peekOptions=0);
|
||||
|
||||
void Clear() { fPlayerIDList.clear(); }
|
||||
int GetNumReceivers() const { return fPlayerIDList.size(); }
|
||||
UInt32 GetReceiverPlayerID(int i) const { return fPlayerIDList[i]; }
|
||||
void AddReceiverPlayerID(UInt32 a) { fPlayerIDList.push_back(a); }
|
||||
bool RemoveReceiverPlayerID(UInt32 n); // returns true if found and removed
|
||||
};
|
||||
|
||||
|
||||
#endif // PL_NET_MSG__HELPERS_inc
|
||||
|
@ -0,0 +1,145 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
||||
#ifndef plNetMsgVersion_h_inc
|
||||
#define plNetMsgVersion_h_inc
|
||||
|
||||
|
||||
// Changing the version number(s)? Make an entry in the corresponding log below.
|
||||
#define PLASMA2_NETMSG_MAJOR_VERSION 12
|
||||
#define PLASMA2_NETMSG_MINOR_VERSION 6
|
||||
/*--- Major Version Log ---
|
||||
# Date Who Comment
|
||||
2 10/05/01 eap Moved handling of VaultRequestData message from game server to lobby server
|
||||
3 10/09/01 ee Made Uoid changes that impact the net messages
|
||||
4 10/11/01 ee Made Uoid changes that impact the net messages
|
||||
5 02/12/02 eap Modified auth messages.
|
||||
6 4/18/02 MT Changed to using SDL saveStates
|
||||
7 04/18/02 eap Redesigned KI messaging
|
||||
8 05/17/02 Colin Changed format of Uoid
|
||||
9 07/01/02 rje Changed Authentication Scheme
|
||||
10 10/16/02 eap Removed low-level KI. Replaced with plVault.
|
||||
11 07/03/03 MT Optimized plNetMessage headers for size
|
||||
12 09/17/03 eap Removed UInt32 acctID. Added Uuid acctUUID. Changed PlayerUpdate enum values.
|
||||
*/
|
||||
|
||||
|
||||
/*--- Minor Version Log ---
|
||||
# Date Who Comment
|
||||
5 9/28/01 MT Added senderClientNum to GameMessages (mostly for debugging)
|
||||
0 10/05/01 eap Reset on Major Version change
|
||||
1 10/26/01 eap Upon sending join ack, the game server now sends a set of initial local unique ids to client.
|
||||
2 10/31/01 eap Added (Un)RegisterServer msgs (actually renamed from ServerStarted family msgs). Changed StartProcess msg a little.
|
||||
3 11/05/01 eap Changes to request/receive avatar msgs.
|
||||
4 11/21/01 MT Removed obsolete plNetMessage flags due to client task reorg
|
||||
5 02/02/02 eap Added/Updated KI message classes.
|
||||
0 02/12/02 eap Reset on major version change
|
||||
1 03/22/02 eap Removed acctID from plNetMsgCreatePlayer.
|
||||
2 3/31/02 MT moved uncompressed size from voiceMsg to streamHelper
|
||||
0 04/18/02 MT Reset on major version change.
|
||||
0 04/18/02 eap Reset on major version change
|
||||
1 4/29/02 MT added joinOrder to joinAck
|
||||
2 05/02/02 eap Changed plNetServerSessionInfo stream format.
|
||||
3 05/08/02 eap Changed KI stream formats.
|
||||
0 05/17/02 Colin Reset on major version change
|
||||
1 06/03/02 eap Changed KIOperations enum values. Affects KI messages.
|
||||
2 06/06/02 eap More changes to KI message format.
|
||||
3 6/07/02 MT Enabled compression on SDL msgs
|
||||
4 6/19/02 MT Removed general timeOffset in favor of UnifiedTime in game msg
|
||||
4 06/12/02 eap Yet more changes to KI messaging stuff
|
||||
1 7/01/02 MT Added a member to SDLBCast msgs
|
||||
2 07/16/02 eap Added linking rule info to net msgs related to age linking.
|
||||
3 08/15/02 eap Changed plNetMsgKI format.
|
||||
4 8/15/02 MT Changes related to cloning reorg
|
||||
5 08/21/02 eap Changed plNetMsgKI format.
|
||||
6 9/17/02 MT Added fIsPlayer to plNetMsgLoadClone
|
||||
7 9/24/02 rje Added Packet Size in Client Hello
|
||||
8 10/01/02 eap Changed the way the KI is fetched.
|
||||
9 10/02/02 eap Changed KI storable stream format (made flag-based instead of stream version-based)
|
||||
10 10/03/02 eap Changed KI manifest stream format.
|
||||
11 10/04/02 thamer Changed timeSent to be unified time not double, short-circuit version checking
|
||||
0 10/16/02 eap Reset on major version change.
|
||||
1 10/15/02 thamer minor changes for CCR
|
||||
2 11/04/02 eap Changed plNetMsgVault format.
|
||||
3 12/04/02 eap Moved compression into plNetMsgStreamHelper. Changed plNetMsgVault format.
|
||||
4 12/04/02 eap Changed plNetMsgStreamHelper fUncompressedSize type to UInt32.
|
||||
5 12/05/02 eap Added PlayerName and AvatarShape to CreatePlayer msg.
|
||||
6 12/11/02 thamer Moved PlayerID into the base class
|
||||
7 12/18/02 thamer Changed SDL format
|
||||
8 12/17/02 eap Changed format of vault negotiate manifest msg.
|
||||
9 01/14/03 eap Added CCRLevel to plClientGuid and plNetMsgSetMyActivePlayer. Removed from plNetMsgJoinReq
|
||||
10 01/30/03 eap Changed linking rules and associated net msgs.
|
||||
11 02/04/03 eap Changed vault msg format.
|
||||
12 02/05/03 thamer Added initial age state to joinAck
|
||||
13 02/10/03 eap Changed format of vault FetchNodes msg to support bundling of multiple nodes into one msg.
|
||||
14 02/12/03 eap Changed the way ages are (un)registered. client used to do it. now vault server does it.
|
||||
15 02/24/03 eap Added a byte to plNetMsgLeave to specify the reason for leaving.
|
||||
16 02/25/03 thamer Changed the auth response generation
|
||||
17 02/26/03 thamer again
|
||||
18 02/28/03 eap Support for multiple spawn points for vault age link nodes.
|
||||
19 03/14/03 eap Changed plVaultNode format.
|
||||
20 03/14/03 thamer Added buildType and 'experimental' values to authHello and JoinAck msgs
|
||||
21 03/17/03 thamer Added streamSubType var to StreamHelper
|
||||
22 03/21/03 eap Changed auth error enum values to be negative.
|
||||
23 03/24/03 rje Added Invites to CreatePlayer.
|
||||
24 04/11/03 eap Changed create player error enum values to be negative.
|
||||
25 04/14/03 thamer Changed SharedState R/W format
|
||||
26 05/13/03 eap Changed plNetMsgVault a little bit to allow multiple age vaults to live in one process.
|
||||
27 05/16/03 thamer Bob changed the LoadClone msg format
|
||||
28 05/30/03 thamer Optimized the Uoid read/write format
|
||||
29 06/01/03 eap Changed stream format of plGenericType class
|
||||
30 06/01/03 eap Changed stream format of plGenericType class
|
||||
31 06/02/03 thamer Changed plNetMsgLoadClone format
|
||||
32 06/06/03 eap Reimplemented inter-age messaging. Removed vaultserver from the process.
|
||||
33 06/10/03 eap Changed plVaultNode stream format
|
||||
34 06/24/03 eap Client is now in charge of creating personal age when needed.
|
||||
35 06/27/03 eap Added reply msg to SetActivePlayer
|
||||
36 06/25/03 thamer SDL size optimizations
|
||||
37 07/01/03 eap Vault db version bumped.
|
||||
0 07/03/03 thamer Reset on major version change.
|
||||
1 07/11/03 eap Added fCreateFlags to CreatePlayer msg.
|
||||
2 07/16/03 thamer Added flags to vault player list desc
|
||||
3 07/22/03 eap Changed plNetMsgVault and plNetMsgVaultTask format.
|
||||
4 07/23/03 eap Changed plNetMsgDeletePlayer format.
|
||||
5 07/28/03 thamer Changed StreamHelper format.
|
||||
6 08/01/03 eap Changed the format of some vault operations (RegisterOwnedAge et.al.)
|
||||
7 08/01/03 eap Added disconnect reply msg to vault protocol.
|
||||
8 08/06/03 eap Added some buffer room to the last enum value in plNetMsgTerminated/Leave/ServerMsgUpdatePlayer
|
||||
9 08/07/03 eap Fixed enum values in plNetMsgTerminated/Leave/ServerMsgUpdatePlayer
|
||||
10 08/22/03 eap Game server no longer queries auth server when authenticating a client.
|
||||
11 09/04/03 eap Added camera stack to plSpawnPointInfo.
|
||||
12 09/08/03 eap Added server guid to plNetMsgAuthenticated
|
||||
13 09/17/03 bob Changed format of Read/WriteSafeString, (and the "long" versions)
|
||||
0 09/17/03 eap Reset on major version change.
|
||||
1 10/22/03 eap Changed format of VaultFetchNodes message
|
||||
2 10/23/03 eap Changed format of VaultFetchNodes message again
|
||||
3 10/25/03 bob Changed the format of plLinkEffectsTriggerMsg, which the NetMsgScreener reads.
|
||||
4 11/18/03 eap Changed c/s initial SDL state send transaction.
|
||||
5 10/29/03 jeffrey Changed the plDynamicTextMsg to use unicode
|
||||
6 12/01/03 eap Changed plNetMessage flags (kNoGameTimeSent became kTimeSent)
|
||||
*/
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user