1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-19 03:39:08 +00:00

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
This commit is contained in:
2012-01-28 17:20:01 -08:00
1722 changed files with 24149 additions and 27599 deletions

View File

@ -47,7 +47,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
//
#include "plSDLDescriptor.h"
#include "hsUtils.h"
#include "hsStlUtils.h"
#include "pnFactory/plCreatable.h"
@ -112,8 +112,8 @@ public:
void SetHintString(const char* c) { fHintString=c; }
const char* GetHintString() const { return fHintString.c_str(); }
void Read(hsStream* s, UInt32 readOptions);
void Write(hsStream* s, UInt32 writeOptions) const;
void Read(hsStream* s, uint32_t readOptions);
void Write(hsStream* s, uint32_t writeOptions) const;
};
//
@ -131,7 +131,7 @@ public:
kUsed = 0x2 // true when it contains some value (either by Set(...) or Read() )
};
protected:
UInt32 fFlags;
uint32_t fFlags;
plStateVarNotificationInfo fNotificationInfo;
public:
plStateVariable() : fFlags(0) {}
@ -164,8 +164,8 @@ public:
virtual void DumpToStream(hsStream* stream, bool dirtyOnly, int level) const {}
// IO
virtual bool ReadData(hsStream* s, float timeConvert, UInt32 readOptions);
virtual bool WriteData(hsStream* s, float timeConvert, UInt32 writeOptions) const;
virtual bool ReadData(hsStream* s, float timeConvert, uint32_t readOptions);
virtual bool WriteData(hsStream* s, float timeConvert, uint32_t writeOptions) const;
};
//
@ -180,7 +180,7 @@ private:
float fDelta;
typedef std::vector<plKey> KeyList;
KeyList fKeys; // the objects to notify on change>delta
static UInt32 fCurrentPlayerID;
static uint32_t fCurrentPlayerID;
void IAddKey(plKey k);
int IRemoveKey(plKey k);
@ -198,8 +198,8 @@ public:
bool GetValue(float* i) const;
bool SetValue(float i);
static UInt32 GetCurrentPlayerID() { return fCurrentPlayerID; }
static void SetCurrentPlayerID(UInt32 p) { fCurrentPlayerID=p; }
static uint32_t GetCurrentPlayerID() { return fCurrentPlayerID; }
static void SetCurrentPlayerID(uint32_t p) { fCurrentPlayerID=p; }
bool operator==(const plStateChangeNotifier &) const;
};
@ -210,7 +210,6 @@ public:
class plUoid;
class plKey;
class plClientUnifiedTime;
typedef unsigned char byte;
class plSimpleStateVariable : public plStateVariable
{
protected:
@ -218,7 +217,7 @@ protected:
{
int* fI; // array of int
short* fS; // array of short
byte* fBy; // array of byte
uint8_t* fBy; // array of byte
float* fF; // array of float
double* fD; // array of double
bool* fB; // array of bool
@ -250,8 +249,8 @@ protected:
bool IConvertFromRGB8(plVarDescriptor::Type newType);
bool IConvertFromRGBA8(plVarDescriptor::Type newType);
bool IReadData(hsStream* s, float timeConvert, int idx, UInt32 readOptions);
bool IWriteData(hsStream* s, float timeConvert, int idx, UInt32 writeOptions) const;
bool IReadData(hsStream* s, float timeConvert, int idx, uint32_t readOptions);
bool IWriteData(hsStream* s, float timeConvert, int idx, uint32_t writeOptions) const;
public:
@ -266,7 +265,7 @@ public:
void TimeStamp( const plUnifiedTime & ut=plUnifiedTime::GetCurrentTime() );
void CopyFrom(plVarDescriptor* v);
void CopyData(const plSimpleStateVariable* other, UInt32 writeOptions=0);
void CopyData(const plSimpleStateVariable* other, uint32_t writeOptions=0);
bool SetFromString(const char* value, int idx, bool timeStampNow); // set value from string, type. return false on err
char* GetAsString(int idx) const;
bool ConvertTo(plSimpleVarDescriptor* toVar, bool force=false); // return false on err
@ -280,8 +279,8 @@ public:
bool Set(double* v, int idx=0); // doubleVector
bool Set(int v, int idx=0);
bool Set(int* v, int idx=0) { return Set(*v, idx); } // helper since there is no int vec type
bool Set(byte v, int idx=0);
bool Set(byte* v, int idx=0); // byteVector
bool Set(uint8_t v, int idx=0);
bool Set(uint8_t* v, int idx=0); // uint8_tVector
bool Set(short v, int idx=0);
bool Set(short* v, int idx=0) { return Set(*v, idx); } // helper since there is no short vec type
bool Set(bool v, int idx=0);
@ -294,7 +293,7 @@ public:
// getters
bool Get(int* value, int idx=0) const;
bool Get(short* value, int idx=0) const;
bool Get(byte* value, int idx=0) const; // returns byte or byteVector
bool Get(uint8_t* value, int idx=0) const; // returns uint8_t or uint8_tVector
bool Get(float* value, int idx=0) const; // returns float or floatVector
bool Get(double* value, int idx=0) const; // returns double or doubleVector
bool Get(bool* value, int idx=0) const;
@ -322,8 +321,8 @@ public:
void DumpToStream(hsStream* stream, bool dirtyOnly, int level) const;
// IO
bool ReadData(hsStream* s, float timeConvert, UInt32 readOptions);
bool WriteData(hsStream* s, float timeConvert, UInt32 writeOptions) const;
bool ReadData(hsStream* s, float timeConvert, uint32_t readOptions);
bool WriteData(hsStream* s, float timeConvert, uint32_t writeOptions) const;
};
//
@ -351,8 +350,8 @@ public:
bool operator==(const plSDStateVariable &other) const; // assumes matching var descriptors
void ConvertTo(plSDStateVariable* otherSDVar, bool force=false);
void CopyFrom(plSDStateVariable* other, UInt32 writeOptions=0);
void UpdateFrom(plSDStateVariable* other, UInt32 writeOptions=0);
void CopyFrom(plSDStateVariable* other, uint32_t writeOptions=0);
void UpdateFrom(plSDStateVariable* other, uint32_t writeOptions=0);
void AddStateDataRecord(plStateDataRecord *sdr) { fDataRecList.push_back(sdr); SetDirty(true); SetUsed(true); }
void InsertStateDataRecord(plStateDataRecord *sdr, int i) { fDataRecList[i] = sdr; SetDirty(true); SetUsed(true);}
void SetFromDefaults(bool timeStampNow);
@ -384,8 +383,8 @@ public:
void DumpToStream(hsStream* stream, bool dirtyOnly, int level) const;
// IO
bool ReadData(hsStream* s, float timeConvert, UInt32 readOptions);
bool WriteData(hsStream* s, float timeConvert, UInt32 writeOptions) const;
bool ReadData(hsStream* s, float timeConvert, uint32_t readOptions);
bool WriteData(hsStream* s, float timeConvert, uint32_t writeOptions) const;
};
//
@ -408,8 +407,8 @@ protected:
plUoid fAssocObject; // optional
VarsList fVarsList; // list of variables
VarsList fSDVarsList; // list of nested data records
UInt32 fFlags;
static const UInt8 kIOVersion; // I/O Version
uint32_t fFlags;
static const uint8_t kIOVersion; // I/O Version
void IDeleteVarsList(VarsList& vars);
void IInitDescriptor(const char* name, int version); // or plSDL::kLatestVersion
@ -433,22 +432,22 @@ public:
plStateDataRecord(const char* sdName, int version=plSDL::kLatestVersion);
plStateDataRecord(plStateDescriptor* sd);
plStateDataRecord(const plStateDataRecord &other, UInt32 writeOptions=0 ):fFlags(0) { CopyFrom(other, writeOptions); }
plStateDataRecord(const plStateDataRecord &other, uint32_t writeOptions=0 ):fFlags(0) { CopyFrom(other, writeOptions); }
plStateDataRecord():fFlags(0) {}
~plStateDataRecord();
bool ConvertTo(plStateDescriptor* other, bool force=false );
bool operator==(const plStateDataRecord &other) const; // assumes matching state descriptors
UInt32 GetFlags() const { return fFlags; }
void SetFlags(UInt32 f) { fFlags =f; }
uint32_t GetFlags() const { return fFlags; }
void SetFlags(uint32_t f) { fFlags =f; }
plSimpleStateVariable* FindVar(const char* name) const { return (plSimpleStateVariable*)IFindVar(fVarsList, name); }
plSDStateVariable* FindSDVar(const char* name) const { return (plSDStateVariable*)IFindVar(fSDVarsList, name); }
plStateDataRecord& operator=(const plStateDataRecord& other) { CopyFrom(other); return *this; }
void CopyFrom(const plStateDataRecord& other, UInt32 writeOptions=0);
void UpdateFrom(const plStateDataRecord& other, UInt32 writeOptions=0);
void CopyFrom(const plStateDataRecord& other, uint32_t writeOptions=0);
void UpdateFrom(const plStateDataRecord& other, uint32_t writeOptions=0);
void SetFromDefaults(bool timeStampNow);
void TimeStampDirtyVars();
@ -482,7 +481,7 @@ public:
const plStateDescriptor* GetDescriptor() const { return fDescriptor; }
void SetDescriptor(const char* sdName, int version);
plNetMsgSDLState* PrepNetMsg(float timeConvert, UInt32 writeOptions) const; // create/prep a net msg with this data
plNetMsgSDLState* PrepNetMsg(float timeConvert, uint32_t writeOptions) const; // create/prep a net msg with this data
void SetAssocObject(const plUoid& u) { fAssocObject=u; } // optional
plUoid* GetAssocObject() { return &fAssocObject; } // optional
@ -496,8 +495,8 @@ public:
void DumpToStream(hsStream* stream, const char* msg, bool dirtyOnly=false, int level=0) const;
// IO
bool Read(hsStream* s, float timeConvert, UInt32 readOptions=0);
void Write(hsStream* s, float timeConvert, UInt32 writeOptions=0) const;
bool Read(hsStream* s, float timeConvert, uint32_t readOptions=0);
void Write(hsStream* s, float timeConvert, uint32_t writeOptions=0) const;
static bool ReadStreamHeader(hsStream* s, char** name, int* version, plUoid* objUoid=nil);
void WriteStreamHeader(hsStream* s, plUoid* objUoid=nil) const;
@ -536,7 +535,7 @@ private:
std::string fSDLDir;
plSDL::DescriptorList fDescriptors;
plNetApp* fNetApp;
UInt32 fBehaviorFlags;
uint32_t fBehaviorFlags;
void IDeleteDescriptors(plSDL::DescriptorList* dl);
public:
@ -554,10 +553,10 @@ public:
void SetNetApp(plNetApp* a) { fNetApp=a; }
plNetApp* GetNetApp() const { return fNetApp; }
bool Init( UInt32 behaviorFlags=0 ); // parse sdl folder
bool Init( uint32_t behaviorFlags=0 ); // parse sdl folder
void DeInit();
UInt32 GetBehaviorFlags() const { return fBehaviorFlags; }
void SetBehaviorFlags(UInt32 v) { fBehaviorFlags=v; }
uint32_t GetBehaviorFlags() const { return fBehaviorFlags; }
void SetBehaviorFlags(uint32_t v) { fBehaviorFlags=v; }
bool AllowTimeStamping() const { return ! ( fBehaviorFlags&plSDL::kDisallowTimeStamping ); }
// I/O - return # of bytes read/written

View File

@ -47,8 +47,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
// These define a schema representing an object's saveState buffer.
//
#include "hsTypes.h"
#include "hsUtils.h"
#include "HeadSpin.h"
#include "hsStlUtils.h"
//
@ -98,13 +98,13 @@ public:
kVariableLength = 0x4 // Var is defined as int foo[], so it's length is variable, starting at 0
};
protected:
static const UInt8 kVersion; // for Read/Write format
static const uint8_t kVersion; // for Read/Write format
char* fDefault; // set by .sdl
char* fName; // set by .sdl
int fCount; // set by .sdl
Type fType; // set by .sdl
char* fTypeString; // string version of fType
UInt32 fFlags;
uint32_t fFlags;
std::string fDisplayOptions; // set by .sdl
public:
plVarDescriptor();
@ -221,7 +221,7 @@ class plKey;
class plStateDescriptor
{
private:
static const UInt8 kVersion; // for Read/Write format
static const uint8_t kVersion; // for Read/Write format
typedef std::vector<plVarDescriptor*> VarsList;
VarsList fVarsList;
int fVersion;

View File

@ -66,7 +66,7 @@ plSDLMgr::~plSDLMgr()
DeInit();
}
bool plSDLMgr::Init( UInt32 behaviorFlags )
bool plSDLMgr::Init( uint32_t behaviorFlags )
{
fBehaviorFlags = behaviorFlags;
plSDLParser parser;
@ -145,7 +145,7 @@ int plSDLMgr::Write(hsStream* s, const plSDL::DescriptorList* dl)
if (dl==nil)
dl=&fDescriptors;
UInt16 num=dl->size();
uint16_t num=dl->size();
s->WriteLE(num);
plSDL::DescriptorList::const_iterator it;
@ -174,7 +174,7 @@ int plSDLMgr::Read(hsStream* s, plSDL::DescriptorList* dl)
// clear dl
IDeleteDescriptors(dl);
UInt16 num;
uint16_t num;
try
{
// read dtor list
@ -183,7 +183,7 @@ int plSDLMgr::Read(hsStream* s, plSDL::DescriptorList* dl)
int i;
for(i=0;i<num;i++)
{
plStateDescriptor* sd=TRACKED_NEW plStateDescriptor;
plStateDescriptor* sd=new plStateDescriptor;
if (sd->Read(s))
dl->push_back(sd);
}

View File

@ -39,7 +39,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
Mead, WA 99021
*==LICENSE==*/
#include "hsTypes.h"
#include "HeadSpin.h"
#include "hsStlUtils.h"
#include "plSDL.h"
#include "plFile/hsFiles.h"
@ -90,7 +90,7 @@ bool plSDLParser::IParseStateDesc(const char* fileName, hsStream* stream, char t
// curDesc=plSDLMgr::GetInstance()->FindDescriptor(token, plSDL::kLatestVersion);
// if (!curDesc)
{
curDesc = TRACKED_NEW plStateDescriptor;
curDesc = new plStateDescriptor;
curDesc->SetName(token);
DebugMsg("SDL: DESC name=%s", token);
@ -182,10 +182,10 @@ bool plSDLParser::IParseVarDesc(const char* fileName, hsStream* stream, char tok
plStateDescriptor* stateDesc = plSDLMgr::GetInstance()->FindDescriptor(sdlName, plSDL::kLatestVersion);
hsAssert(stateDesc, xtl::format("can't find nested state desc reference %s, fileName=%s",
sdlName, fileName).c_str());
curVar = TRACKED_NEW plSDVarDescriptor(stateDesc);
curVar = new plSDVarDescriptor(stateDesc);
}
else
curVar = TRACKED_NEW plSimpleVarDescriptor;
curVar = new plSimpleVarDescriptor;
curDesc->AddVar(curVar);
bool ok=curVar->SetType(token);

View File

@ -44,7 +44,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <algorithm>
// static
UInt32 plStateChangeNotifier::fCurrentPlayerID = 0;
uint32_t plStateChangeNotifier::fCurrentPlayerID = 0;
plStateChangeNotifier::plStateChangeNotifier() :
fDelta(0)
@ -123,7 +123,7 @@ bool plStateChangeNotifier::operator==(const plStateChangeNotifier &other) const
void plStateChangeNotifier::SendNotificationMsg(const plSimpleStateVariable* srcVar, const plSimpleStateVariable* dstVar,
const char* sdlName)
{
plSDLNotificationMsg* m = TRACKED_NEW plSDLNotificationMsg;
plSDLNotificationMsg* m = new plSDLNotificationMsg;
// add receivers
KeyList::iterator kit=fKeys.begin();

View File

@ -52,7 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
const plString plSDL::kAgeSDLObjectName = _TEMP_CONVERT_FROM_LITERAL("AgeSDLHook");
// static
const UInt8 plStateDataRecord::kIOVersion=6;
const uint8_t plStateDataRecord::kIOVersion=6;
//
// helper
@ -155,12 +155,12 @@ void plStateDataRecord::IInitDescriptor(const plStateDescriptor* sd)
{
if (vd->GetAsSDVarDescriptor())
{ // it's a var which references another state descriptor.
fSDVarsList.push_back(TRACKED_NEW plSDStateVariable(vd->GetAsSDVarDescriptor()));
fSDVarsList.push_back(new plSDStateVariable(vd->GetAsSDVarDescriptor()));
}
else
{
hsAssert(vd->GetAsSimpleVarDescriptor(), "var class problem");
fVarsList.push_back(TRACKED_NEW plSimpleStateVariable(vd->GetAsSimpleVarDescriptor()));
fVarsList.push_back(new plSimpleStateVariable(vd->GetAsSimpleVarDescriptor()));
}
}
}
@ -234,10 +234,10 @@ bool plStateDataRecord::IHasUsedVars(const VarsList& vars) const
//
// read state vars and indices, return true on success
//
bool plStateDataRecord::Read(hsStream* s, float timeConvert, UInt32 readOptions)
bool plStateDataRecord::Read(hsStream* s, float timeConvert, uint32_t readOptions)
{
fFlags = s->ReadLE16();
UInt8 ioVersion = s->ReadByte();
uint8_t ioVersion = s->ReadByte();
if (ioVersion != kIOVersion)
return false;
@ -333,7 +333,7 @@ bool plStateDataRecord::Read(hsStream* s, float timeConvert, UInt32 readOptions)
//
// write out the state vars, along with their index
//
void plStateDataRecord::Write(hsStream* s, float timeConvert, UInt32 writeOptions) const
void plStateDataRecord::Write(hsStream* s, float timeConvert, uint32_t writeOptions) const
{
#ifdef HS_DEBUGGING
if ( !plSDLMgr::GetInstance()->AllowTimeStamping() && (writeOptions & plSDL::kWriteTimeStamps) )
@ -343,7 +343,7 @@ void plStateDataRecord::Write(hsStream* s, float timeConvert, UInt32 writeOption
}
#endif
s->WriteLE16((UInt16)fFlags);
s->WriteLE16((uint16_t)fFlags);
s->WriteByte(kIOVersion);
//
@ -394,7 +394,7 @@ void plStateDataRecord::Write(hsStream* s, float timeConvert, UInt32 writeOption
//
bool plStateDataRecord::ReadStreamHeader(hsStream* s, char** name, int* version, plUoid* objUoid)
{
UInt16 savFlags;
uint16_t savFlags;
s->ReadLE(&savFlags);
if (!(savFlags & plSDL::kAddedVarLengthIO)) // using to establish a new version in the header, can delete in 8/03
{
@ -429,13 +429,13 @@ bool plStateDataRecord::ReadStreamHeader(hsStream* s, char** name, int* version,
//
void plStateDataRecord::WriteStreamHeader(hsStream* s, plUoid* objUoid) const
{
UInt16 savFlags=plSDL::kAddedVarLengthIO; // using to establish a new version in the header, can delete in 8/03
uint16_t savFlags=plSDL::kAddedVarLengthIO; // using to establish a new version in the header, can delete in 8/03
if (objUoid)
savFlags |= plSDL::kHasUoid;
s->WriteLE(savFlags);
s->WriteSafeString(GetDescriptor()->GetName());
s->WriteLE16((Int16)GetDescriptor()->GetVersion());
s->WriteLE16((int16_t)GetDescriptor()->GetVersion());
if (objUoid)
objUoid->Write(s);
}
@ -443,7 +443,7 @@ void plStateDataRecord::WriteStreamHeader(hsStream* s, plUoid* objUoid) const
//
// create and prepare a net msg with this data
//
plNetMsgSDLState* plStateDataRecord::PrepNetMsg(float timeConvert, UInt32 writeOptions) const
plNetMsgSDLState* plStateDataRecord::PrepNetMsg(float timeConvert, uint32_t writeOptions) const
{
// save to stream
hsRAMStream stream;
@ -453,9 +453,9 @@ plNetMsgSDLState* plStateDataRecord::PrepNetMsg(float timeConvert, UInt32 writeO
// fill in net msg
plNetMsgSDLState* msg;
if (writeOptions & plSDL::kBroadcast)
msg = TRACKED_NEW plNetMsgSDLStateBCast;
msg = new plNetMsgSDLStateBCast;
else
msg = TRACKED_NEW plNetMsgSDLState;
msg = new plNetMsgSDLState;
msg->StreamInfo()->CopyStream(&stream);
return msg;
@ -464,7 +464,7 @@ plNetMsgSDLState* plStateDataRecord::PrepNetMsg(float timeConvert, UInt32 writeO
//
// Destroys 'this' and makes a total copy of other
//
void plStateDataRecord::CopyFrom(const plStateDataRecord& other, UInt32 writeOptions/*=0*/)
void plStateDataRecord::CopyFrom(const plStateDataRecord& other, uint32_t writeOptions/*=0*/)
{
fFlags = other.GetFlags();
IInitDescriptor(other.GetDescriptor());
@ -487,7 +487,7 @@ void plStateDataRecord::CopyFrom(const plStateDataRecord& other, UInt32 writeOpt
// copy them to my corresponding item.
// Requires that records have the same descriptor.
//
void plStateDataRecord::UpdateFrom(const plStateDataRecord& other, UInt32 writeOptions/*=0*/)
void plStateDataRecord::UpdateFrom(const plStateDataRecord& other, uint32_t writeOptions/*=0*/)
{
if ( GetDescriptor()->GetVersion()!=other.GetDescriptor()->GetVersion() )
{

View File

@ -43,7 +43,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plSDL.h"
#include "pnNetCommon/plNetApp.h"
const UInt8 plStateDescriptor::kVersion=1; // for Read/Write format
const uint8_t plStateDescriptor::kVersion=1; // for Read/Write format
/////////////////////////////////////////////////////////////////////////////////
// STATE DESC
@ -85,7 +85,7 @@ plVarDescriptor* plStateDescriptor::FindVar(const char* name, int* idx) const
//
bool plStateDescriptor::Read(hsStream* s)
{
UInt8 rwVersion;
uint8_t rwVersion;
s->ReadLE(&rwVersion);
if (rwVersion != kVersion)
{
@ -98,21 +98,21 @@ bool plStateDescriptor::Read(hsStream* s)
delete [] fName;
fName = s->ReadSafeString();
UInt16 version=s->ReadLE16();
uint16_t version=s->ReadLE16();
fVersion=version;
UInt16 numVars=s->ReadLE16();
uint16_t numVars=s->ReadLE16();
fVarsList.reserve(numVars);
int i;
for(i=0;i<numVars; i++)
{
UInt8 SDVar=s->ReadByte();
uint8_t SDVar=s->ReadByte();
plVarDescriptor* var = nil;
if (SDVar)
var = TRACKED_NEW plSDVarDescriptor;
var = new plSDVarDescriptor;
else
var = TRACKED_NEW plSimpleVarDescriptor;
var = new plSimpleVarDescriptor;
if (var->Read(s))
fVarsList.push_back(var);
else
@ -130,16 +130,16 @@ void plStateDescriptor::Write(hsStream* s) const
s->WriteSafeString(fName);
UInt16 version=fVersion;
uint16_t version=fVersion;
s->WriteLE(version);
UInt16 numVars=fVarsList.size();
uint16_t numVars=fVarsList.size();
s->WriteLE(numVars);
VarsList::const_iterator it;
for(it=fVarsList.begin(); it!=fVarsList.end(); it++)
{
UInt8 SDVar = ((*it)->GetAsSDVarDescriptor() != nil);
uint8_t SDVar = ((*it)->GetAsSDVarDescriptor() != nil);
s->WriteByte(SDVar);
(*it)->Write(s);
}

View File

@ -86,16 +86,16 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
class plSDLCreatableStub : public plCreatable
{
private:
UInt16 fClassIndex;
uint16_t fClassIndex;
public:
void* fData;
int fDataLen;
plSDLCreatableStub(UInt16 classIndex, int len) : fClassIndex(classIndex),fData(nil),fDataLen(len) {}
plSDLCreatableStub(uint16_t classIndex, int len) : fClassIndex(classIndex),fData(nil),fDataLen(len) {}
~plSDLCreatableStub() { delete[] (char*)fData; }
const char* ClassName() const { return "SDLCreatable"; }
UInt16 ClassIndex() const { return fClassIndex; }
uint16_t ClassIndex() const { return fClassIndex; }
void Read(hsStream* s, hsResMgr* mgr) { delete[] (char*)fData; fData = new char[fDataLen]; s->Read(fDataLen, fData); }
void Write(hsStream* s, hsResMgr* mgr) { s->Write(fDataLen, fData); }
@ -105,9 +105,9 @@ public:
// plStateVarNotificationInfo
/////////////////////////////////////////////////////
void plStateVarNotificationInfo::Read(hsStream* s, UInt32 readOptions)
void plStateVarNotificationInfo::Read(hsStream* s, uint32_t readOptions)
{
UInt8 saveFlags=s->ReadByte(); // unused
uint8_t saveFlags=s->ReadByte(); // unused
char* hint=s->ReadSafeString();
if (hint && !(readOptions & plSDL::kSkipNotificationInfo))
fHintString = (const char*)hint;
@ -115,9 +115,9 @@ void plStateVarNotificationInfo::Read(hsStream* s, UInt32 readOptions)
delete[] hint;
}
void plStateVarNotificationInfo::Write(hsStream* s, UInt32 writeOptions) const
void plStateVarNotificationInfo::Write(hsStream* s, uint32_t writeOptions) const
{
UInt8 saveFlags=0; // unused
uint8_t saveFlags=0; // unused
s->WriteLE(saveFlags);
s->WriteSafeString(fHintString.c_str());
}
@ -125,9 +125,9 @@ void plStateVarNotificationInfo::Write(hsStream* s, UInt32 writeOptions) const
/////////////////////////////////////////////////////
// plStateVariable
/////////////////////////////////////////////////////
bool plStateVariable::ReadData(hsStream* s, float timeConvert, UInt32 readOptions)
bool plStateVariable::ReadData(hsStream* s, float timeConvert, uint32_t readOptions)
{
UInt8 saveFlags;
uint8_t saveFlags;
s->ReadLE(&saveFlags);
if (saveFlags & plSDL::kHasNotificationInfo)
{
@ -136,11 +136,11 @@ bool plStateVariable::ReadData(hsStream* s, float timeConvert, UInt32 readOption
return true;
}
bool plStateVariable::WriteData(hsStream* s, float timeConvert, UInt32 writeOptions) const
bool plStateVariable::WriteData(hsStream* s, float timeConvert, uint32_t writeOptions) const
{
bool writeNotificationInfo = ((writeOptions & plSDL::kSkipNotificationInfo)==0);
UInt8 saveFlags=0;
uint8_t saveFlags=0;
if (writeNotificationInfo)
saveFlags |= plSDL::kHasNotificationInfo;
@ -225,7 +225,7 @@ void plSimpleStateVariable::IDeAlloc()
#define SDLALLOC(typeName, type, var) \
case typeName: \
var = TRACKED_NEW type[cnt]; \
var = new type[cnt]; \
break;
void plSimpleStateVariable::Alloc(int listSize)
@ -244,20 +244,20 @@ void plSimpleStateVariable::Alloc(int listSize)
{
SDLALLOC(plVarDescriptor::kInt, int, fI)
SDLALLOC(plVarDescriptor::kAgeTimeOfDay, float, fF)
SDLALLOC(plVarDescriptor::kByte, byte, fBy)
SDLALLOC(plVarDescriptor::kByte, uint8_t, fBy)
SDLALLOC(plVarDescriptor::kShort, short, fS)
SDLALLOC(plVarDescriptor::kFloat, float, fF)
SDLALLOC(plVarDescriptor::kDouble, double, fD)
SDLALLOC(plVarDescriptor::kBool, bool, fB)
SDLALLOC(plVarDescriptor::kCreatable, plCreatable*, fC)
case plVarDescriptor::kTime:
fT = TRACKED_NEW plClientUnifiedTime[cnt];
fT = new plClientUnifiedTime[cnt];
break;
case plVarDescriptor::kKey:
fU = TRACKED_NEW plUoid[cnt];
fU = new plUoid[cnt];
break;
case plVarDescriptor::kString32:
fS32 = TRACKED_NEW plVarDescriptor::String32[cnt];
fS32 = new plVarDescriptor::String32[cnt];
break;
default:
hsAssert(false, "undefined atomic type");
@ -282,7 +282,7 @@ void plSimpleStateVariable::Reset()
{
RESET(plVarDescriptor::kInt, int, fI)
RESET(plVarDescriptor::kAgeTimeOfDay, float, fF)
RESET(plVarDescriptor::kByte, byte, fBy)
RESET(plVarDescriptor::kByte, uint8_t, fBy)
RESET(plVarDescriptor::kShort, short, fS)
RESET(plVarDescriptor::kFloat, float, fF)
RESET(plVarDescriptor::kDouble, double, fD)
@ -356,7 +356,7 @@ bool plSimpleStateVariable::SetFromString(const char* valueConst, int idx, bool
else if (type==plVarDescriptor::kShort && fS)
fS[i++] = (short)atoi(ptr);
else if (type==plVarDescriptor::kByte && fBy)
fBy[i++] = (byte)atoi(ptr);
fBy[i++] = (uint8_t)atoi(ptr);
else if ( (type==plVarDescriptor::kFloat || type==plVarDescriptor::kAgeTimeOfDay) && fF)
fF[i++] = (float)atof(ptr);
else if ( (type==plVarDescriptor::kDouble || type==plVarDescriptor::kTime) && fD)
@ -538,7 +538,7 @@ bool plSimpleStateVariable::IConvertFromRGB(plVarDescriptor::Type newType)
{
// rgb to rgba
int i,j;
float* newF = TRACKED_NEW float[fVar.GetCount()*4]; // make more space
float* newF = new float[fVar.GetCount()*4]; // make more space
for(j=0;j<fVar.GetCount(); j++)
{
// recopy with alpha=0 by default
@ -554,12 +554,12 @@ bool plSimpleStateVariable::IConvertFromRGB(plVarDescriptor::Type newType)
{
// rgb to rgba8
int i,j;
byte * newB = TRACKED_NEW byte [fVar.GetCount()*4]; // make more space
uint8_t * newB = new uint8_t [fVar.GetCount()*4]; // make more space
for(j=0;j<fVar.GetCount(); j++)
{
// recopy with alpha=0 by default
for(i=0;i<3;i++)
newB[j*4+i] = byte(fF[j*fVar.GetAtomicCount()+i]*255+.5);
newB[j*4+i] = uint8_t(fF[j*fVar.GetAtomicCount()+i]*255+.5);
newB[j*4+3] = 0;
}
delete [] fF; // delete old
@ -570,12 +570,12 @@ bool plSimpleStateVariable::IConvertFromRGB(plVarDescriptor::Type newType)
{
// rgb to rgb8
int i,j;
byte * newB = TRACKED_NEW byte [fVar.GetCount()*3]; // make space
uint8_t * newB = new uint8_t [fVar.GetCount()*3]; // make space
for(j=0;j<fVar.GetCount(); j++)
{
// recopy with alpha=0 by default
for(i=0;i<3;i++)
newB[j*3+i] = byte(fF[j*fVar.GetAtomicCount()+i]*255+.5);
newB[j*3+i] = uint8_t(fF[j*fVar.GetAtomicCount()+i]*255+.5);
}
delete [] fF; // delete old
fBy = newB; // use new
@ -595,7 +595,7 @@ bool plSimpleStateVariable::IConvertFromRGB8(plVarDescriptor::Type newType)
{
// rgb8 to rgba
int i,j;
float* newF = TRACKED_NEW float[fVar.GetCount()*4]; // make more space
float* newF = new float[fVar.GetCount()*4]; // make more space
for(j=0;j<fVar.GetCount(); j++)
{
// recopy with alpha=0 by default
@ -611,7 +611,7 @@ bool plSimpleStateVariable::IConvertFromRGB8(plVarDescriptor::Type newType)
{
// rgb8 to rgb
int i,j;
float* newF = TRACKED_NEW float[fVar.GetCount()*3]; // make more space
float* newF = new float[fVar.GetCount()*3]; // make more space
for(j=0;j<fVar.GetCount(); j++)
{
// recopy with alpha=0 by default
@ -626,7 +626,7 @@ bool plSimpleStateVariable::IConvertFromRGB8(plVarDescriptor::Type newType)
{
// rgb8 to rgba8
int i,j;
byte * newB = TRACKED_NEW byte [fVar.GetCount()*4]; // make more space
uint8_t * newB = new uint8_t [fVar.GetCount()*4]; // make more space
for(j=0;j<fVar.GetCount(); j++)
{
// recopy with alpha=0 by default
@ -655,7 +655,7 @@ bool plSimpleStateVariable::IConvertFromRGBA(plVarDescriptor::Type newType)
{
// rgba to rgb
int i,j;
float* newF = TRACKED_NEW float[fVar.GetCount()*3]; // make less space
float* newF = new float[fVar.GetCount()*3]; // make less space
for(j=0;j<fVar.GetCount(); j++)
{
// recopy and ignore alpha
@ -670,12 +670,12 @@ bool plSimpleStateVariable::IConvertFromRGBA(plVarDescriptor::Type newType)
{
// rgba to rgb8
int i,j;
byte* newB = TRACKED_NEW byte[fVar.GetCount()*3]; // make less space
uint8_t* newB = new uint8_t[fVar.GetCount()*3]; // make less space
for(j=0;j<fVar.GetCount(); j++)
{
// recopy and ignore alpha
for(i=0;i<3;i++)
newB[j*3+i] = byte(fF[j*fVar.GetAtomicCount()+i]*255+.5);
newB[j*3+i] = uint8_t(fF[j*fVar.GetAtomicCount()+i]*255+.5);
}
delete [] fF; // delete old
fBy = newB; // use new
@ -685,12 +685,12 @@ bool plSimpleStateVariable::IConvertFromRGBA(plVarDescriptor::Type newType)
{
// rgba to rgba8
int i,j;
byte* newBy = TRACKED_NEW byte [fVar.GetCount()*4]; // make less space
uint8_t* newBy = new uint8_t [fVar.GetCount()*4]; // make less space
for(j=0;j<fVar.GetCount(); j++)
{
// recopy and ignore alpha
for(i=0;i<4;i++)
newBy[j*4+i] = byte(fF[j*fVar.GetAtomicCount()+i]*255+.5);
newBy[j*4+i] = uint8_t(fF[j*fVar.GetAtomicCount()+i]*255+.5);
}
delete [] fF; // delete old
fBy = newBy; // use new
@ -713,7 +713,7 @@ bool plSimpleStateVariable::IConvertFromRGBA8(plVarDescriptor::Type newType)
{
// rgba8 to rgb
int i,j;
float* newF = TRACKED_NEW float[fVar.GetCount()*3]; // make less space
float* newF = new float[fVar.GetCount()*3]; // make less space
for(j=0;j<fVar.GetCount(); j++)
{
// recopy and ignore alpha
@ -728,7 +728,7 @@ bool plSimpleStateVariable::IConvertFromRGBA8(plVarDescriptor::Type newType)
{
// rgba8 to rgb8
int i,j;
byte* newB = TRACKED_NEW byte[fVar.GetCount()*3]; // make less space
uint8_t* newB = new uint8_t[fVar.GetCount()*3]; // make less space
for(j=0;j<fVar.GetCount(); j++)
{
// recopy and ignore alpha
@ -743,7 +743,7 @@ bool plSimpleStateVariable::IConvertFromRGBA8(plVarDescriptor::Type newType)
{
// rgba8 to rgba
int i,j;
float* newF = TRACKED_NEW float[fVar.GetCount()*4]; // make less space
float* newF = new float[fVar.GetCount()*4]; // make less space
for(j=0;j<fVar.GetCount(); j++)
{
// recopy and ignore alpha
@ -771,7 +771,7 @@ bool plSimpleStateVariable::IConvertFromInt(plVarDescriptor::Type newType)
case plVarDescriptor::kFloat:
{
// int to float
float* newF = TRACKED_NEW float[fVar.GetCount()];
float* newF = new float[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newF[j] = (float)(fI[j]);
delete [] fI;
@ -781,7 +781,7 @@ bool plSimpleStateVariable::IConvertFromInt(plVarDescriptor::Type newType)
case plVarDescriptor::kShort:
{
// int to short
short* newS = TRACKED_NEW short[fVar.GetCount()];
short* newS = new short[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newS[j] = short(fI[j]);
delete [] fI;
@ -791,9 +791,9 @@ bool plSimpleStateVariable::IConvertFromInt(plVarDescriptor::Type newType)
case plVarDescriptor::kByte:
{
// int to byte
byte* newBy = TRACKED_NEW byte[fVar.GetCount()];
uint8_t* newBy = new uint8_t[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newBy[j] = byte(fI[j]);
newBy[j] = uint8_t(fI[j]);
delete [] fI;
fBy = newBy;
}
@ -801,7 +801,7 @@ bool plSimpleStateVariable::IConvertFromInt(plVarDescriptor::Type newType)
case plVarDescriptor::kDouble:
{
// int to double
double * newD = TRACKED_NEW double[fVar.GetCount()];
double * newD = new double[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newD[j] = fI[j];
delete [] fI;
@ -811,7 +811,7 @@ bool plSimpleStateVariable::IConvertFromInt(plVarDescriptor::Type newType)
case plVarDescriptor::kBool:
{
// int to bool
bool * newB = TRACKED_NEW bool[fVar.GetCount()];
bool * newB = new bool[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newB[j] = (fI[j]!=0);
delete [] fI;
@ -834,7 +834,7 @@ bool plSimpleStateVariable::IConvertFromShort(plVarDescriptor::Type newType)
{
case plVarDescriptor::kFloat:
{
float* newF = TRACKED_NEW float[fVar.GetCount()];
float* newF = new float[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newF[j] = fS[j];
delete [] fS;
@ -843,7 +843,7 @@ bool plSimpleStateVariable::IConvertFromShort(plVarDescriptor::Type newType)
break;
case plVarDescriptor::kInt:
{
int* newI = TRACKED_NEW int[fVar.GetCount()];
int* newI = new int[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newI[j] = short(fS[j]);
delete [] fS;
@ -851,16 +851,16 @@ bool plSimpleStateVariable::IConvertFromShort(plVarDescriptor::Type newType)
}
case plVarDescriptor::kByte:
{
byte* newBy = TRACKED_NEW byte[fVar.GetCount()];
uint8_t* newBy = new uint8_t[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newBy[j] = byte(fS[j]);
newBy[j] = uint8_t(fS[j]);
delete [] fS;
fBy = newBy;
}
break;
case plVarDescriptor::kDouble:
{
double * newD = TRACKED_NEW double[fVar.GetCount()];
double * newD = new double[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newD[j] = fS[j];
delete [] fS;
@ -869,7 +869,7 @@ bool plSimpleStateVariable::IConvertFromShort(plVarDescriptor::Type newType)
break;
case plVarDescriptor::kBool:
{
bool * newB = TRACKED_NEW bool[fVar.GetCount()];
bool * newB = new bool[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newB[j] = (fS[j]!=0);
delete [] fS;
@ -892,7 +892,7 @@ bool plSimpleStateVariable::IConvertFromByte(plVarDescriptor::Type newType)
{
case plVarDescriptor::kFloat:
{
float* newF = TRACKED_NEW float[fVar.GetCount()];
float* newF = new float[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newF[j] = fBy[j];
delete [] fBy;
@ -901,7 +901,7 @@ bool plSimpleStateVariable::IConvertFromByte(plVarDescriptor::Type newType)
break;
case plVarDescriptor::kInt:
{
int* newI = TRACKED_NEW int[fVar.GetCount()];
int* newI = new int[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newI[j] = short(fBy[j]);
delete [] fBy;
@ -909,7 +909,7 @@ bool plSimpleStateVariable::IConvertFromByte(plVarDescriptor::Type newType)
}
case plVarDescriptor::kShort:
{
short* newS = TRACKED_NEW short[fVar.GetCount()];
short* newS = new short[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newS[j] = fBy[j];
delete [] fBy;
@ -918,7 +918,7 @@ bool plSimpleStateVariable::IConvertFromByte(plVarDescriptor::Type newType)
break;
case plVarDescriptor::kDouble:
{
double * newD = TRACKED_NEW double[fVar.GetCount()];
double * newD = new double[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newD[j] = fBy[j];
delete [] fBy;
@ -927,7 +927,7 @@ bool plSimpleStateVariable::IConvertFromByte(plVarDescriptor::Type newType)
break;
case plVarDescriptor::kBool:
{
bool * newB = TRACKED_NEW bool[fVar.GetCount()];
bool * newB = new bool[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newB[j] = (fBy[j]!=0);
delete [] fBy;
@ -950,7 +950,7 @@ bool plSimpleStateVariable::IConvertFromFloat(plVarDescriptor::Type newType)
{
case plVarDescriptor::kInt:
{
int* newI = TRACKED_NEW int[fVar.GetCount()];
int* newI = new int[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newI[j] = (int)(fF[j]+.5f); // round to nearest int
delete [] fF;
@ -959,7 +959,7 @@ bool plSimpleStateVariable::IConvertFromFloat(plVarDescriptor::Type newType)
break;
case plVarDescriptor::kShort:
{
short* newS = TRACKED_NEW short[fVar.GetCount()];
short* newS = new short[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newS[j] = (short)(fF[j]+.5f); // round to nearest int
delete [] fF;
@ -968,16 +968,16 @@ bool plSimpleStateVariable::IConvertFromFloat(plVarDescriptor::Type newType)
break;
case plVarDescriptor::kByte:
{
byte* newBy = TRACKED_NEW byte[fVar.GetCount()];
uint8_t* newBy = new uint8_t[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newBy[j] = (byte)(fF[j]+.5f); // round to nearest int
newBy[j] = (uint8_t)(fF[j]+.5f); // round to nearest int
delete [] fF;
fBy = newBy;
}
break;
case plVarDescriptor::kDouble:
{
double* newD = TRACKED_NEW double[fVar.GetCount()];
double* newD = new double[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newD[j] = fF[j];
delete [] fF;
@ -986,7 +986,7 @@ bool plSimpleStateVariable::IConvertFromFloat(plVarDescriptor::Type newType)
break;
case plVarDescriptor::kBool:
{
bool* newB = TRACKED_NEW bool[fVar.GetCount()];
bool* newB = new bool[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newB[j] = (fF[j]!=0);
delete [] fF;
@ -1009,7 +1009,7 @@ bool plSimpleStateVariable::IConvertFromDouble(plVarDescriptor::Type newType)
{
case plVarDescriptor::kInt:
{
int* newI = TRACKED_NEW int[fVar.GetCount()];
int* newI = new int[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newI[j] = (int)(fD[j]+.5f); // round to nearest int
delete [] fD;
@ -1018,7 +1018,7 @@ bool plSimpleStateVariable::IConvertFromDouble(plVarDescriptor::Type newType)
break;
case plVarDescriptor::kShort:
{
short* newS = TRACKED_NEW short[fVar.GetCount()];
short* newS = new short[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newS[j] = (short)(fD[j]+.5f); // round to nearest int
delete [] fD;
@ -1027,16 +1027,16 @@ bool plSimpleStateVariable::IConvertFromDouble(plVarDescriptor::Type newType)
break;
case plVarDescriptor::kByte:
{
byte* newBy = TRACKED_NEW byte[fVar.GetCount()];
uint8_t* newBy = new uint8_t[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newBy[j] = (byte)(fD[j]+.5f); // round to nearest int
newBy[j] = (uint8_t)(fD[j]+.5f); // round to nearest int
delete [] fD;
fBy = newBy;
}
break;
case plVarDescriptor::kFloat:
{
float* newF = TRACKED_NEW float[fVar.GetCount()];
float* newF = new float[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newF[j] = (float)(fD[j]);
delete [] fD;
@ -1045,7 +1045,7 @@ bool plSimpleStateVariable::IConvertFromDouble(plVarDescriptor::Type newType)
break;
case plVarDescriptor::kBool:
{
bool* newB = TRACKED_NEW bool[fVar.GetCount()];
bool* newB = new bool[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newB[j] = (fD[j]!=0);
delete [] fD;
@ -1068,7 +1068,7 @@ bool plSimpleStateVariable::IConvertFromBool(plVarDescriptor::Type newType)
{
case plVarDescriptor::kInt:
{
int* newI = TRACKED_NEW int[fVar.GetCount()];
int* newI = new int[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newI[j] = (fB[j] == true ? 1 : 0);
delete [] fB;
@ -1077,7 +1077,7 @@ bool plSimpleStateVariable::IConvertFromBool(plVarDescriptor::Type newType)
break;
case plVarDescriptor::kShort:
{
short* newS = TRACKED_NEW short[fVar.GetCount()];
short* newS = new short[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newS[j] = (fB[j] == true ? 1 : 0);
delete [] fB;
@ -1086,7 +1086,7 @@ bool plSimpleStateVariable::IConvertFromBool(plVarDescriptor::Type newType)
break;
case plVarDescriptor::kByte:
{
byte* newBy = TRACKED_NEW byte[fVar.GetCount()];
uint8_t* newBy = new uint8_t[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newBy[j] = (fB[j] == true ? 1 : 0);
delete [] fB;
@ -1095,7 +1095,7 @@ bool plSimpleStateVariable::IConvertFromBool(plVarDescriptor::Type newType)
break;
case plVarDescriptor::kFloat:
{
float* newF = TRACKED_NEW float[fVar.GetCount()];
float* newF = new float[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newF[j] = (fB[j] == true ? 1.f : 0.f);
delete [] fB;
@ -1104,7 +1104,7 @@ bool plSimpleStateVariable::IConvertFromBool(plVarDescriptor::Type newType)
break;
case plVarDescriptor::kDouble:
{
double* newD= TRACKED_NEW double[fVar.GetCount()];
double* newD= new double[fVar.GetCount()];
for(j=0;j<fVar.GetCount(); j++)
newD[j] = (fB[j] == true ? 1.f : 0.f);
delete [] fB;
@ -1236,7 +1236,7 @@ bool plSimpleStateVariable::ConvertTo(plSimpleVarDescriptor* toVar, bool force )
return false;
break;
// FROM Byte
// FROM byte
case plVarDescriptor::kByte:
if (!IConvertFromByte(newType))
return false;
@ -1346,7 +1346,7 @@ bool plSimpleStateVariable::Set(float* v, int idx)
}
// bytevector
bool plSimpleStateVariable::Set(byte* v, int idx)
bool plSimpleStateVariable::Set(uint8_t* v, int idx)
{
VALIDATE_WITH_FALSE_RETURN(idx < fVar.GetCount());
@ -1411,7 +1411,7 @@ bool plSimpleStateVariable::Set(int v, int idx)
return Set((short)v, idx);
else
if (fVar.GetType()==plVarDescriptor::kByte)
return Set((byte)v, idx);
return Set((uint8_t)v, idx);
hsAssert(false, "passing wrong value type to SDL variable");
return false;
@ -1432,13 +1432,13 @@ bool plSimpleStateVariable::Set(short v, int idx)
return Set((int)v, idx);
else
if (fVar.GetType()==plVarDescriptor::kByte)
return Set((byte)v, idx);
return Set((uint8_t)v, idx);
hsAssert(false, "passing wrong value type to SDL variable");
return false;
}
bool plSimpleStateVariable::Set(byte v, int idx)
bool plSimpleStateVariable::Set(uint8_t v, int idx)
{
VALIDATE_WITH_FALSE_RETURN(idx < fVar.GetCount());
@ -1591,7 +1591,7 @@ bool plSimpleStateVariable::Get(short* value, int idx) const
return false;
}
bool plSimpleStateVariable::Get(byte* value, int idx) const
bool plSimpleStateVariable::Get(uint8_t* value, int idx) const
{
VALIDATE_WITH_FALSE_RETURN(idx < fVar.GetCount());
@ -1794,7 +1794,7 @@ plString plSimpleStateVariable::GetKeyName(int idx) const
}
#pragma optimize( "g", off ) // disable float optimizations
bool plSimpleStateVariable::IWriteData(hsStream* s, float timeConvert, int idx, UInt32 writeOptions) const
bool plSimpleStateVariable::IWriteData(hsStream* s, float timeConvert, int idx, uint32_t writeOptions) const
{
#ifdef HS_DEBUGGING
if (!IsUsed())
@ -1834,9 +1834,7 @@ bool plSimpleStateVariable::IWriteData(hsStream* s, float timeConvert, int idx,
if (timeConvert != 0.0)
{
double utDouble=fT[j+i].GetSecsDouble();
hsDoublePrecBegin
utDouble += timeConvert;
hsDoublePrecEnd
plUnifiedTime ut(utDouble);
ut.Write(s);
}
@ -1880,7 +1878,7 @@ bool plSimpleStateVariable::IWriteData(hsStream* s, float timeConvert, int idx,
return true;
}
bool plSimpleStateVariable::IReadData(hsStream* s, float timeConvert, int idx, UInt32 readOptions)
bool plSimpleStateVariable::IReadData(hsStream* s, float timeConvert, int idx, uint32_t readOptions)
{
int j=idx*fVar.GetAtomicCount();
int i;
@ -1911,9 +1909,7 @@ bool plSimpleStateVariable::IReadData(hsStream* s, float timeConvert, int idx, U
fT[j+i].Read(s);
if (timeConvert != 0.0)
{
hsDoublePrecBegin
double newUt = (fT[j+i].GetSecsDouble() + timeConvert);
hsDoublePrecEnd
hsAssert(newUt>=0, "negative unified time");
fT[j+i].SetSecsDouble(newUt);
}
@ -1941,10 +1937,10 @@ bool plSimpleStateVariable::IReadData(hsStream* s, float timeConvert, int idx, U
case plVarDescriptor::kCreatable:
{
hsAssert(fVar.GetAtomicCount()==1, "invalid atomic count");
UInt16 hClass = s->ReadLE16(); // class index
uint16_t hClass = s->ReadLE16(); // class index
if (hClass != 0x8000)
{
UInt32 len = s->ReadLE32(); // length
uint32_t len = s->ReadLE32(); // length
if (plFactory::CanCreate(hClass))
{
delete fC[j];
@ -1952,7 +1948,7 @@ bool plSimpleStateVariable::IReadData(hsStream* s, float timeConvert, int idx, U
}
else
{
plSDLCreatableStub* stub = TRACKED_NEW plSDLCreatableStub(hClass, len);
plSDLCreatableStub* stub = new plSDLCreatableStub(hClass, len);
fC[j] = stub;
}
fC[j]->Read(s, hsgResMgr::ResMgr()); // data
@ -1968,7 +1964,7 @@ bool plSimpleStateVariable::IReadData(hsStream* s, float timeConvert, int idx, U
}
#pragma optimize( "", on ) // restore optimizations to their defaults
bool plSimpleStateVariable::WriteData(hsStream* s, float timeConvert, UInt32 writeOptions) const
bool plSimpleStateVariable::WriteData(hsStream* s, float timeConvert, uint32_t writeOptions) const
{
#ifdef HS_DEBUGGING
if (!IsUsed())
@ -2001,7 +1997,7 @@ bool plSimpleStateVariable::WriteData(hsStream* s, float timeConvert, UInt32 wri
forceDirtyFlags = forceDirtyFlags || (!sameAsDefaults && (writeOptions & plSDL::kDirtyNonDefaults)!=0);
// write save flags
UInt8 saveFlags = 0;
uint8_t saveFlags = 0;
saveFlags |= writeTimeStamps ? plSDL::kHasTimeStamp : 0;
saveFlags |= forceDirtyFlags || (writeDirtyFlags && IsDirty()) ? plSDL::kHasDirtyFlag : 0;
saveFlags |= wantTimeStamp ? plSDL::kWantTimeStamp : 0;
@ -2039,7 +2035,7 @@ bool plSimpleStateVariable::WriteData(hsStream* s, float timeConvert, UInt32 wri
}
// assumes var is created from the right type of descriptor (count, type, etc.)
bool plSimpleStateVariable::ReadData(hsStream* s, float timeConvert, UInt32 readOptions)
bool plSimpleStateVariable::ReadData(hsStream* s, float timeConvert, uint32_t readOptions)
{
// read base class data
plStateVariable::ReadData(s, timeConvert, readOptions);
@ -2047,7 +2043,7 @@ bool plSimpleStateVariable::ReadData(hsStream* s, float timeConvert, UInt32 read
plUnifiedTime ut;
ut.ToEpoch();
UInt8 saveFlags;
uint8_t saveFlags;
s->ReadLE(&saveFlags);
bool isDirty = ( saveFlags & plSDL::kHasDirtyFlag )!=0;
@ -2069,7 +2065,7 @@ bool plSimpleStateVariable::ReadData(hsStream* s, float timeConvert, UInt32 read
// read list size
if (GetVarDescriptor()->IsVariableLength())
{
UInt32 cnt;
uint32_t cnt;
s->ReadLE(&cnt); // have to read as long since we don't know how big the list is
if (cnt>=0 && cnt<plSDL::kMaxListSize)
@ -2112,7 +2108,7 @@ bool plSimpleStateVariable::ReadData(hsStream* s, float timeConvert, UInt32 read
return true;
}
void plSimpleStateVariable::CopyData(const plSimpleStateVariable* other, UInt32 writeOptions/*=0*/)
void plSimpleStateVariable::CopyData(const plSimpleStateVariable* other, uint32_t writeOptions/*=0*/)
{
// use stream as a medium
hsRAMStream stream;
@ -2423,7 +2419,7 @@ void plSDStateVariable::Resize(int cnt)
{
int i;
for(i=origCnt;i<cnt;i++)
fDataRecList[i] = TRACKED_NEW plStateDataRecord(fVarDescriptor->GetStateDescriptor());
fDataRecList[i] = new plStateDataRecord(fVarDescriptor->GetStateDescriptor());
}
SetDirty(true);
@ -2449,7 +2445,7 @@ void plSDStateVariable::Alloc(plSDVarDescriptor* sdvd, int listSize)
{
if (fVarDescriptor==nil)
{
fVarDescriptor = TRACKED_NEW plSDVarDescriptor;
fVarDescriptor = new plSDVarDescriptor;
fVarDescriptor->CopyFrom(sdvd);
}
@ -2457,7 +2453,7 @@ void plSDStateVariable::Alloc(plSDVarDescriptor* sdvd, int listSize)
fDataRecList.resize(cnt);
int j;
for (j=0;j<cnt; j++)
InsertStateDataRecord(TRACKED_NEW plStateDataRecord(sdvd->GetStateDescriptor()), j);
InsertStateDataRecord(new plStateDataRecord(sdvd->GetStateDescriptor()), j);
}
}
@ -2485,7 +2481,7 @@ void plSDStateVariable::IDeInit()
//
// Make 'this' into a copy of 'other'.
//
void plSDStateVariable::CopyFrom(plSDStateVariable* other, UInt32 writeOptions/*=0*/)
void plSDStateVariable::CopyFrom(plSDStateVariable* other, uint32_t writeOptions/*=0*/)
{
// IDeInit();
Alloc(other->GetSDVarDescriptor(), other->GetCount());
@ -2499,7 +2495,7 @@ void plSDStateVariable::CopyFrom(plSDStateVariable* other, UInt32 writeOptions/*
// copy them to my corresponding item.
// Requires that records have the same descriptor.
//
void plSDStateVariable::UpdateFrom(plSDStateVariable* other, UInt32 writeOptions/*=0*/)
void plSDStateVariable::UpdateFrom(plSDStateVariable* other, uint32_t writeOptions/*=0*/)
{
hsAssert(!stricmp(other->GetSDVarDescriptor()->GetName(), fVarDescriptor->GetName()),
xtl::format("var descriptor mismatch in UpdateFrom, name %s,%s ver %d,%d",
@ -2600,17 +2596,17 @@ void plSDStateVariable::GetDirtyDataRecords(ConstDataRecList* recList) const
//
// read all SDVars
//
bool plSDStateVariable::ReadData(hsStream* s, float timeConvert, UInt32 readOptions)
bool plSDStateVariable::ReadData(hsStream* s, float timeConvert, uint32_t readOptions)
{
plStateVariable::ReadData(s, timeConvert, readOptions);
UInt8 saveFlags;
uint8_t saveFlags;
s->ReadLE(&saveFlags); // unused
// read total list size
if (GetVarDescriptor()->IsVariableLength())
{
UInt32 total;
uint32_t total;
s->ReadLE(&total);
Resize(total);
}
@ -2645,15 +2641,15 @@ bool plSDStateVariable::ReadData(hsStream* s, float timeConvert, UInt32 readOpti
//
// write all SDVars
//
bool plSDStateVariable::WriteData(hsStream* s, float timeConvert, UInt32 writeOptions) const
bool plSDStateVariable::WriteData(hsStream* s, float timeConvert, uint32_t writeOptions) const
{
plStateVariable::WriteData(s, timeConvert, writeOptions);
UInt8 saveFlags=0; // unused
uint8_t saveFlags=0; // unused
s->WriteLE(saveFlags);
// write total list size
UInt32 total=GetCount();
uint32_t total=GetCount();
if (GetVarDescriptor()->IsVariableLength())
s->WriteLE(total);

View File

@ -49,7 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plUnifiedTime/plUnifiedTime.h"
const UInt8 plVarDescriptor::kVersion=3; // for Read/Write format
const uint8_t plVarDescriptor::kVersion=3; // for Read/Write format
/////////////////////////////////////////////////////////////////////////////////
// State Var
@ -168,7 +168,7 @@ void plVarDescriptor::CopyFrom(const plVarDescriptor* other)
//
bool plVarDescriptor::Read(hsStream* s)
{
UInt8 version;
uint8_t version;
s->ReadLE(&version);
if (version != kVersion)
{
@ -203,7 +203,7 @@ void plVarDescriptor::Write(hsStream* s) const
s->WriteSafeString(fName);
plMsgStdStringHelper::Poke(fDisplayOptions, s);
s->WriteLE32(fCount);
s->WriteByte((UInt8)fType);
s->WriteByte((uint8_t)fType);
s->WriteSafeString(fDefault);
s->WriteLE32(fFlags);
}
@ -227,7 +227,7 @@ int plSimpleVarDescriptor::GetAtomicSize() const
case kInt:
return sizeof(int)*GetAtomicCount();
case kByte:
return sizeof(byte)*GetAtomicCount();
return sizeof(uint8_t)*GetAtomicCount();
case kShort:
return sizeof(short)*GetAtomicCount();
case kAgeTimeOfDay:
@ -375,8 +375,8 @@ void plSimpleVarDescriptor::Write(hsStream* s) const
{
plVarDescriptor::Write(s);
s->WriteLE16((Int16)fAtomicCount);
s->WriteByte((UInt8)fAtomicType);
s->WriteLE16((int16_t)fAtomicCount);
s->WriteByte((uint8_t)fAtomicType);
}
/////////////////////////////////////////////////////////////////////////////////
@ -399,7 +399,7 @@ bool plSDVarDescriptor::Read(hsStream* s)
return false;
char* sdName=s->ReadSafeString();
UInt16 version = s->ReadLE16();
uint16_t version = s->ReadLE16();
plStateDescriptor* sd=plSDLMgr::GetInstance()->FindDescriptor(sdName, version);
hsAssert( sd, xtl::format("Failed to find sdl descriptor: %s,%d. Missing legacy descriptor?", sdName, version ).c_str() );
SetStateDesc(sd);
@ -415,6 +415,6 @@ void plSDVarDescriptor::Write(hsStream* s) const
plVarDescriptor::Write(s);
s->WriteSafeString(GetStateDescriptor()->GetName());
UInt16 version=GetStateDescriptor()->GetVersion();
uint16_t version=GetStateDescriptor()->GetVersion();
s->WriteLE(version);
}