1
0
mirror of https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git synced 2025-07-17 10:52:46 +00:00

Convert custom HeadSpin integer types to standard types from stdint.h

This commit is contained in:
2012-01-19 21:19:26 -05:00
parent a0d54e2644
commit 5027b5a4ac
1301 changed files with 14497 additions and 14532 deletions

View File

@ -70,11 +70,11 @@ void plGenericType::CopyFrom(const plGenericType& c)
//// Conversion Functions ////////////////////////////////////////////////////
const Int32 & plGenericType::IToInt( void ) const
const int32_t & plGenericType::IToInt( void ) const
{
hsAssert( fType == kInt || fType == kAny, "Trying to use a non-int parameter as an int!" );
static Int32 i;
static int32_t i;
if( fType == kAny )
{
hsAssert( fS != nil, "Weird parameter during conversion" );
@ -85,11 +85,11 @@ const Int32 & plGenericType::IToInt( void ) const
return fI;
}
const UInt32 & plGenericType::IToUInt( void ) const
const uint32_t & plGenericType::IToUInt( void ) const
{
hsAssert( fType == kUInt || fType == kAny, "Trying to use a non-int parameter as an int!" );
static UInt32 i;
static uint32_t i;
if( fType == kAny )
{
hsAssert( fS != nil, "Weird parameter during conversion" );
@ -183,7 +183,7 @@ void plGenericType::Read(hsStream* s)
fS=s->ReadSafeString();
break;
case kBool:
{Int8 b;
{int8_t b;
s->ReadLE( &b );
fB = b?true:false;}
break;
@ -218,7 +218,7 @@ void plGenericType::Write(hsStream* s)
s->WriteSafeString(fS);
break;
case kBool:
{Int8 b = fB?1:0;
{int8_t b = fB?1:0;
s->WriteLE( b );}
break;
case kChar:

View File

@ -60,8 +60,8 @@ public:
protected:
union
{
Int32 fI;
UInt32 fU;
int32_t fI;
uint32_t fU;
float fF;
double fD;
bool fB;
@ -85,10 +85,10 @@ public:
};
protected:
UInt8 fType;
uint8_t fType;
const Int32 &IToInt( void ) const;
const UInt32 &IToUInt( void ) const;
const int32_t &IToInt( void ) const;
const uint32_t &IToUInt( void ) const;
const float &IToFloat( void ) const;
const double &IToDouble( void ) const;
const bool &IToBool( void ) const;
@ -106,8 +106,8 @@ public:
void CopyFrom(const plGenericType& c);
virtual void Reset();
operator Int32() const { return IToInt(); }
operator UInt32() const { return IToUInt(); }
operator int32_t() const { return IToInt(); }
operator uint32_t() const { return IToUInt(); }
operator double() const { return IToDouble(); }
operator float() const { return IToFloat(); }
operator bool() const { return IToBool(); }
@ -115,13 +115,13 @@ public:
operator char() const { return IToChar(); }
void SetType(Types t) { fType=t; }
UInt8 GetType( void ) const { return fType; }
uint8_t GetType( void ) const { return fType; }
std::string GetAsStdString() const;
// implicit set
void Set( Int32 i ) { fI = i; fType = kInt; }
void Set( UInt32 i ) { fU = i; fType = kUInt; }
void Set( int32_t i ) { fI = i; fType = kInt; }
void Set( uint32_t i ) { fU = i; fType = kUInt; }
void Set( float f ) { fF = f; fType = kFloat; }
void Set( double d ) { fD = d; fType = kDouble; }
void Set( bool b ) { fB = b; fType = kBool; }
@ -129,8 +129,8 @@ public:
void Set( char c ) { fC = c; fType = kChar; }
// explicit set
void SetInt( Int32 i ) { fI = i; fType = kInt; }
void SetUInt( UInt32 i ) { fU = i; fType = kUInt; }
void SetInt( int32_t i ) { fI = i; fType = kInt; }
void SetUInt( uint32_t i ) { fU = i; fType = kUInt; }
void SetFloat( float f ) { fF = f; fType = kFloat; }
void SetDouble( double d ) { fD = d; fType = kDouble; }
void SetBool( bool b ) { fB = b; fType = kBool; }
@ -182,8 +182,8 @@ public:
void Write(hsStream* s, hsResMgr* mgr) { fValue.Write(s);}
plGenericType& Value() { return fValue; }
const plGenericType& Value() const { return fValue; }
operator Int32() const { return (Int32)fValue; }
operator UInt32() const { return (UInt32)fValue; }
operator int32_t() const { return (int32_t)fValue; }
operator uint32_t() const { return (uint32_t)fValue; }
operator float() const { return (float)fValue; }
operator double() const { return (double)fValue; }
operator bool() const { return (bool)fValue; }

View File

@ -51,7 +51,7 @@ plNetAddress::plNetAddress()
}
plNetAddress::plNetAddress(UInt32 addr, int port)
plNetAddress::plNetAddress(uint32_t addr, int port)
{
Clear();
SetHost(addr);
@ -110,7 +110,7 @@ std::string plNetAddress::GetHostString() const
return std::string(pnNetCommon::GetTextAddr(fAddr.sin_addr.s_addr));
}
UInt32 plNetAddress::GetHost() const
uint32_t plNetAddress::GetHost() const
{
return fAddr.sin_addr.s_addr;
}
@ -132,7 +132,7 @@ bool plNetAddress::SetHost(const char * hostname)
return true;
}
bool plNetAddress::SetHost(UInt32 addr)
bool plNetAddress::SetHost(uint32_t addr)
{
memcpy(&fAddr.sin_addr, &addr,sizeof(addr));
fAddr.sin_family = AF_INET;
@ -149,14 +149,14 @@ std::string plNetAddress::AsString() const
void plNetAddress::Read(hsStream * s)
{
s->ReadLE((UInt32*)&fAddr.sin_addr.s_addr);
s->ReadLE((uint32_t*)&fAddr.sin_addr.s_addr);
s->ReadLE(&fAddr.sin_port);
s->ReadLE(&fAddr.sin_family);
}
void plNetAddress::Write(hsStream * s)
{
s->WriteLE((UInt32)fAddr.sin_addr.s_addr);
s->WriteLE((uint32_t)fAddr.sin_addr.s_addr);
s->WriteLE(fAddr.sin_port);
s->WriteLE(fAddr.sin_family);
}

View File

@ -73,7 +73,7 @@ class plNetAddress
public:
plNetAddress();
plNetAddress(UInt32 addr, int port);
plNetAddress(uint32_t addr, int port);
plNetAddress(const char * addr, int port);
virtual ~plNetAddress(){}
@ -82,10 +82,10 @@ public:
bool SetAnyPort();
bool SetPort(int port);
bool SetHost(const char * hostname);
bool SetHost(UInt32 ip4addr);
bool SetHost(uint32_t ip4addr);
int GetPort() const;
std::string GetHostString() const;
UInt32 GetHost() const;
uint32_t GetHost() const;
std::string GetHostWithPort() const;
const AddressType & GetAddressInfo() const { return fAddr; }
AddressType & GetAddressInfo() { return fAddr; }

View File

@ -113,7 +113,7 @@ void plNetClientApp::InheritNetMsgFlags(const plMessage* parentMsg, plMessage* c
{
if (childMsg)
{
UInt32 childMsgFlags = childMsg->GetAllBCastFlags();
uint32_t childMsgFlags = childMsg->GetAllBCastFlags();
InheritNetMsgFlags(parentMsg ? parentMsg->GetAllBCastFlags() : 0, &childMsgFlags, startCascade);
childMsg->SetAllBCastFlags(childMsgFlags);
}
@ -125,7 +125,7 @@ void plNetClientApp::InheritNetMsgFlags(const plMessage* parentMsg, plMessage* c
// Set startCasCascade=true if called from outside the dispatcher, so that
// the dispatcher won't mess with the flags when it goes to send out the msg.
//
void plNetClientApp::InheritNetMsgFlags(UInt32 parentMsgFlags, UInt32* childMsgFlags, bool startCascade)
void plNetClientApp::InheritNetMsgFlags(uint32_t parentMsgFlags, uint32_t* childMsgFlags, bool startCascade)
{
if (!(*childMsgFlags & plMessage::kNetStartCascade))
{

View File

@ -75,7 +75,7 @@ class plKey;
class plNetMessage;
typedef std::vector<plNetMember*> plNetMemberList;
typedef std::vector<UInt32> plNetPlayerIDList;
typedef std::vector<uint32_t> plNetPlayerIDList;
//
// Common baseclasses for client and server net apps
@ -172,18 +172,18 @@ public:
static plNetClientApp* GetInstance() { return plNetClientApp::ConvertNoRef(fInstance); }
static const plNetClientApp* GetConstInstance() { return plNetClientApp::ConvertNoRef(fInstance); }
static void InheritNetMsgFlags(const plMessage* parentMsg, plMessage* childMsg, bool startCascade);
static void InheritNetMsgFlags(UInt32 parentMsgFlags, UInt32* childMsgFlags, bool startCascade);
static void InheritNetMsgFlags(uint32_t parentMsgFlags, uint32_t* childMsgFlags, bool startCascade);
static void UnInheritNetMsgFlags(plMessage* msg);
// functions that all net client apps should implement
virtual int SendMsg(plNetMessage* msg) = 0;
virtual UInt32 GetPlayerID() const = 0;
virtual uint32_t GetPlayerID() const = 0;
virtual const char * GetPlayerName( const plKey avKey=nil ) const = 0;
// commonly used net client app functions
virtual float GetCurrentAgeTimeOfDayPercent() const { hsAssert(false, "stub"); return 0.; }
virtual bool ObjectInLocalAge(const plSynchedObject* obj) const { hsAssert(false, "stub"); return false; }
virtual UInt8 GetJoinOrder() const { hsAssert(false, "stub"); return 0; }
virtual uint8_t GetJoinOrder() const { hsAssert(false, "stub"); return 0; }
virtual hsBool IsRemotePlayerKey(const plKey p, int* idx=nil) { hsAssert(false, "stub"); return false; }
virtual plKey GetLocalPlayerKey() const { hsAssert(false, "stub"); return nil; }
virtual plSynchedObject* GetLocalPlayer(hsBool forceLoad=false) const { hsAssert(false, "stub"); return nil; }

View File

@ -56,12 +56,12 @@ private:
};
plLocation fId;
UInt8 fFlags;
uint8_t fFlags;
std::string fDesc; // description of room
public:
plNetGroupId() : fFlags(0) {}
plNetGroupId(const plLocation& id, const UInt8 flags) : fId(id), fFlags(flags) { }
plNetGroupId(const plLocation& id, const uint8_t flags) : fId(id), fFlags(flags) { }
plNetGroupId(const plLocation& id) : fId(id), fFlags(0) { }
hsBool IsConstant() { return (fFlags & kNetGroupConstant) != 0; }

View File

@ -78,7 +78,7 @@ plNetResManager::~plNetResManager()
plCreatable* plNetResManager::IReadCreatable(hsStream* s) const
{
UInt16 hClass = s->ReadLE16();
uint16_t hClass = s->ReadLE16();
if (plFactory::CanCreate(hClass))
{
plCreatable *pCre = plFactory::Create(hClass);

View File

@ -119,7 +119,7 @@ const char* plNetServerConstants::GetServerName(int type)
}
}
UInt16 plNetServerConstants::GetPort(int type)
uint16_t plNetServerConstants::GetPort(int type)
{
switch(type)
{

View File

@ -79,7 +79,7 @@ private:
public:
static const char* GetServerExe(int type) { return (type > kInvalidLo && type < kInvalidHi)?ServerPrograms[type-1]:nil; }
static const char* GetServerName(int type);
static UInt16 GetPort(int type);
static uint16_t GetPort(int type);
static const char* GetServerTypeStr(int type)
{
switch(type)
@ -102,7 +102,7 @@ class plNetServerAgentConstants
{
public:
static const char* GetName() { return "Server_Agent"; }
static const UInt16 GetPort() { return 4800; }
static const uint16_t GetPort() { return 4800; }
static const plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kAgent; }
};
@ -111,7 +111,7 @@ class plNetLookupServerConstants
{
public:
static const char* GetName() { return "Lookup_Server"; }
static const UInt16 GetPort() { return 2000; }
static const uint16_t GetPort() { return 2000; }
static const plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kLookup; }
};
@ -120,7 +120,7 @@ class plNetLobbyServerConstants
{
public:
static const char* GetName() { return "Generated_Lobby"; }
static const UInt16 GetPort() { return 5000; }
static const uint16_t GetPort() { return 5000; }
static const plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kLobby; }
};
@ -129,7 +129,7 @@ class plNetVaultServerConstants
{
public:
static const char* GetName() { return "Vault_Server"; }
static const UInt16 GetPort() { return 2001; }
static const uint16_t GetPort() { return 2001; }
static const plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kVault; }
};
@ -138,7 +138,7 @@ class plNetAuthServerConstants
{
public:
static const char* GetName() { return "Auth_Server"; }
static const UInt16 GetPort() { return 2002; }
static const uint16_t GetPort() { return 2002; }
static const plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kAuth; }
};
@ -147,7 +147,7 @@ class plNetAdminServerConstants
{
public:
static const char* GetName() { return "Admin_Server"; }
static const UInt16 GetPort() { return 2003; }
static const uint16_t GetPort() { return 2003; }
static const plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kAdmin; }
};
@ -155,8 +155,8 @@ class plNetGameServerConstants
{
public:
static const char* GetName() { return "Game_Server"; }
static const UInt16 GetLowPort() { return 5001;}
static const UInt16 GetHighPort() { return 6001;}
static const uint16_t GetLowPort() { return 5001;}
static const uint16_t GetHighPort() { return 6001;}
static const plNetServerConstants::ServerTypes GetType() { return plNetServerConstants::kGame; }
};

View File

@ -86,7 +86,7 @@ void plNetSharedState::Read(hsStream* stream)
Reset();
plMsgStdStringHelper::Peek(fName, stream);
Int32 num=stream->ReadLE32();
int32_t num=stream->ReadLE32();
fServerMayDelete = stream->Readbool();
fVars.reserve(num);
@ -102,7 +102,7 @@ void plNetSharedState::Read(hsStream* stream)
void plNetSharedState::Write(hsStream* stream)
{
plMsgStdStringHelper::Poke(fName, stream);
Int32 num=GetNumVars();
int32_t num=GetNumVars();
stream->WriteLE32(num);
stream->Writebool(fServerMayDelete);

View File

@ -102,7 +102,7 @@ void plSynchedObject::IAppendSynchedValueAddrOffset(AddrOffsetType synchedValueA
{
// copy to new larger array
AddrOffsetType* tmp = TRACKED_NEW AddrOffsetType[fNumSynchedValues+1];
Int32 i;
int32_t i;
for(i=0;i<fNumSynchedValues;i++)
tmp[i] = fSynchedValueAddrOffsets[i];
@ -118,7 +118,7 @@ void plSynchedObject::IAppendSynchedValueFriend(plSynchedValueBase* v)
{
// copy to new larger array
plSynchedValueBase** tmp = TRACKED_NEW plSynchedValueBase*[fNumSynchedValueFriends+1];
Int32 i;
int32_t i;
for(i=0;i<fNumSynchedValueFriends;i++)
tmp[i] = fSynchedValueFriends[i];
@ -131,14 +131,14 @@ void plSynchedObject::IAppendSynchedValueFriend(plSynchedValueBase* v)
}
// adds synchedValue and returns index
UInt8 plSynchedObject::RegisterSynchedValue(plSynchedValueBase* v)
uint8_t plSynchedObject::RegisterSynchedValue(plSynchedValueBase* v)
{
Int32 addrOff = ((Int32)v - (Int32)this)>>2;
hsAssert(hsABS(addrOff) < (UInt32)(1<<(sizeof(AddrOffsetType)<<3)), "address offset overflow");
int32_t addrOff = ((int32_t)v - (int32_t)this)>>2;
hsAssert(hsABS(addrOff) < (uint32_t)(1<<(sizeof(AddrOffsetType)<<3)), "address offset overflow");
IAppendSynchedValueAddrOffset((AddrOffsetType)addrOff);
Int32 idx = fNumSynchedValues-1;
int32_t idx = fNumSynchedValues-1;
hsAssert(idx<256, "index too big");
return (UInt8)idx;
return (uint8_t)idx;
}
hsBool plSynchedObject::RemoveSynchedValue(plSynchedValueBase* v)
@ -190,7 +190,7 @@ void plSynchedObject::RegisterSynchedValueFriend(plSynchedValueBase* v)
//
// send sdl state msg immediately
//
void plSynchedObject::SendSDLStateMsg(const char* SDLStateName, UInt32 synchFlags /*SendSDLStateFlags*/)
void plSynchedObject::SendSDLStateMsg(const char* SDLStateName, uint32_t synchFlags /*SendSDLStateFlags*/)
{
plSDLModifierMsg* sdlMsg = TRACKED_NEW plSDLModifierMsg(SDLStateName,
(synchFlags & kBCastToClients) ? plSDLModifierMsg::kSendToServerAndClients : plSDLModifierMsg::kSendToServer /* action */);
@ -203,7 +203,7 @@ void plSynchedObject::SendSDLStateMsg(const char* SDLStateName, UInt32 synchFlag
// Tell an object to send an sdl state update.
// The request will get queued (returns true)
//
hsBool plSynchedObject::DirtySynchState(const char* SDLStateName, UInt32 synchFlags /*SendSDLStateFlags*/)
hsBool plSynchedObject::DirtySynchState(const char* SDLStateName, uint32_t synchFlags /*SendSDLStateFlags*/)
{
if (!IOKToDirty(SDLStateName))
{
@ -256,7 +256,7 @@ hsBool plSynchedObject::DirtySynchState(const char* SDLStateName, UInt32 synchFl
// add state defn if not already there.
// if there adjust flags if necessary
//
void plSynchedObject::IAddDirtyState(plKey objKey, const char* sdlName, UInt32 sendFlags)
void plSynchedObject::IAddDirtyState(plKey objKey, const char* sdlName, uint32_t sendFlags)
{
bool found=false;
std::vector<StateDefn>::iterator it=fDirtyStates.begin();
@ -336,7 +336,7 @@ void plSynchedObject::Read(hsStream* stream, hsResMgr* mgr)
stream->ReadLE(&fSynchFlags);
if (fSynchFlags & kExcludePersistentState)
{
Int16 num;
int16_t num;
stream->ReadLE(&num);
fSDLExcludeList.clear();
int i;
@ -350,7 +350,7 @@ void plSynchedObject::Read(hsStream* stream, hsResMgr* mgr)
if (fSynchFlags & kHasVolatileState)
{
Int16 num;
int16_t num;
stream->ReadLE(&num);
fSDLVolatileList.clear();
int i;
@ -370,7 +370,7 @@ void plSynchedObject::Write(hsStream* stream, hsResMgr* mgr)
if (fSynchFlags & kExcludePersistentState)
{
Int16 num=fSDLExcludeList.size();
int16_t num=fSDLExcludeList.size();
stream->WriteLE(num);
SDLStateList::iterator it=fSDLExcludeList.begin();
@ -382,7 +382,7 @@ void plSynchedObject::Write(hsStream* stream, hsResMgr* mgr)
if (fSynchFlags & kHasVolatileState)
{
Int16 num=fSDLVolatileList.size();
int16_t num=fSDLVolatileList.size();
stream->WriteLE(num);
SDLStateList::iterator it=fSDLVolatileList.begin();
@ -471,7 +471,7 @@ bool plSynchedObject::IOKToDirty(const char* SDLStateName) const
//
// return true if this object should send his SDL msg (for persistence or synch) over the net
//
bool plSynchedObject::IOKToNetwork(const char* sdlName, UInt32* synchFlags) const
bool plSynchedObject::IOKToNetwork(const char* sdlName, uint32_t* synchFlags) const
{
// determine destination
bool dstServerOnly=false, dstClientsOnly=false, dstClientsAndServer=false;

View File

@ -91,19 +91,19 @@ public:
struct StateDefn
{
plKey fObjKey;
UInt32 fSendFlags;
uint32_t fSendFlags;
std::string fSDLName;
plSynchedObject* GetObject() const { return plSynchedObject::ConvertNoRef(fObjKey->ObjectIsLoaded()); }
StateDefn() : fObjKey(nil),fSendFlags(0) {}
StateDefn(plKey k, UInt32 f, const char* sdlName) : fObjKey(k),fSendFlags(f) { fSDLName=sdlName; }
StateDefn(plKey k, uint32_t f, const char* sdlName) : fObjKey(k),fSendFlags(f) { fSDLName=sdlName; }
};
private:
typedef std::vector<std::string> SDLStateList;
SDLStateList fSDLExcludeList;
SDLStateList fSDLVolatileList;
UInt32 fSynchFlags;
uint32_t fSynchFlags;
plNetGroupId fNetGroup;
@ -112,11 +112,11 @@ private:
static std::vector<StateDefn> fDirtyStates;
static void IRemoveDirtyState(plKey o, const char* sdlName);
static void IAddDirtyState(plKey o, const char* sdlName, UInt32 sendFlags);
static void IAddDirtyState(plKey o, const char* sdlName, uint32_t sendFlags);
bool IOKToDirty(const char* SDLStateName) const;
SDLStateList::const_iterator IFindInSDLStateList(const SDLStateList& list, const char* sdlName) const;
protected:
bool IOKToNetwork(const char* sdlName, UInt32* synchFlags) const;
bool IOKToNetwork(const char* sdlName, uint32_t* synchFlags) const;
public:
plSynchedObject();
virtual ~plSynchedObject();
@ -132,23 +132,23 @@ public:
plNetGroupId GetEffectiveNetGroup() const;
// setters
void SetSynchFlagsBit(UInt32 f) { fSynchFlags |= f; }
void SetSynchFlagsBit(uint32_t f) { fSynchFlags |= f; }
virtual void SetNetGroupConstant(plNetGroupId netGroup);
virtual void SetNetGroup(plNetGroupId netGroup) { fNetGroup = netGroup; }
plNetGroupId SelectNetGroup(plKey groupKey);
virtual hsBool DirtySynchState(const char* sdlName, UInt32 sendFlags);
void SendSDLStateMsg(const char* SDLStateName, UInt32 synchFlags); // don't use, only for net code
virtual hsBool DirtySynchState(const char* sdlName, uint32_t sendFlags);
void SendSDLStateMsg(const char* SDLStateName, uint32_t synchFlags); // don't use, only for net code
void ClearSynchFlagsBit(UInt32 f) { fSynchFlags &= ~f; }
void ClearSynchFlagsBit(uint32_t f) { fSynchFlags &= ~f; }
// static
static hsBool GetSynchDisabled() { return fSynchStateStack.size() ? fSynchStateStack.back() : true; }
static void PushSynchDisabled(hsBool b) { fSynchStateStack.push_back(b); }
static hsBool PopSynchDisabled();
static plSynchedObject* GetStaticSynchedObject() { return fStaticSynchedObj; }
static Int32 GetNumDirtyStates() { return fDirtyStates.size(); }
static plSynchedObject::StateDefn* GetDirtyState(Int32 i) { return &fDirtyStates[i]; }
static int32_t GetNumDirtyStates() { return fDirtyStates.size(); }
static plSynchedObject::StateDefn* GetDirtyState(int32_t i) { return &fDirtyStates[i]; }
static void ClearDirtyState(std::vector<StateDefn>& carryOver) { fDirtyStates=carryOver; }
// IO
@ -184,13 +184,13 @@ public:
//
#ifdef USE_SYNCHED_VALUES
public:
typedef UInt16 AddrOffsetType;
typedef UInt8 NumSynchedValuesType;
typedef UInt16 FlagsType;
typedef uint16_t AddrOffsetType;
typedef uint8_t NumSynchedValuesType;
typedef uint16_t FlagsType;
friend class plSynchedValueBase;
private:
AddrOffsetType* fSynchedValueAddrOffsets; // represent dwords offsets
AddrOffsetType* fSynchedValueAddrOffsets; // represent uint32_ts offsets
NumSynchedValuesType fNumSynchedValues;
// array of friends
@ -203,15 +203,15 @@ private:
void IAppendSynchedValueAddrOffset(AddrOffsetType synchedValueAddrOffset);
void IAppendSynchedValueFriend(plSynchedValueBase* v);
plSynchedValueBase* IGetSynchedValue(NumSynchedValuesType i) const
{ return (plSynchedValueBase*)((Int32)this + (fSynchedValueAddrOffsets[i]<<2)); }
{ return (plSynchedValueBase*)((int32_t)this + (fSynchedValueAddrOffsets[i]<<2)); }
plSynchedValueBase* IGetSynchedValueFriend(NumSynchedValuesType i) const
{ return fSynchedValueFriends[i]; }
public:
Int32 GetNumSynchedValues() const { return fNumSynchedValues+fNumSynchedValueFriends; }
int32_t GetNumSynchedValues() const { return fNumSynchedValues+fNumSynchedValueFriends; }
plSynchedValueBase* GetSynchedValue(int i) const;
UInt8 RegisterSynchedValue(plSynchedValueBase* v);
uint8_t RegisterSynchedValue(plSynchedValueBase* v);
hsBool RemoveSynchedValue(plSynchedValueBase* v); // handles SVFriends too
void RegisterSynchedValueFriend(plSynchedValueBase* v);
#endif

View File

@ -76,10 +76,10 @@ hsScalar plSynchedValueBase::ISaveOrLoad(hsScalar v, hsBool32 save, hsStream* st
double plSynchedValueBase::ISaveOrLoad(double v, hsBool32 save, hsStream* stream, hsResMgr* mgr)
ISaveOrLoadSimpleType();
Int32 plSynchedValueBase::ISaveOrLoad(Int32 v, hsBool32 save, hsStream* stream, hsResMgr* mgr)
int32_t plSynchedValueBase::ISaveOrLoad(int32_t v, hsBool32 save, hsStream* stream, hsResMgr* mgr)
ISaveOrLoadSimpleType();
UInt32 plSynchedValueBase::ISaveOrLoad(UInt32 v, hsBool32 save, hsStream* stream, hsResMgr* mgr)
uint32_t plSynchedValueBase::ISaveOrLoad(uint32_t v, hsBool32 save, hsStream* stream, hsResMgr* mgr)
ISaveOrLoadSimpleType();
int plSynchedValueBase::ISaveOrLoad(int v, hsBool32 save, hsStream* stream, hsResMgr* mgr)
@ -100,7 +100,7 @@ const plKey plSynchedValueBase::ISaveOrLoad(const plKey key, hsBool32 save, hsSt
stream->WriteByte(1);
// I need to write a key to MY stream...
#if 0 // DEBUG
Int32 len = hsStrlen(key->GetName());
int32_t len = hsStrlen(key->GetName());
stream->WriteLE32(len);
stream->Write(len, key->GetName());
#endif
@ -114,12 +114,12 @@ const plKey plSynchedValueBase::ISaveOrLoad(const plKey key, hsBool32 save, hsSt
}
else
{
Int32 has=stream->ReadByte();
int32_t has=stream->ReadByte();
if (has)
{
// read a key from MY stream
#if 0 // DEBUG
Int32 len = stream->ReadLE32();
int32_t len = stream->ReadLE32();
char tmp[256];
hsAssert(len<256, "key name overflow");
stream->Read(len, tmp);

View File

@ -78,17 +78,17 @@ public:
};
protected:
Int16 fSynchedObjectAddrOffset; // this could represent dwords instead of byte offsets
UInt16 fFlags;
int16_t fSynchedObjectAddrOffset; // this could represent uint32_ts instead of uint8_t offsets
uint16_t fFlags;
void IConstruct() // too bad this can't be virtual (because it's called from ctor)
{
// The synchMgr for the class that owns us is constructed first and the staticMgr
// is set to his address so we can automatically get at it during construction.
fFlags=0;
Int32 off = (Int32)plSynchedObject::GetStaticSynchedObject() - (Int32)this;
int32_t off = (int32_t)plSynchedObject::GetStaticSynchedObject() - (int32_t)this;
if ( hsABS(off) < (1<<(sizeof(fSynchedObjectAddrOffset)<<3)) )
fSynchedObjectAddrOffset = (Int16)off;
fSynchedObjectAddrOffset = (int16_t)off;
else
fSynchedObjectAddrOffset=-1;
}
@ -106,8 +106,8 @@ protected:
hsKeyedObject* ISaveOrLoad(hsKeyedObject* obj, hsBool32 save, hsStream* stream, hsResMgr* mgr);
plSceneNode* ISaveOrLoad(plSceneNode* obj, hsBool32 save, hsStream* stream, hsResMgr* mgr);
plSceneObject* ISaveOrLoad(plSceneObject* obj, hsBool32 save, hsStream* stream, hsResMgr* mgr);
Int32 ISaveOrLoad(Int32 v, hsBool32 save, hsStream* stream, hsResMgr* mgr);
UInt32 ISaveOrLoad(UInt32 v, hsBool32 save, hsStream* stream, hsResMgr* mgr);
int32_t ISaveOrLoad(int32_t v, hsBool32 save, hsStream* stream, hsResMgr* mgr);
uint32_t ISaveOrLoad(uint32_t v, hsBool32 save, hsStream* stream, hsResMgr* mgr);
bool ISaveOrLoad(bool v, hsBool32 save, hsStream* stream, hsResMgr* mgr);
int ISaveOrLoad(int v, hsBool32 save, hsStream* stream, hsResMgr* mgr); // or hsBool32
hsScalar ISaveOrLoad(hsScalar v, hsBool32 save, hsStream* stream, hsResMgr* mgr);
@ -122,7 +122,7 @@ public:
virtual plSynchedObject* GetSynchedObject()
{
hsAssert(fSynchedObjectAddrOffset!=-1, "invalid synchedObject address offset");
plSynchedObject* so = fSynchedObjectAddrOffset == -1 ? nil : (plSynchedObject*)((Int32)this+fSynchedObjectAddrOffset);
plSynchedObject* so = fSynchedObjectAddrOffset == -1 ? nil : (plSynchedObject*)((int32_t)this+fSynchedObjectAddrOffset);
if (!(fFlags & kRegistered) && so)
{
so->RegisterSynchedValue(this);
@ -130,10 +130,10 @@ public:
}
return so;
}
UInt16 GetFlags() { return fFlags; }
uint16_t GetFlags() { return fFlags; }
// setters
void SetFlags(UInt16 f) { fFlags=f; }
void SetFlags(uint16_t f) { fFlags=f; }
void MakeDirty() { SetFlags(GetFlags() | kValueIsDirty); }
void MakeClean() { SetFlags(GetFlags() & ~kValueIsDirty); }
@ -226,8 +226,8 @@ public:
const T& GetValue() const { return fValue; }
// for hsBitVector
hsBool32 IsBitSet(UInt32 which) const { return fValue.IsBitSet(which); }
hsBool32 SetBit(UInt32 which, hsBool32 on = true)
hsBool32 IsBitSet(uint32_t which) const { return fValue.IsBitSet(which); }
hsBool32 SetBit(uint32_t which, hsBool32 on = true)
{ hsBool32 bitSet = IsBitSet(which);
if ( (on && !bitSet) || (!on && bitSet) )
DirtyIfNecessary();
@ -236,10 +236,10 @@ public:
void Read(hsStream* s) { fValue.Read(s); }
void Write(hsStream* s) const { fValue.Write(s); }
void Clear() { DirtyIfNecessary(); fValue.Clear(); }
hsBool32 ClearBit(UInt32 which) { if (fValue.IsBitSet(which)) DirtyIfNecessary(); return fValue.ClearBit(which); }
hsBool32 ClearBit(uint32_t which) { if (fValue.IsBitSet(which)) DirtyIfNecessary(); return fValue.ClearBit(which); }
void Reset() { if (fValue.GetSize()!=0) DirtyIfNecessary(); fValue.Reset(); }
hsBool32 ToggleBit(UInt32 which) { DirtyIfNecessary(); return fValue.ToggleBit(which); }
UInt32 GetSize() { return fValue.GetSize(); }
hsBool32 ToggleBit(uint32_t which) { DirtyIfNecessary(); return fValue.ToggleBit(which); }
uint32_t GetSize() { return fValue.GetSize(); }
};
//////////////////////////////////////
@ -338,7 +338,7 @@ void plSynchedTArray<T>::ISaveOrLoad(hsBool32 save, hsStream* stream, hsResMgr*
if (save)
{
// write out size of array
Int32 i, num = fValueList.GetCount();
int32_t i, num = fValueList.GetCount();
stream->WriteLE(num);
for(i=0;i<num;i++)
{
@ -350,7 +350,7 @@ void plSynchedTArray<T>::ISaveOrLoad(hsBool32 save, hsStream* stream, hsResMgr*
// clear array
fValueList.Reset();
// read in size of array
Int32 i, num;
int32_t i, num;
stream->ReadLE(&num);
for(i=0;i<num;i++)

View File

@ -59,7 +59,7 @@ namespace pnNetCommon
#ifndef SERVER
// NOTE: On Win32, WSAStartup() must be called before GetTextAddr() will work.
const char * GetTextAddr(UInt32 binAddr)
const char * GetTextAddr(uint32_t binAddr)
{
in_addr in;
memcpy(&in,&binAddr,sizeof(binAddr));
@ -67,9 +67,9 @@ const char * GetTextAddr(UInt32 binAddr)
}
// NOTE: On Win32, WSAStartup() must be called before GetBinAddr() will work.
UInt32 GetBinAddr(const char * textAddr)
uint32_t GetBinAddr(const char * textAddr)
{
UInt32 addr = 0;
uint32_t addr = 0;
if (!textAddr)
return addr;
@ -100,7 +100,7 @@ void plCreatableStream::Write( hsStream* stream, hsResMgr* mgr )
{
fStream.Rewind();
std::string buf;
UInt32 len = fStream.GetEOF();
uint32_t len = fStream.GetEOF();
stream->WriteLE( len );
buf.resize( len );
fStream.Read( len, (void*)buf.data() );
@ -112,7 +112,7 @@ void plCreatableStream::Read( hsStream* stream, hsResMgr* mgr )
{
fStream.Rewind();
std::string buf;
UInt32 len;
uint32_t len;
stream->LogReadLE( &len,"CreatableStream Len");
buf.resize( len );
stream->LogRead( len, (void*)buf.data(),"CreatableStream Data");

View File

@ -82,8 +82,8 @@ namespace pnNetCommon
{
#ifndef SERVER
UInt32 GetBinAddr(const char * textAddr);
const char * GetTextAddr(UInt32 binAddr);
uint32_t GetBinAddr(const char * textAddr);
const char * GetTextAddr(uint32_t binAddr);
#endif // SERVER
}