You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
4.6 KiB

/*==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/>.
Additional permissions under GNU GPL version 3 section 7
If you modify this Program, or any covered work, by linking or
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
(or a modified version of those libraries),
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
licensors of this Program grant you additional
permission to convey the resulting work. Corresponding Source for a
non-source form of such a combination shall include the source code for
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
work.
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 plNetTransportMember_h
#define plNetTransportMember_h
#include "HeadSpin.h"
#include "hsStlUtils.h"
#include "plNetCommon/plNetMember.h"
#include "pnKeyedObject/plKey.h"
#include "plString.h"
//
// This represents a participant in the game, ie. another
// remote user.
// It is a basic net member with a list of channels that it subscribes to.
//
class plKey;
class plNetTransportMember : public plNetMember
{
public:
enum TransportFlags
{
kSendingVoice = 1<<0,
kSendingActions = 1<<1,
};
protected:
plKey fAvatarKey;
plString fPlayerName;
Merge remote-tracking branch 'origin/master' into plString Conflicts: Sources/Plasma/CoreLib/hsStream.h Sources/Plasma/FeatureLib/pfAudio/plListener.cpp Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp Sources/Plasma/FeatureLib/pfPython/cyMisc.h Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.h Sources/Plasma/FeatureLib/pfPython/pyImage.cpp Sources/Plasma/FeatureLib/pfPython/pyJournalBook.cpp Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfo.h Sources/Plasma/NucleusLib/pnKeyedObject/plFixedKey.cpp Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.cpp Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.h Sources/Plasma/NucleusLib/pnMessage/plMessage.h Sources/Plasma/NucleusLib/pnNetCommon/plNetApp.h Sources/Plasma/PubUtilLib/plAvatar/plCoopCoordinator.cpp Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.cpp Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h Sources/Plasma/PubUtilLib/plNetCommon/plClientGuid.h Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgHelpers.h Sources/Plasma/PubUtilLib/plNetTransport/plNetTransportMember.h Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.h Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.cpp Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.h Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.cpp Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.h Sources/Plasma/PubUtilLib/plSurface/plGrassShaderMod.cpp
13 years ago
uint32_t fPlayerID;
std::vector<int> fSubscriptions; // list of channelGrp subscriptions
Merge remote-tracking branch 'origin/master' into plString Conflicts: Sources/Plasma/CoreLib/hsStream.h Sources/Plasma/FeatureLib/pfAudio/plListener.cpp Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp Sources/Plasma/FeatureLib/pfPython/cyMisc.h Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.h Sources/Plasma/FeatureLib/pfPython/pyImage.cpp Sources/Plasma/FeatureLib/pfPython/pyJournalBook.cpp Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfo.h Sources/Plasma/NucleusLib/pnKeyedObject/plFixedKey.cpp Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.cpp Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.h Sources/Plasma/NucleusLib/pnMessage/plMessage.h Sources/Plasma/NucleusLib/pnNetCommon/plNetApp.h Sources/Plasma/PubUtilLib/plAvatar/plCoopCoordinator.cpp Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.cpp Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h Sources/Plasma/PubUtilLib/plNetCommon/plClientGuid.h Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgHelpers.h Sources/Plasma/PubUtilLib/plNetTransport/plNetTransportMember.h Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.h Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.cpp Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.h Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.cpp Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.h Sources/Plasma/PubUtilLib/plSurface/plGrassShaderMod.cpp
13 years ago
uint32_t fTransportFlags;
float fDistSq; // from local player, temp
Merge remote-tracking branch 'origin/master' into plString Conflicts: Sources/Plasma/CoreLib/hsStream.h Sources/Plasma/FeatureLib/pfAudio/plListener.cpp Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp Sources/Plasma/FeatureLib/pfJournalBook/pfJournalBook.cpp Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp Sources/Plasma/FeatureLib/pfPython/cyMisc.h Sources/Plasma/FeatureLib/pfPython/cyMiscGlue4.cpp Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.h Sources/Plasma/FeatureLib/pfPython/pyImage.cpp Sources/Plasma/FeatureLib/pfPython/pyJournalBook.cpp Sources/Plasma/FeatureLib/pfPython/pyNetServerSessionInfo.h Sources/Plasma/NucleusLib/pnKeyedObject/plFixedKey.cpp Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.cpp Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.h Sources/Plasma/NucleusLib/pnMessage/plMessage.h Sources/Plasma/NucleusLib/pnNetCommon/plNetApp.h Sources/Plasma/PubUtilLib/plAvatar/plCoopCoordinator.cpp Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp Sources/Plasma/PubUtilLib/plDrawable/plDynaDecalMgr.cpp Sources/Plasma/PubUtilLib/plDrawable/plWaveSet7.cpp Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h Sources/Plasma/PubUtilLib/plNetCommon/plClientGuid.h Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.cpp Sources/Plasma/PubUtilLib/plNetMessage/plNetMsgHelpers.h Sources/Plasma/PubUtilLib/plNetTransport/plNetTransportMember.h Sources/Plasma/PubUtilLib/plPhysX/plSimulationMgr.cpp Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp Sources/Plasma/PubUtilLib/plPipeline/plPlates.cpp Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.cpp Sources/Plasma/PubUtilLib/plResMgr/plKeyFinder.h Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.cpp Sources/Plasma/PubUtilLib/plResMgr/plRegistryNode.h Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.cpp Sources/Plasma/PubUtilLib/plScene/plRelevanceMgr.h Sources/Plasma/PubUtilLib/plSurface/plGrassShaderMod.cpp
13 years ago
uint8_t fCCRLevel;
public:
CLASSNAME_REGISTER( plNetTransportMember);
GETINTERFACE_ANY( plNetTransportMember, plNetMember);
plNetTransportMember() : fAvatarKey(nil),
fTransportFlags(0),fPlayerID(0),fDistSq(-1),fCCRLevel(0) {}
plNetTransportMember(plNetApp* na) : plNetMember(na),
fAvatarKey(nil),fTransportFlags(0),fPlayerID(0),fDistSq(-1),fCCRLevel(0) {}
~plNetTransportMember() {}
void SetDistSq(float s) { fDistSq=s; }
float GetDistSq() const { return fDistSq; }
plKey GetAvatarKey() { return fAvatarKey; }
void SetAvatarKey(plKey k)
{
fAvatarKey=k;
}
void SetPlayerName(const plString & value) { fPlayerName=value;}
plString GetPlayerName() const { return fPlayerName;}
void SetPlayerID(uint32_t value) { fPlayerID=value;}
uint32_t GetPlayerID() const { return fPlayerID;}
void SetIsServer(bool value) { (value)?SetFlags(GetFlags()|kIsServer):SetFlags(GetFlags()&!kIsServer);}
bool IsServer() const { return (GetFlags()&kIsServer)?true:false;}
13 years ago
bool AddSubscription(int chan);
bool RemoveSubscription(int chan); // return true on success
int FindSubscription(int chan); // return index into subscription array or -1
int GetNumSubscriptions() { return fSubscriptions.size(); }
int GetSubscription(int i) { return fSubscriptions[i]; }
void CopySubscriptions(std::vector<int>* channels) { *channels = fSubscriptions; }
void SetTransportFlags(uint32_t f) { fTransportFlags=f; }
uint32_t GetTransportFlags() const { return fTransportFlags; }
bool IsPeerToPeer() const { return hsCheckBits(fFlags, kRequestP2P); }
plString AsString() const;
bool IsEqualTo(const plNetMember * other) const
{
const plNetTransportMember * o = plNetTransportMember::ConvertNoRef(other);
if (!o) return false;
return o->fPlayerID==fPlayerID;
}
bool IsCCR() const { return (fCCRLevel>0); }
uint8_t GetCCRLevel() const { return fCCRLevel; }
void SetCCRLevel(uint8_t cl) { fCCRLevel=cl; }
};
#endif // plNetTransportMember_h