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.

197 lines
7.1 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==*/
//////////////////////////////////////////////////////////////////////////////
//
// plUoid - A Unique Object IDentifier -- basically, each unique Uoid refers
// to one and exactly one object.
// To define such, it contains three elements:
// - A plLocation, which specifies an (age,chapter,page) combo
// (as a sequence number)
// - A creatable class type (from plFactory)
// - An object name
//
//////////////////////////////////////////////////////////////////////////////
#ifndef plUoid_h_inc
#define plUoid_h_inc
#include "HeadSpin.h"
#include "plFixedKey.h"
#include "plLoadMask.h"
#include "plString.h"
class hsStream;
//// plLocation //////////////////////////////////////////////////////////////
class plLocation
{
public:
enum LocFlags
{
kLocalOnly = 0x1, // Set if nothing in the room saves state.
kVolatile = 0x2, // Set is nothing in the room persists when the server exits.
kReserved = 0x4,
kBuiltIn = 0x8,
kItinerant = 0x10,
};
protected:
uint32_t fSequenceNumber;
uint16_t fFlags;
enum
{
kGlobalFixedLocIdx = 0, // Fixed keys go here, think of as "global,fixed,keys"
kSceneViewerLocIdx = 1,
kLocalLocStartIdx = 3, // These are a range of #s that go to local, testing-only pages.
kLocalLocEndIdx = 32, // You can't go over the network with any keys with these locs.
kNormalLocStartIdx = kLocalLocEndIdx + 1,
kReservedLocStart = 0xff000000, // Reserved locations are ones that aren't real game locations,
kGlobalServerLocIdx = kReservedLocStart, // Global pool room for the server. Only the server gets this one
kReservedLocAvailableStart = kGlobalServerLocIdx + 1, // This is the start of the *really* available ones
kReservedLocEnd = 0xfffffffe, // But instead act as a holding place for data
kInvalidLocIdx = 0xffffffff
};
plLocation(uint32_t seqNum, uint16_t flags=0) : fFlags(flags) { Set(seqNum); }
public:
plLocation() { Invalidate(); }
plLocation(const plLocation& toCopyFrom);
~plLocation() {}
void Invalidate();
hsBool IsValid() const;
hsBool IsReserved() const;
hsBool IsItinerant() const;
void Set(uint32_t seqNum);
uint32_t GetSequenceNumber() const { return fSequenceNumber; }
hsBool IsVirtual() const;
void SetFlags(uint16_t flags) { fFlags |= flags; }
uint16_t GetFlags() const { return fFlags; }
void Read(hsStream* s);
void Write(hsStream* s) const;
hsBool operator==(const plLocation& loc) const;
hsBool operator!=(const plLocation& loc) const { return !(loc == *this); }
plLocation& operator=(const plLocation& loc);
bool operator<(const plLocation& loc ) const { return fSequenceNumber < loc.fSequenceNumber; }
// THIS SHOULD BE FOR DEBUGGING ONLY <hint hint>
plString StringIze() const; // Format to displayable string.
static plLocation MakeReserved(uint32_t number);
static plLocation MakeNormal(uint32_t number);
static const plLocation kGlobalFixedLoc;
static const plLocation kSceneViewerLoc;
static const plLocation kLocalStartLoc;
static const plLocation kLocalEndLoc;
static const plLocation kNormalStartLoc;
static const plLocation kGlobalServerLoc;
static const plLocation kInvalidLoc;
};
//// plUoid //////////////////////////////////////////////////////////////////
class plUoid
{
public:
plUoid() { Invalidate(); }
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
plUoid(const plLocation& location, uint16_t classType, const plString& objectName, const plLoadMask& m=plLoadMask::kAlways);
plUoid(plFixedKeyId fixedKey);
plUoid(const plUoid& src);
~plUoid();
const plLocation& GetLocation() const { return fLocation; }
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
uint16_t GetClassType() const { return fClassType; }
const plString& GetObjectName() const { return fObjectName; }
const plLoadMask& GetLoadMask() const { return fLoadMask; }
void Read(hsStream* s);
void Write(hsStream* s) const;
void Invalidate();
hsBool IsValid() const;
plUoid& operator=(const plUoid& u);
hsBool operator==(const plUoid& u) const;
hsBool operator!=(const plUoid& u) const { return !operator==(u); }
hsBool IsClone() const { return fCloneID != 0; }
uint32_t GetClonePlayerID() const { return fClonePlayerID; }
uint32_t GetCloneID() const { return fCloneID; }
void SetClone(uint32_t playerID, uint32_t cloneID) { hsAssert(cloneID < 0xffff, "Clone id too high"); fCloneID = uint16_t(cloneID); fClonePlayerID = playerID; }
uint32_t GetObjectID() const { return fObjectID; }
// Export time only. Only plRegistryKeyList should call this.
void SetObjectID(uint32_t id) { fObjectID = id; }
// THIS SHOULD BE FOR DEBUGGING ONLY <hint hint>
plString StringIze() const; // Format to displayable string
protected:
enum ContentsFlags // for read/write functions
{
kHasCloneIDs = 0x1,
kHasLoadMask = 0x2,
};
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 fObjectID;
uint32_t fClonePlayerID; // The ID of the player who made this clone
uint16_t fCloneID; // The ID of this clone (unique per client)
uint16_t fClassType;
plString fObjectName;
plLocation fLocation;
plLoadMask fLoadMask;
};
#endif // plUoid_h_inc