Browse Source

Add more temporary hack macros to help speed up conversion and testing

Michael Hansen 13 years ago
parent
commit
442a733fbb
  1. 11
      Sources/Plasma/CoreLib/plString.h
  2. 14
      Sources/Plasma/FeatureLib/pfConsole/pfConsole.cpp
  3. 10
      Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp
  4. 11
      Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp
  5. 2
      Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp
  6. 3
      Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.cpp
  7. 20
      Sources/Plasma/FeatureLib/pfPython/pyVault.cpp
  8. 7
      Sources/Plasma/NucleusLib/pnKeyedObject/hsKeyedObject.cpp
  9. 10
      Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp
  10. 5
      Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.h
  11. 2
      Sources/Plasma/NucleusLib/pnNetCommon/plNetApp.h
  12. 2
      Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h
  13. 4
      Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp
  14. 36
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp
  15. 6
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h
  16. 3
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrLoad.cpp
  17. 2
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp
  18. 18
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrShow.cpp
  19. 2
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgHandler.cpp
  20. 46
      Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp
  21. 3
      Sources/Plasma/PubUtilLib/plNetCommon/plNetMember.h
  22. 6
      Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.h
  23. 10
      Sources/Plasma/PubUtilLib/plNetTransport/plNetTransport.cpp
  24. 4
      Sources/Plasma/PubUtilLib/plNetTransport/plNetTransportMember.cpp
  25. 9
      Sources/Plasma/PubUtilLib/plNetTransport/plNetTransportMember.h
  26. 7
      Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp
  27. 2
      Sources/Tools/plResBrowser/plResTreeView.cpp

11
Sources/Plasma/CoreLib/plString.h

@ -33,8 +33,15 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include <vector> #include <vector>
#include <functional> #include <functional>
/* NOTE & TODO:
* These macros are intentionally annoyingly named, to mark what code
* needs to be cleaned up after a larger portion of Plasma is converted
* to plString.
*/
#define _TEMP_CONVERT_FROM_LITERAL(x) plString::FromUtf8((x)) #define _TEMP_CONVERT_FROM_LITERAL(x) plString::FromUtf8((x))
#define _TEMP_CONVERT_FROM_WCHAR_T(x) plString::FromWchar((x)) #define _TEMP_CONVERT_FROM_WCHAR_T(x) plString::FromWchar((x))
#define _TEMP_CONVERT_TO_CONST_CHAR(x) (x).c_str()
#define _TEMP_CONVERT_TO_CONST_CHAR_S(x) (x).s_str()
typedef unsigned int UniChar; typedef unsigned int UniChar;
@ -176,7 +183,9 @@ public:
} }
const char *c_str() const { return fUtf8Buffer.GetData(); } const char *c_str() const { return fUtf8Buffer.GetData(); }
const char *s_str() const { return c_str() ? c_str() : ""; } const char *s_str(const char *safe = "") const { return c_str() ? c_str() : safe; }
char CharAt(size_t position) const { return c_str()[position]; }
plStringBuffer<char> ToUtf8() const { return fUtf8Buffer; } plStringBuffer<char> ToUtf8() const { return fUtf8Buffer; }
plStringBuffer<UInt16> ToUtf16() const; plStringBuffer<UInt16> ToUtf16() const;
plStringBuffer<wchar_t> ToWchar() const; plStringBuffer<wchar_t> ToWchar() const;

14
Sources/Plasma/FeatureLib/pfConsole/pfConsole.cpp

@ -333,8 +333,8 @@ hsBool pfConsole::MsgReceive( plMessage *msg )
// InviteReceived // InviteReceived
case kSrv2Cli_GameMgr_InviteReceived: { case kSrv2Cli_GameMgr_InviteReceived: {
const Srv2Cli_GameMgr_InviteReceived & gmMsg = *(const Srv2Cli_GameMgr_InviteReceived *)gameMgrMsg->netMsg; const Srv2Cli_GameMgr_InviteReceived & gmMsg = *(const Srv2Cli_GameMgr_InviteReceived *)gameMgrMsg->netMsg;
const char * inviterName = plNetClientMgr::GetInstance()->GetPlayerNameById(gmMsg.inviterId); const plString & inviterName = plNetClientMgr::GetInstance()->GetPlayerNameById(gmMsg.inviterId);
AddLineF("[GameMgr] Invite received: %S, %u. Inviter: %s", pfGameMgr::GetInstance()->GetGameNameByTypeId(gmMsg.gameTypeId), gmMsg.newGameId, inviterName ? inviterName : "<Unknown>"); AddLineF("[GameMgr] Invite received: %S, %u. Inviter: %s", pfGameMgr::GetInstance()->GetGameNameByTypeId(gmMsg.gameTypeId), gmMsg.newGameId, inviterName.s_str("<Unknown>"));
} }
return true; return true;
@ -342,8 +342,8 @@ hsBool pfConsole::MsgReceive( plMessage *msg )
// InviteRevoked // InviteRevoked
case kSrv2Cli_GameMgr_InviteRevoked: { case kSrv2Cli_GameMgr_InviteRevoked: {
const Srv2Cli_GameMgr_InviteRevoked & gmMsg = *(const Srv2Cli_GameMgr_InviteRevoked *)gameMgrMsg->netMsg; const Srv2Cli_GameMgr_InviteRevoked & gmMsg = *(const Srv2Cli_GameMgr_InviteRevoked *)gameMgrMsg->netMsg;
const char * inviterName = plNetClientMgr::GetInstance()->GetPlayerNameById(gmMsg.inviterId); const plString & inviterName = plNetClientMgr::GetInstance()->GetPlayerNameById(gmMsg.inviterId);
AddLineF("[GameMgr] Invite revoked: %S, %u. Inviter: %s", pfGameMgr::GetInstance()->GetGameNameByTypeId(gmMsg.gameTypeId), gmMsg.newGameId, inviterName ? inviterName : "<Unknown>"); AddLineF("[GameMgr] Invite revoked: %S, %u. Inviter: %s", pfGameMgr::GetInstance()->GetGameNameByTypeId(gmMsg.gameTypeId), gmMsg.newGameId, inviterName.s_str("<Unknown>"));
} }
return true; return true;
@ -372,7 +372,7 @@ hsBool pfConsole::MsgReceive( plMessage *msg )
cli->GetName(), cli->GetName(),
cli->GetGameId(), cli->GetGameId(),
netMsg.playerId netMsg.playerId
? plNetClientMgr::GetInstance()->GetPlayerNameById(netMsg.playerId) ? plNetClientMgr::GetInstance()->GetPlayerNameById(netMsg.playerId).c_str()
: "Computer" : "Computer"
); );
} }
@ -387,7 +387,7 @@ hsBool pfConsole::MsgReceive( plMessage *msg )
cli->GetName(), cli->GetName(),
cli->GetGameId(), cli->GetGameId(),
netMsg.playerId netMsg.playerId
? plNetClientMgr::GetInstance()->GetPlayerNameById(netMsg.playerId) ? plNetClientMgr::GetInstance()->GetPlayerNameById(netMsg.playerId).c_str()
: "Computer" : "Computer"
); );
} }
@ -503,7 +503,7 @@ hsBool pfConsole::MsgReceive( plMessage *msg )
const Srv2Cli_TTT_MoveMade & netMsg = *(const Srv2Cli_TTT_MoveMade *)gameCliMsg->netMsg; const Srv2Cli_TTT_MoveMade & netMsg = *(const Srv2Cli_TTT_MoveMade *)gameCliMsg->netMsg;
const char * playerName const char * playerName
= netMsg.playerId = netMsg.playerId
? plNetClientMgr::GetInstance()->GetPlayerNameById(netMsg.playerId) ? plNetClientMgr::GetInstance()->GetPlayerNameById(netMsg.playerId).c_str()
: "Computer"; : "Computer";
AddLineF( AddLineF(
"[Game %s:%u] %s moved:", "[Game %s:%u] %s moved:",

10
Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommandsNet.cpp

@ -229,13 +229,13 @@ PF_CONSOLE_CMD( Net, // groupName
"broadcast chat msg" ) // helpString "broadcast chat msg" ) // helpString
{ {
// send chat text // send chat text
std::string text=plNetClientMgr::GetInstance()->GetPlayerName(); plString text=plNetClientMgr::GetInstance()->GetPlayerName();
text += ":"; text += _TEMP_CONVERT_FROM_LITERAL(":");
int i; int i;
for(i=0;i<numParams;i++) for(i=0;i<numParams;i++)
{ {
text += (char*)params[i]; text += plString::FromUtf8( (char*)params[i] );
text += " "; text += _TEMP_CONVERT_FROM_LITERAL(" ");
} }
plConsoleMsg *cMsg = TRACKED_NEW plConsoleMsg( plConsoleMsg::kAddLine, text.c_str() ); plConsoleMsg *cMsg = TRACKED_NEW plConsoleMsg( plConsoleMsg::kAddLine, text.c_str() );
cMsg->SetBCastFlag(plMessage::kNetPropagate | plMessage::kNetForce); cMsg->SetBCastFlag(plMessage::kNetPropagate | plMessage::kNetForce);
@ -1014,7 +1014,7 @@ PF_CONSOLE_CMD(
return; return;
} }
if (unsigned playerId = plNetClientMgr::GetInstance()->GetPlayerIdByName((const char *)params[1])) { if (unsigned playerId = plNetClientMgr::GetInstance()->GetPlayerIdByName(plString::FromUtf8((const char *)params[1]))) {
ttt->InvitePlayer(playerId); ttt->InvitePlayer(playerId);
PrintStringF(PrintString, "Sent invite to playerId %u", playerId); PrintStringF(PrintString, "Sent invite to playerId %u", playerId);
} }

11
Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp

@ -455,8 +455,7 @@ hsBool cyMisc::WasLocallyNotified(pyKey &selfkey)
// //
const char* cyMisc::GetClientName(pyKey &avKey) const char* cyMisc::GetClientName(pyKey &avKey)
{ {
const char* ret=plNetClientMgr::GetInstance()->GetPlayerName(avKey.getKey()); return plNetClientMgr::GetInstance()->GetPlayerName(avKey.getKey()).s_str();
return (ret==nil) ? "" : ret;
} }
PyObject* cyMisc::GetAvatarKeyFromClientID(int clientID) PyObject* cyMisc::GetAvatarKeyFromClientID(int clientID)
@ -549,7 +548,7 @@ hsBool cyMisc::ValidateKey(pyKey& key)
// //
const char* cyMisc::GetLocalClientName() const char* cyMisc::GetLocalClientName()
{ {
return plNetClientMgr::GetInstance()->GetPlayerName(); return plNetClientMgr::GetInstance()->GetPlayerName().c_str();
} }
@ -946,7 +945,7 @@ PyObject* cyMisc::GetLocalAvatar()
PyObject* cyMisc::GetLocalPlayer() PyObject* cyMisc::GetLocalPlayer()
{ {
return pyPlayer::New(plNetClientMgr::GetInstance()->GetLocalPlayerKey(), return pyPlayer::New(plNetClientMgr::GetInstance()->GetLocalPlayerKey(),
plNetClientMgr::GetInstance()->GetPlayerName(), plNetClientMgr::GetInstance()->GetPlayerName().c_str(),
plNetClientMgr::GetInstance()->GetPlayerID(), plNetClientMgr::GetInstance()->GetPlayerID(),
0.0 ); 0.0 );
} }
@ -1003,7 +1002,7 @@ std::vector<PyObject*> cyMisc::GetPlayerList()
// only non-ignored people in list and not in ignore list // only non-ignored people in list and not in ignore list
if ( !VaultAmIgnoringPlayer ( mbr->GetPlayerID()) ) if ( !VaultAmIgnoringPlayer ( mbr->GetPlayerID()) )
{ {
PyObject* playerObj = pyPlayer::New(avkey, mbr->GetPlayerName(), mbr->GetPlayerID(), mbr->GetDistSq()); PyObject* playerObj = pyPlayer::New(avkey, mbr->GetPlayerName().c_str(), mbr->GetPlayerID(), mbr->GetDistSq());
pyPlayer* player = pyPlayer::ConvertFrom(playerObj); // accesses internal pyPlayer object pyPlayer* player = pyPlayer::ConvertFrom(playerObj); // accesses internal pyPlayer object
// modifies playerObj // modifies playerObj
@ -1038,7 +1037,7 @@ std::vector<PyObject*> cyMisc::GetPlayerListDistanceSorted()
// only non-ignored people in list and not in ignore list // only non-ignored people in list and not in ignore list
if ( !VaultAmIgnoringPlayer ( mbr->GetPlayerID()) ) if ( !VaultAmIgnoringPlayer ( mbr->GetPlayerID()) )
{ {
PyObject* playerObj = pyPlayer::New(avkey, mbr->GetPlayerName(), mbr->GetPlayerID(), mbr->GetDistSq()); PyObject* playerObj = pyPlayer::New(avkey, mbr->GetPlayerName().c_str(), mbr->GetPlayerID(), mbr->GetDistSq());
pyPlayer* player = pyPlayer::ConvertFrom(playerObj); // accesses internal pyPlayer object pyPlayer* player = pyPlayer::ConvertFrom(playerObj); // accesses internal pyPlayer object
// modifies playerObj // modifies playerObj

2
Sources/Plasma/FeatureLib/pfPython/plPythonFileMod.cpp

@ -1965,7 +1965,7 @@ hsBool plPythonFileMod::MsgReceive(plMessage* msg)
if ( mbrIndex != -1 ) if ( mbrIndex != -1 )
{ {
plNetTransportMember *mbr = plNetClientMgr::GetInstance()->TransportMgr().GetMember( mbrIndex ); plNetTransportMember *mbr = plNetClientMgr::GetInstance()->TransportMgr().GetMember( mbrIndex );
player = pyPlayer::New(mbr->GetAvatarKey(), mbr->GetPlayerName(), mbr->GetPlayerID(), mbr->GetDistSq()); player = pyPlayer::New(mbr->GetAvatarKey(), mbr->GetPlayerName().c_str(), mbr->GetPlayerID(), mbr->GetDistSq());
} }
else else
{ {

3
Sources/Plasma/FeatureLib/pfPython/plPythonSDLModifier.cpp

@ -609,9 +609,8 @@ const plPythonSDLModifier* plPythonSDLModifier::FindAgeSDL()
} }
else else
{ {
char str[256];
if (!key) if (!key)
plNetClientApp::StaticErrorMsg("nil key %s for age sdl %s", ageName, oid.StringIze(str)); plNetClientApp::StaticErrorMsg("nil key %s for age sdl %s", ageName, oid.StringIze().c_str());
else else
if (!key->ObjectIsLoaded()) if (!key->ObjectIsLoaded())
plNetClientApp::StaticErrorMsg("key %s not loaded for age sdl %s", plNetClientApp::StaticErrorMsg("key %s not loaded for age sdl %s",

20
Sources/Plasma/FeatureLib/pfPython/pyVault.cpp

@ -652,24 +652,24 @@ void pyVault::CreateNeighborhood()
link.GetAgeInfo()->SetAgeFilename(kNeighborhoodAgeFilename); link.GetAgeInfo()->SetAgeFilename(kNeighborhoodAgeFilename);
link.GetAgeInfo()->SetAgeInstanceName(kNeighborhoodAgeInstanceName); link.GetAgeInfo()->SetAgeInstanceName(kNeighborhoodAgeInstanceName);
std::string title; plString title;
std::string desc; plString desc;
unsigned nameLen = StrLen(nc->GetPlayerName()); unsigned nameLen = nc->GetPlayerName().GetSize();
if (nc->GetPlayerName()[nameLen - 1] == 's' || nc->GetPlayerName()[nameLen - 1] == 'S') if (nc->GetPlayerName().CharAt(nameLen - 1) == 's' || nc->GetPlayerName().CharAt(nameLen - 1) == 'S')
{ {
xtl::format( title, "%s'", nc->GetPlayerName() ); title = plString::Format( "%s'", nc->GetPlayerName().c_str() );
xtl::format( desc, "%s' %s", nc->GetPlayerName(), link.GetAgeInfo()->GetAgeInstanceName() ); desc = plString::Format( "%s' %s", nc->GetPlayerName().c_str(), link.GetAgeInfo()->GetAgeInstanceName() );
} }
else else
{ {
xtl::format( title, "%s's", nc->GetPlayerName() ); title = plString::Format( "%s's", nc->GetPlayerName().c_str() );
xtl::format( desc, "%s's %s", nc->GetPlayerName(), link.GetAgeInfo()->GetAgeInstanceName() ); desc = plString::Format( "%s's %s", nc->GetPlayerName().c_str(), link.GetAgeInfo()->GetAgeInstanceName() );
} }
link.GetAgeInfo()->SetAgeInstanceGuid(&plUUID(GuidGenerate())); link.GetAgeInfo()->SetAgeInstanceGuid(&plUUID(GuidGenerate()));
link.GetAgeInfo()->SetAgeUserDefinedName( title.c_str() ); link.GetAgeInfo()->SetAgeUserDefinedName( _TEMP_CONVERT_TO_CONST_CHAR(title) );
link.GetAgeInfo()->SetAgeDescription( desc.c_str() ); link.GetAgeInfo()->SetAgeDescription( _TEMP_CONVERT_TO_CONST_CHAR(desc) );
VaultRegisterOwnedAge(&link); VaultRegisterOwnedAge(&link);
} }

7
Sources/Plasma/NucleusLib/pnKeyedObject/hsKeyedObject.cpp

@ -143,12 +143,9 @@ void hsKeyedObject::UnRegisterAsManual(plUoid& inUoid)
if (!(inUoid == myUoid)) if (!(inUoid == myUoid))
{ {
#if !HS_BUILD_FOR_UNIX // disable for unix servers #if !HS_BUILD_FOR_UNIX // disable for unix servers
char inStr[255], myStr[255];
inUoid.StringIze(inStr);
myUoid.StringIze(myStr);
hsAssert(false, hsAssert(false,
xtl::format("Request to Unregister wrong FixedKey, keyName=%s, inUoid=%s, myUoid=%s", plString::Format("Request to Unregister wrong FixedKey, keyName=%s, inUoid=%s, myUoid=%s",
fpKey->GetName() ? fpKey->GetName() : "?", inStr, myStr).c_str()); fpKey->GetName() ? fpKey->GetName() : "?", inUoid.StringIze().c_str(), myUoid.StringIze().c_str()).c_str());
#endif #endif
} }
((plKeyImp*)fpKey)->UnRegister(); ((plKeyImp*)fpKey)->UnRegister();

10
Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.cpp

@ -118,10 +118,9 @@ hsBool plLocation::IsVirtual() const
} }
// THIS SHOULD BE FOR DEBUGGING ONLY <hint hint> // THIS SHOULD BE FOR DEBUGGING ONLY <hint hint>
char* plLocation::StringIze(char* str) const // Format to displayable string plString plLocation::StringIze() const // Format to displayable string
{ {
sprintf(str, "S0x%xF0x%x", fSequenceNumber, int(fFlags)); return plString::Format("S0x%xF0x%x", fSequenceNumber, int(fFlags));
return str;
} }
plLocation plLocation::MakeReserved(UInt32 number) plLocation plLocation::MakeReserved(UInt32 number)
@ -272,13 +271,12 @@ plUoid& plUoid::operator=(const plUoid& rhs)
} }
// THIS SHOULD BE FOR DEBUGGING ONLY <hint hint> // THIS SHOULD BE FOR DEBUGGING ONLY <hint hint>
char* plUoid::StringIze(char* str) const // Format to displayable string plString plUoid::StringIze() const // Format to displayable string
{ {
sprintf(str, "(0x%x:0x%x:%s:C:[%u,%u])", return plString::Format("(0x%x:0x%x:%s:C:[%u,%u])",
fLocation.GetSequenceNumber(), fLocation.GetSequenceNumber(),
int(fLocation.GetFlags()), int(fLocation.GetFlags()),
fObjectName, fObjectName,
GetClonePlayerID(), GetClonePlayerID(),
GetCloneID()); GetCloneID());
return str;
} }

5
Sources/Plasma/NucleusLib/pnKeyedObject/plUoid.h

@ -59,6 +59,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "plLoadMask.h" #include "plLoadMask.h"
class hsStream; class hsStream;
class plString;
//// plLocation ////////////////////////////////////////////////////////////// //// plLocation //////////////////////////////////////////////////////////////
@ -124,7 +125,7 @@ public:
bool operator<(const plLocation& loc ) const { return fSequenceNumber < loc.fSequenceNumber; } bool operator<(const plLocation& loc ) const { return fSequenceNumber < loc.fSequenceNumber; }
// THIS SHOULD BE FOR DEBUGGING ONLY <hint hint> // THIS SHOULD BE FOR DEBUGGING ONLY <hint hint>
char* StringIze(char* str) const; // Format to displayable string. Returns the same string for convenience plString StringIze() const; // Format to displayable string.
static plLocation MakeReserved(UInt32 number); static plLocation MakeReserved(UInt32 number);
static plLocation MakeNormal(UInt32 number); static plLocation MakeNormal(UInt32 number);
@ -174,7 +175,7 @@ public:
void SetObjectID(UInt32 id) { fObjectID = id; } void SetObjectID(UInt32 id) { fObjectID = id; }
// THIS SHOULD BE FOR DEBUGGING ONLY <hint hint> // THIS SHOULD BE FOR DEBUGGING ONLY <hint hint>
char* StringIze(char* str) const; // Format to displayable string plString StringIze() const; // Format to displayable string
protected: protected:
enum ContentsFlags // for read/write functions enum ContentsFlags // for read/write functions

2
Sources/Plasma/NucleusLib/pnNetCommon/plNetApp.h

@ -178,7 +178,7 @@ public:
// functions that all net client apps should implement // functions that all net client apps should implement
virtual int SendMsg(plNetMessage* msg) = 0; virtual int SendMsg(plNetMessage* msg) = 0;
virtual UInt32 GetPlayerID() const = 0; virtual UInt32 GetPlayerID() const = 0;
virtual const char * GetPlayerName( const plKey avKey=nil ) const = 0; virtual plString GetPlayerName( const plKey avKey=nil ) const = 0;
// commonly used net client app functions // commonly used net client app functions
virtual float GetCurrentAgeTimeOfDayPercent() const { hsAssert(false, "stub"); return 0.; } virtual float GetCurrentAgeTimeOfDayPercent() const { hsAssert(false, "stub"); return 0.; }

2
Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h

@ -52,6 +52,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "pnInputCore/plKeyDef.h" #include "pnInputCore/plKeyDef.h"
#include "hsBitVector.h" #include "hsBitVector.h"
#include "hsTemplates.h" #include "hsTemplates.h"
#include "plString.h"
class plMessage; class plMessage;
struct plMouseInfo; struct plMouseInfo;
class plPipeline; class plPipeline;
@ -189,6 +190,7 @@ public:
static bool GetInverted() { return plMouseDevice::bInverted; } static bool GetInverted() { return plMouseDevice::bInverted; }
static void SetInverted(bool inverted) { plMouseDevice::bInverted = inverted; } static void SetInverted(bool inverted) { plMouseDevice::bInverted = inverted; }
static void AddNameToCursor(const char* name); static void AddNameToCursor(const char* name);
static void AddNameToCursor(const plString& name) { AddNameToCursor(_TEMP_CONVERT_TO_CONST_CHAR(name)); }
static void AddIDNumToCursor(UInt32 idNum); static void AddIDNumToCursor(UInt32 idNum);
static void AddCCRToCursor(); static void AddCCRToCursor();

4
Sources/Plasma/PubUtilLib/plInputCore/plSceneInputInterface.cpp

@ -837,8 +837,8 @@ void plSceneInputInterface::ILinkOffereeToAge()
std::string title; std::string title;
std::string desc; std::string desc;
unsigned nameLen = StrLen(plNetClientMgr::GetInstance()->GetPlayerName()); unsigned nameLen = plNetClientMgr::GetInstance()->GetPlayerName().GetSize();
if (plNetClientMgr::GetInstance()->GetPlayerName()[nameLen - 1] == 's' || plNetClientMgr::GetInstance()->GetPlayerName()[nameLen - 1] == 'S') { if (plNetClientMgr::GetInstance()->GetPlayerName().CharAt(nameLen - 1) == 's' || plNetClientMgr::GetInstance()->GetPlayerName().CharAt(nameLen - 1) == 'S') {
xtl::format( title, "%s'", plNetClientMgr::GetInstance()->GetPlayerName() ); xtl::format( title, "%s'", plNetClientMgr::GetInstance()->GetPlayerName() );
xtl::format( desc, "%s' %s", plNetClientMgr::GetInstance()->GetPlayerName(), link.GetAgeInfo()->GetAgeInstanceName() ); xtl::format( desc, "%s' %s", plNetClientMgr::GetInstance()->GetPlayerName(), link.GetAgeInfo()->GetAgeInstanceName() );
} }

36
Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp

@ -619,9 +619,8 @@ void plNetClientMgr::ICheckPendingStateLoad(double secs)
if ( !hsgResMgr::ResMgr()->FindKey( tmpUoid ) ) if ( !hsgResMgr::ResMgr()->FindKey( tmpUoid ) )
{ {
// discard the state if object not found in dataset. // discard the state if object not found in dataset.
char tmp[256];
hsLogEntry( DebugMsg( "Failed to find object %s in dataset. Discarding pending state '%s'", hsLogEntry( DebugMsg( "Failed to find object %s in dataset. Discarding pending state '%s'",
tmpUoid.StringIze(tmp), tmpUoid.StringIze().c_str(),
pl->fSDRec->GetDescriptor()->GetName() ) ); pl->fSDRec->GetDescriptor()->GetName() ) );
delete pl; delete pl;
it = fPendingLoads.erase(it); it = fPendingLoads.erase(it);
@ -663,7 +662,6 @@ void plNetClientMgr::ICheckPendingStateLoad(double secs)
double rawSecs = hsTimer::GetSeconds(); double rawSecs = hsTimer::GetSeconds();
if ((rawSecs - pl->fQueuedTime) > 60.f /*secs*/) if ((rawSecs - pl->fQueuedTime) > 60.f /*secs*/)
{ {
char tmp[256], tmp2[256];
if (pl->fQueueTimeResets >= 5) if (pl->fQueueTimeResets >= 5)
{ {
// if this is our fifth time in here then we've been queued // if this is our fifth time in here then we've been queued
@ -671,7 +669,7 @@ void plNetClientMgr::ICheckPendingStateLoad(double secs)
WarningMsg( "Pending state '%s' for object [uoid:%s,key:%s] has been queued for about %f secs. Removing...", WarningMsg( "Pending state '%s' for object [uoid:%s,key:%s] has been queued for about %f secs. Removing...",
pl->fSDRec && pl->fSDRec->GetDescriptor() ? pl->fSDRec->GetDescriptor()->GetName() : "?", pl->fSDRec && pl->fSDRec->GetDescriptor() ? pl->fSDRec->GetDescriptor()->GetName() : "?",
pl->fUoid.StringIze(tmp2), pl->fKey ? pl->fKey->GetUoid().StringIze(tmp) : "?", pl->fUoid.StringIze().c_str(), pl->fKey ? pl->fKey->GetUoid().StringIze().c_str() : "?",
( rawSecs - pl->fQueuedTime ) * pl->fQueueTimeResets); ( rawSecs - pl->fQueuedTime ) * pl->fQueueTimeResets);
delete pl; delete pl;
@ -681,7 +679,7 @@ void plNetClientMgr::ICheckPendingStateLoad(double secs)
WarningMsg( "Pending state '%s' for object [uoid:%s,key:%s] has been queued for about %f secs. %s", WarningMsg( "Pending state '%s' for object [uoid:%s,key:%s] has been queued for about %f secs. %s",
pl->fSDRec && pl->fSDRec->GetDescriptor() ? pl->fSDRec->GetDescriptor()->GetName() : "?", pl->fSDRec && pl->fSDRec->GetDescriptor() ? pl->fSDRec->GetDescriptor()->GetName() : "?",
pl->fUoid.StringIze(tmp2), pl->fKey ? pl->fKey->GetUoid().StringIze(tmp) : "?", pl->fUoid.StringIze().c_str(), pl->fKey ? pl->fKey->GetUoid().StringIze().c_str() : "?",
( rawSecs - pl->fQueuedTime ) * pl->fQueueTimeResets, ( rawSecs - pl->fQueuedTime ) * pl->fQueueTimeResets,
so ? "(not loaded)" : "(not final)" ); so ? "(not loaded)" : "(not final)" );
// reset queue time so we don't spew too many log msgs. // reset queue time so we don't spew too many log msgs.
@ -938,8 +936,7 @@ hsBool plNetClientMgr::MsgReceive( plMessage* msg )
{ {
hsAssert(fAgeSDLObjectKey==nil, "already have a ref to age sdl hook"); hsAssert(fAgeSDLObjectKey==nil, "already have a ref to age sdl hook");
fAgeSDLObjectKey = ref->GetRef()->GetKey(); fAgeSDLObjectKey = ref->GetRef()->GetKey();
char tmp[256]; DebugMsg("Age SDL hook object created, uoid=%s", fAgeSDLObjectKey->GetUoid().StringIze().c_str());
DebugMsg("Age SDL hook object created, uoid=%s", fAgeSDLObjectKey->GetUoid().StringIze(tmp));
} }
else else
{ {
@ -1149,34 +1146,34 @@ bool plNetClientMgr::CanSendMsg(plNetMessage * msg)
// Return the net client (account) name of the player whose avatar // Return the net client (account) name of the player whose avatar
// key is provided. If avKey is nil, returns local client name. // key is provided. If avKey is nil, returns local client name.
// //
const char* plNetClientMgr::GetPlayerName(const plKey avKey) const plString plNetClientMgr::GetPlayerName(const plKey avKey) const
{ {
// local case // local case
if (!avKey || avKey==GetLocalPlayerKey()) if (!avKey || avKey==GetLocalPlayerKey())
return NetCommGetPlayer()->playerNameAnsi; return plString::FromIso8859_1(NetCommGetPlayer()->playerNameAnsi);
plNetTransportMember* mbr=TransportMgr().GetMember(TransportMgr().FindMember(avKey)); plNetTransportMember* mbr=TransportMgr().GetMember(TransportMgr().FindMember(avKey));
return mbr ? mbr->GetPlayerName() : nil; return mbr ? mbr->GetPlayerName() : plString::Null;
} }
const char * plNetClientMgr::GetPlayerNameById (unsigned playerId) const { plString plNetClientMgr::GetPlayerNameById (unsigned playerId) const {
// local case // local case
if (NetCommGetPlayer()->playerInt == playerId) if (NetCommGetPlayer()->playerInt == playerId)
return NetCommGetPlayer()->playerNameAnsi; return plString::FromIso8859_1(NetCommGetPlayer()->playerNameAnsi);
plNetTransportMember * mbr = TransportMgr().GetMember(TransportMgr().FindMember(playerId)); plNetTransportMember * mbr = TransportMgr().GetMember(TransportMgr().FindMember(playerId));
return mbr ? mbr->GetPlayerName() : nil; return mbr ? mbr->GetPlayerName() : plString::Null;
} }
unsigned plNetClientMgr::GetPlayerIdByName (const char name[]) const { unsigned plNetClientMgr::GetPlayerIdByName (const plString & name) const {
// local case // local case
if (0 == StrCmp(name, NetCommGetPlayer()->playerNameAnsi, (unsigned)-1)) if (0 == name.Compare(NetCommGetPlayer()->playerNameAnsi))
NetCommGetPlayer()->playerInt; NetCommGetPlayer()->playerInt;
unsigned n = TransportMgr().GetNumMembers(); unsigned n = TransportMgr().GetNumMembers();
for (unsigned i = 0; i < n; ++i) for (unsigned i = 0; i < n; ++i)
if (plNetTransportMember * member = TransportMgr().GetMember(i)) if (plNetTransportMember * member = TransportMgr().GetMember(i))
if (0 == StrCmp(name, member->GetPlayerName(), (unsigned)-1)) if (0 == name.Compare(member->GetPlayerName()))
return member->GetPlayerID(); return member->GetPlayerID();
return 0; return 0;
} }
@ -1483,10 +1480,9 @@ void plNetClientMgr::AddPendingLoad(PendingLoad *pl)
pl->fKey = hsgResMgr::ResMgr()->FindKey(pl->fUoid); pl->fKey = hsgResMgr::ResMgr()->FindKey(pl->fUoid);
// check for age SDL state // check for age SDL state
char tmp[256];
if (pl->fUoid.GetObjectName() && !strcmp(pl->fUoid.GetObjectName(), plSDL::kAgeSDLObjectName)) if (pl->fUoid.GetObjectName() && !strcmp(pl->fUoid.GetObjectName(), plSDL::kAgeSDLObjectName))
{ {
DebugMsg("Recv SDL state for age hook object, uoid=%s", pl->fUoid.StringIze(tmp)); DebugMsg("Recv SDL state for age hook object, uoid=%s", pl->fUoid.StringIze().c_str());
if (!pl->fKey) if (!pl->fKey)
WarningMsg("Can't find age hook object, nil key!"); WarningMsg("Can't find age hook object, nil key!");
else else
@ -1499,12 +1495,12 @@ void plNetClientMgr::AddPendingLoad(PendingLoad *pl)
if (!pl->fKey->ObjectIsLoaded()) if (!pl->fKey->ObjectIsLoaded())
{ {
WarningMsg("Object %s not loaded, withholding SDL state", WarningMsg("Object %s not loaded, withholding SDL state",
pl->fKey->GetUoid().StringIze(tmp)); pl->fKey->GetUoid().StringIze().c_str());
} }
else if (!pl->fKey->ObjectIsLoaded()->IsFinal()) else if (!pl->fKey->ObjectIsLoaded()->IsFinal())
{ {
WarningMsg("Object %s is not FINAL, withholding SDL state", WarningMsg("Object %s is not FINAL, withholding SDL state",
pl->fKey->GetUoid().StringIze(tmp)); pl->fKey->GetUoid().StringIze().c_str());
} }
} }

6
Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.h

@ -288,9 +288,9 @@ public:
// getters // getters
UInt32 GetPlayerID( void ) const; UInt32 GetPlayerID( void ) const;
const char * GetPlayerName( const plKey avKey=nil ) const; plString GetPlayerName( const plKey avKey=nil ) const;
const char * GetPlayerNameById (unsigned playerId) const; plString GetPlayerNameById (unsigned playerId) const;
unsigned GetPlayerIdByName(const char name[]) const; unsigned GetPlayerIdByName(const plString & name) const;
UInt8 GetJoinOrder() const { return fJoinOrder; } // only valid at join time UInt8 GetJoinOrder() const { return fJoinOrder; } // only valid at join time

3
Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrLoad.cpp

@ -107,8 +107,7 @@ plKey plNetClientMgr::ILoadClone(plLoadCloneMsg *pCloneMsg)
{ {
if (cloneKey->ObjectIsLoaded()) if (cloneKey->ObjectIsLoaded())
{ {
char tmp[256]; DebugMsg("ILoadClone: object %s is already loaded, ignoring", cloneKey->GetUoid().StringIze().c_str());
DebugMsg("ILoadClone: object %s is already loaded, ignoring", cloneKey->GetUoid().StringIze(tmp));
return cloneKey; return cloneKey;
} }

2
Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp

@ -159,7 +159,7 @@ void plNetClientMgr::ISendCCRPetition(plCCRPetitionMsg* petMsg)
char buffy[20]; char buffy[20];
sprintf( buffy, "%lu", GetPlayerID() ); sprintf( buffy, "%lu", GetPlayerID() );
info.AddValue( "Petition", "PlayerID", buffy ); info.AddValue( "Petition", "PlayerID", buffy );
info.AddValue( "Petition", "PlayerName", GetPlayerName() ); info.AddValue( "Petition", "PlayerName", _TEMP_CONVERT_TO_CONST_CHAR(GetPlayerName()) );
// write config info formatted like an ini file to a buffer // write config info formatted like an ini file to a buffer
hsRAMStream ram; hsRAMStream ram;

18
Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrShow.cpp

@ -103,7 +103,7 @@ void plNetClientMgr::IShowLists()
sprintf(str, "%s%s %s p2p=%d dist=%.1f", sprintf(str, "%s%s %s p2p=%d dist=%.1f",
mbr->GetTransportFlags() & plNetTransportMember::kSendingVoice ? "V" : " ", mbr->GetTransportFlags() & plNetTransportMember::kSendingVoice ? "V" : " ",
mbr->GetTransportFlags() & plNetTransportMember::kSendingActions ? "A" : " ", mbr->GetTransportFlags() & plNetTransportMember::kSendingActions ? "A" : " ",
mbr->AsStdString().c_str(), mbr->AsString().c_str(),
mbr->IsPeerToPeer(), mbr->IsPeerToPeer(),
mbr->GetDistSq() != hsScalarMax ? hsSquareRoot(mbr->GetDistSq()) :-1.f); mbr->GetDistSq() != hsScalarMax ? hsSquareRoot(mbr->GetDistSq()) :-1.f);
txt.DrawString(x,y,str); txt.DrawString(x,y,str);
@ -121,7 +121,7 @@ void plNetClientMgr::IShowLists()
y+=yOff; y+=yOff;
for(i=0;i<GetListenList()->GetNumMembers();i++) for(i=0;i<GetListenList()->GetNumMembers();i++)
{ {
sprintf(str, "name=%s", GetListenList()->GetMember(i)->AsStdString().c_str()); sprintf(str, "name=%s", GetListenList()->GetMember(i)->AsString().c_str());
txt.DrawString(x,y,str); txt.DrawString(x,y,str);
y+=yOff; y+=yOff;
} }
@ -133,7 +133,7 @@ void plNetClientMgr::IShowLists()
y+=yOff; y+=yOff;
for(i=0;i<GetTalkList()->GetNumMembers();i++) for(i=0;i<GetTalkList()->GetNumMembers();i++)
{ {
sprintf(str, "name=%s", GetTalkList()->GetMember(i)->AsStdString().c_str()); sprintf(str, "name=%s", GetTalkList()->GetMember(i)->AsString().c_str());
txt.DrawString(x,y,str); txt.DrawString(x,y,str);
y+=yOff; y+=yOff;
} }
@ -231,8 +231,8 @@ void plNetClientMgr::IShowRelevanceRegions()
// //
UInt32 maxPlayerName = 0; UInt32 maxPlayerName = 0;
txt.DrawString(x, y, GetPlayerName()); txt.DrawString(x, y, _TEMP_CONVERT_TO_CONST_CHAR(GetPlayerName()));
maxPlayerName = hsMaximum(maxPlayerName, txt.CalcStringWidth(GetPlayerName())); maxPlayerName = hsMaximum(maxPlayerName, txt.CalcStringWidth(_TEMP_CONVERT_TO_CONST_CHAR(GetPlayerName())));
y += yOff; y += yOff;
int i; int i;
@ -243,9 +243,9 @@ void plNetClientMgr::IShowRelevanceRegions()
if (mbr->IsServer()) if (mbr->IsServer())
continue; continue;
const char* name = mbr->GetPlayerName(); const plString& name = mbr->GetPlayerName();
txt.DrawString(x, y, name); txt.DrawString(x, y, _TEMP_CONVERT_TO_CONST_CHAR(name));
maxPlayerName = hsMaximum(maxPlayerName, txt.CalcStringWidth(name)); maxPlayerName = hsMaximum(maxPlayerName, txt.CalcStringWidth(_TEMP_CONVERT_TO_CONST_CHAR(name)));
y += yOff; y += yOff;
} }
@ -359,7 +359,7 @@ void plNetClientMgr::IShowAvatars()
ori = (player ? player->GetLocalToWorld() * hsVector3(0, -1, 0) : hsVector3(0, 0, 0)); ori = (player ? player->GetLocalToWorld() * hsVector3(0, -1, 0) : hsVector3(0, 0, 0));
sprintf(str, "%s: pos(%.2f, %.2f, %.2f) ori(%.2f, %.2f, %.2f)", sprintf(str, "%s: pos(%.2f, %.2f, %.2f) ori(%.2f, %.2f, %.2f)",
mbr->AsStdString().c_str(), pos.fX, pos.fY, pos.fZ, ori.fX, ori.fY, ori.fZ); mbr->AsString().c_str(), pos.fX, pos.fY, pos.fZ, ori.fX, ori.fY, ori.fZ);
txt.DrawString(x,y,str); txt.DrawString(x,y,str);
y+=yOff; y+=yOff;

2
Sources/Plasma/PubUtilLib/plNetClient/plNetClientMsgHandler.cpp

@ -487,7 +487,7 @@ MSG_HANDLER_DEFN(plNetClientMsgHandler,plNetMsgMembersList)
{ {
plNetTransportMember* mbr = TRACKED_NEW plNetTransportMember(nc); plNetTransportMember* mbr = TRACKED_NEW plNetTransportMember(nc);
IFillInTransportMember(m->MemberListInfo()->GetMember(i), mbr); IFillInTransportMember(m->MemberListInfo()->GetMember(i), mbr);
hsLogEntry(nc->DebugMsg("\tAdding transport member, name=%s, p2p=%d, plrID=%d\n", mbr->AsStdString().c_str(), mbr->IsPeerToPeer(), mbr->GetPlayerID())); hsLogEntry(nc->DebugMsg("\tAdding transport member, name=%s, p2p=%d, plrID=%d\n", mbr->AsString().c_str(), mbr->IsPeerToPeer(), mbr->GetPlayerID()));
int idx=nc->fTransport.AddMember(mbr); int idx=nc->fTransport.AddMember(mbr);
hsAssert(idx>=0, "Failed adding member?"); hsAssert(idx>=0, "Failed adding member?");

46
Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp

@ -932,23 +932,23 @@ UInt8 plNetLinkingMgr::IPreProcessLink(void)
if (!info->HasAgeUserDefinedName()) if (!info->HasAgeUserDefinedName())
{ {
// set user-defined name // set user-defined name
std::string title; plString title;
unsigned nameLen = StrLen(nc->GetPlayerName()); unsigned nameLen = nc->GetPlayerName().GetSize();
if (nc->GetPlayerName()[nameLen - 1] == 's' || nc->GetPlayerName()[nameLen - 1] == 'S') if (nc->GetPlayerName().CharAt(nameLen - 1) == 's' || nc->GetPlayerName().CharAt(nameLen - 1) == 'S')
xtl::format(title, "%s'", nc->GetPlayerName()); title = plString::Format("%s'", nc->GetPlayerName());
else else
xtl::format(title, "%s's", nc->GetPlayerName()); title = plString::Format("%s's", nc->GetPlayerName());
info->SetAgeUserDefinedName(title.c_str()); info->SetAgeUserDefinedName(_TEMP_CONVERT_TO_CONST_CHAR(title));
} }
if (!info->HasAgeDescription()) if (!info->HasAgeDescription())
{ {
// set description // set description
std::string desc; plString desc;
unsigned nameLen = StrLen(nc->GetPlayerName()); unsigned nameLen = nc->GetPlayerName().GetSize();
if (nc->GetPlayerName()[nameLen - 1] == 's' || nc->GetPlayerName()[nameLen - 1] == 'S') if (nc->GetPlayerName().CharAt(nameLen - 1) == 's' || nc->GetPlayerName().CharAt(nameLen - 1) == 'S')
xtl::format(desc, "%s' %s", nc->GetPlayerName(), info->GetAgeInstanceName()); desc = plString::Format("%s' %s", nc->GetPlayerName().c_str(), info->GetAgeInstanceName());
else else
xtl::format(desc, "%s's %s", nc->GetPlayerName(), info->GetAgeInstanceName()); desc = plString::Format("%s's %s", nc->GetPlayerName().c_str(), info->GetAgeInstanceName());
info->SetAgeDescription(desc.c_str()); info->SetAgeDescription(desc.c_str());
} }
if (!info->HasAgeInstanceGuid()) { if (!info->HasAgeInstanceGuid()) {
@ -970,25 +970,25 @@ UInt8 plNetLinkingMgr::IPreProcessLink(void)
if (!info->HasAgeUserDefinedName()) if (!info->HasAgeUserDefinedName())
{ {
// set user-defined name // set user-defined name
std::string title; plString title;
unsigned nameLen = StrLen(nc->GetPlayerName()); unsigned nameLen = nc->GetPlayerName().GetSize();
if (nc->GetPlayerName()[nameLen - 1] == 's' || nc->GetPlayerName()[nameLen - 1] == 'S') if (nc->GetPlayerName().CharAt(nameLen - 1) == 's' || nc->GetPlayerName().CharAt(nameLen - 1) == 'S')
xtl::format(title, "%s'", nc->GetPlayerName()); title = plString::Format("%s'", nc->GetPlayerName().c_str());
else else
xtl::format(title, "%s's", nc->GetPlayerName()); title = plString::Format("%s's", nc->GetPlayerName().c_str());
info->SetAgeUserDefinedName(title.c_str()); info->SetAgeUserDefinedName(_TEMP_CONVERT_TO_CONST_CHAR(title));
} }
if (!info->HasAgeDescription()) if (!info->HasAgeDescription())
{ {
// set description // set description
std::string desc; plString desc;
unsigned nameLen = StrLen(nc->GetPlayerName()); unsigned nameLen = nc->GetPlayerName().GetSize();
if (nc->GetPlayerName()[nameLen - 1] == 's' || nc->GetPlayerName()[nameLen - 1] == 'S') if (nc->GetPlayerName().CharAt(nameLen - 1) == 's' || nc->GetPlayerName().CharAt(nameLen - 1) == 'S')
xtl::format(desc, "%s' %s", nc->GetPlayerName(), info->GetAgeInstanceName()); desc = plString::Format("%s' %s", nc->GetPlayerName().c_str(), info->GetAgeInstanceName());
else else
xtl::format(desc, "%s's %s", nc->GetPlayerName(), info->GetAgeInstanceName()); desc = plString::Format("%s's %s", nc->GetPlayerName().c_str(), info->GetAgeInstanceName());
info->SetAgeDescription( desc.c_str() ); info->SetAgeDescription( _TEMP_CONVERT_TO_CONST_CHAR(desc) );
} }
if (!info->HasAgeInstanceGuid()) { if (!info->HasAgeInstanceGuid()) {

3
Sources/Plasma/PubUtilLib/plNetCommon/plNetMember.h

@ -49,6 +49,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
class plNetApp; class plNetApp;
class plNetGenericServer; class plNetGenericServer;
class plString;
//////////////////////////////// ////////////////////////////////
// A participant (peer) who we can send and recv messages from/to // A participant (peer) who we can send and recv messages from/to
//////////////////////////////// ////////////////////////////////
@ -93,7 +94,7 @@ public:
Int32 GetPeerID() const { return fPeerID; } Int32 GetPeerID() const { return fPeerID; }
UInt32 GetFlags() const { return fFlags; } UInt32 GetFlags() const { return fFlags; }
plNetApp* GetNetApp() { return fNetApp; } plNetApp* GetNetApp() { return fNetApp; }
virtual std::string AsStdString() const = 0; virtual plString AsString() const = 0;
// setters // setters
void SetFlags(UInt32 f) { fFlags=f; } void SetFlags(UInt32 f) { fFlags=f; }

6
Sources/Plasma/PubUtilLib/plNetMessage/plNetMessage.h

@ -331,8 +331,7 @@ public:
// debug // debug
plString AsString() const plString AsString() const
{ {
char tmp[256]; return plString::Format("object=%s, %s",fObjectHelper.GetUoid().StringIze().c_str(), plNetMessage::AsString().c_str());
return plString::Format("object=%s, %s",fObjectHelper.GetUoid().StringIze(tmp), plNetMessage::AsString().c_str());
} }
}; };
@ -558,8 +557,7 @@ public:
// debug // debug
plString AsString() const plString AsString() const
{ {
char tmp[256]; return plString::Format("object=%s initial=%d, %s",fObjectHelper.GetUoid().StringIze().c_str(), fIsInitialState,
return plString::Format("object=%s initial=%d, %s",fObjectHelper.GetUoid().StringIze(tmp), fIsInitialState,
plNetMsgGameMessage::AsString().c_str()); plNetMsgGameMessage::AsString().c_str());
} }
}; };

10
Sources/Plasma/PubUtilLib/plNetTransport/plNetTransport.cpp

@ -61,7 +61,7 @@ int plNetTransport::AddMember(plNetTransportMember* mbr)
if (FindMember(mbr)==-1) if (FindMember(mbr)==-1)
{ {
fMembers.push_back(mbr); fMembers.push_back(mbr);
hsLogEntry( plNetClientMgr::GetInstance()->DebugMsg("Adding member %s", mbr->AsStdString().c_str()) ); hsLogEntry( plNetClientMgr::GetInstance()->DebugMsg("Adding member %s", mbr->AsString().c_str()) );
plNetClientMgr::GetInstance()->GetListenList()->AddMember(mbr); plNetClientMgr::GetInstance()->GetListenList()->AddMember(mbr);
plNetClientMgr::GetInstance()->GetTalkList()->AddMember(mbr); plNetClientMgr::GetInstance()->GetTalkList()->AddMember(mbr);
DumpState(); DumpState();
@ -86,7 +86,7 @@ void plNetTransport::IRemoveMember(plNetTransportMember* mbr)
if (!mbr) if (!mbr)
return; return;
hsLogEntry( plNetClientMgr::GetInstance()->DebugMsg("Removing member %s", mbr->AsStdString().c_str()) ); hsLogEntry( plNetClientMgr::GetInstance()->DebugMsg("Removing member %s", mbr->AsString().c_str()) );
// plNetClientMgr::GetInstance()->GetNetCore()->RemovePeer(mbr->GetPeerID()); // plNetClientMgr::GetInstance()->GetNetCore()->RemovePeer(mbr->GetPeerID());
plNetClientMgr::GetInstance()->GetTalkList()->RemoveMember(mbr); plNetClientMgr::GetInstance()->GetTalkList()->RemoveMember(mbr);
@ -100,7 +100,7 @@ void plNetTransport::IRemoveMember(plNetTransportMember* mbr)
// remove member from master list // remove member from master list
fMembers.erase(it); fMembers.erase(it);
hsLogEntry( plNetClientMgr::GetInstance()->DebugMsg("Done Removing member %s", mbr->AsStdString().c_str()) ); hsLogEntry( plNetClientMgr::GetInstance()->DebugMsg("Done Removing member %s", mbr->AsString().c_str()) );
DumpState(); DumpState();
delete mbr; delete mbr;
@ -319,7 +319,7 @@ void plNetTransport::DumpState()
for(j=0; j<mList->size();j++) for(j=0; j<mList->size();j++)
{ {
plNetTransportMember * mbr = (*mList)[j]; plNetTransportMember * mbr = (*mList)[j];
hsLogEntry( nc->DebugMsg("\t\tMbr %s\n",(*mList)[j]->AsStdString().c_str()) ); hsLogEntry( nc->DebugMsg("\t\tMbr %s\n",(*mList)[j]->AsString().c_str()) );
} }
} }
@ -328,7 +328,7 @@ void plNetTransport::DumpState()
{ {
plNetTransportMember * mbr = GetMember(i); plNetTransportMember * mbr = GetMember(i);
hsLogEntry (nc->DebugMsg("\tMbr %d, name=%s, plyrID=%lu, subs=%d", hsLogEntry (nc->DebugMsg("\tMbr %d, name=%s, plyrID=%lu, subs=%d",
i,mbr->AsStdString().c_str(),mbr->GetPlayerID(),mbr->GetNumSubscriptions()) ); i,mbr->AsString().c_str(),mbr->GetPlayerID(),mbr->GetNumSubscriptions()) );
int j; int j;
for(j=0;j<mbr->GetNumSubscriptions();j++) for(j=0;j<mbr->GetNumSubscriptions();j++)
{ {

4
Sources/Plasma/PubUtilLib/plNetTransport/plNetTransportMember.cpp

@ -73,11 +73,11 @@ int plNetTransportMember::FindSubscription(int chan)
return (it==fSubscriptions.end()) ? -1 : (it-fSubscriptions.begin()); return (it==fSubscriptions.end()) ? -1 : (it-fSubscriptions.begin());
} }
std::string plNetTransportMember::AsStdString() const plString plNetTransportMember::AsString() const
{ {
if (IsServer()) if (IsServer())
{ {
return "(server)"; return _TEMP_CONVERT_FROM_LITERAL("(server)");
} }
else else
{ {

9
Sources/Plasma/PubUtilLib/plNetTransport/plNetTransportMember.h

@ -46,6 +46,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#include "hsStlUtils.h" #include "hsStlUtils.h"
#include "plNetCommon/plNetMember.h" #include "plNetCommon/plNetMember.h"
#include "pnKeyedObject/plKey.h" #include "pnKeyedObject/plKey.h"
#include "plString.h"
// //
// This represents a participant in the game, ie. another // This represents a participant in the game, ie. another
@ -64,7 +65,7 @@ public:
}; };
protected: protected:
plKey fAvatarKey; plKey fAvatarKey;
std::string fPlayerName; plString fPlayerName;
UInt32 fPlayerID; UInt32 fPlayerID;
std::vector<int> fSubscriptions; // list of channelGrp subscriptions std::vector<int> fSubscriptions; // list of channelGrp subscriptions
UInt32 fTransportFlags; UInt32 fTransportFlags;
@ -88,8 +89,8 @@ public:
{ {
fAvatarKey=k; fAvatarKey=k;
} }
void SetPlayerName(const char * value) { fPlayerName=value;} void SetPlayerName(const plString & value) { fPlayerName=value;}
const char * GetPlayerName() const { return fPlayerName.c_str();} plString GetPlayerName() const { return fPlayerName;}
void SetPlayerID(UInt32 value) { fPlayerID=value;} void SetPlayerID(UInt32 value) { fPlayerID=value;}
UInt32 GetPlayerID() const { return fPlayerID;} UInt32 GetPlayerID() const { return fPlayerID;}
void SetIsServer(bool value) { (value)?SetFlags(GetFlags()|kIsServer):SetFlags(GetFlags()&!kIsServer);} void SetIsServer(bool value) { (value)?SetFlags(GetFlags()|kIsServer):SetFlags(GetFlags()&!kIsServer);}
@ -108,7 +109,7 @@ public:
UInt32 GetTransportFlags() const { return fTransportFlags; } UInt32 GetTransportFlags() const { return fTransportFlags; }
bool IsPeerToPeer() const { return hsCheckBits(fFlags, kRequestP2P); } bool IsPeerToPeer() const { return hsCheckBits(fFlags, kRequestP2P); }
std::string AsStdString() const; plString AsString() const;
bool IsEqualTo(const plNetMember * other) const bool IsEqualTo(const plNetMember * other) const
{ {
const plNetTransportMember * o = plNetTransportMember::ConvertNoRef(other); const plNetTransportMember * o = plNetTransportMember::ConvertNoRef(other);

7
Sources/Plasma/PubUtilLib/plResMgr/plResManager.cpp

@ -314,8 +314,7 @@ hsBool plResManager::ReadObject(plKeyImp* key)
// it will just inc/dec the open/close count during its read, and not actually // it will just inc/dec the open/close count during its read, and not actually
// close the stream, so we don't lose our place, lose our file handle, and thrash. // close the stream, so we don't lose our place, lose our file handle, and thrash.
char locstr[64]; kResMgrLog(4, ILog(4, " ...Opening page data stream for location %s...", key->GetUoid().GetLocation().StringIze().c_str()));
kResMgrLog(4, ILog(4, " ...Opening page data stream for location %s...", key->GetUoid().GetLocation().StringIze(locstr)));
plRegistryPageNode *pageNode = FindPage(key->GetUoid().GetLocation()); plRegistryPageNode *pageNode = FindPage(key->GetUoid().GetLocation());
if (!pageNode) if (!pageNode)
{ {
@ -1576,14 +1575,14 @@ static void sIReportLeak(plKeyImp* key, plRegistryPageNode* page)
if (refsLeft == 0) if (refsLeft == 0)
return; return;
char tempStr[256], tempStr2[128]; char tempStr2[128];
if (key->ObjectIsLoaded() == nil) if (key->ObjectIsLoaded() == nil)
sprintf(tempStr2, "(key only, %d refs left)", refsLeft); sprintf(tempStr2, "(key only, %d refs left)", refsLeft);
else else
sprintf(tempStr2, "- %d bytes - %d refs left", key->GetDataLen(), refsLeft); sprintf(tempStr2, "- %d bytes - %d refs left", key->GetDataLen(), refsLeft);
hsStatusMessageF(" %s: %s %s\n", plFactory::GetNameOfClass(key->GetUoid().GetClassType()), hsStatusMessageF(" %s: %s %s\n", plFactory::GetNameOfClass(key->GetUoid().GetClassType()),
key->GetUoid().StringIze(tempStr), tempStr2); key->GetUoid().StringIze().c_str(), tempStr2);
} }
//// UnloadPageObjects /////////////////////////////////////////////////////// //// UnloadPageObjects ///////////////////////////////////////////////////////

2
Sources/Tools/plResBrowser/plResTreeView.cpp

@ -396,7 +396,7 @@ void plResTreeView::UpdateInfoDlg( HWND treeCtrl )
SetDlgItemText( fInfoDlg, IDC_AGE, pageInfo.GetAge() ); SetDlgItemText( fInfoDlg, IDC_AGE, pageInfo.GetAge() );
SetDlgItemText( fInfoDlg, IDC_PAGE, pageInfo.GetPage() ); SetDlgItemText( fInfoDlg, IDC_PAGE, pageInfo.GetPage() );
SetDlgItemText( fInfoDlg, IDC_LOCATION, pageInfo.GetLocation().StringIze( tempStr ) ); SetDlgItemText( fInfoDlg, IDC_LOCATION, pageInfo.GetLocation().StringIze().c_str() );
CheckDlgButton(fInfoDlg, IDC_RESERVED, (pageInfo.GetLocation().GetFlags() & plLocation::kReserved) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(fInfoDlg, IDC_RESERVED, (pageInfo.GetLocation().GetFlags() & plLocation::kReserved) ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(fInfoDlg, IDC_BUILTIN, (pageInfo.GetLocation().GetFlags() & plLocation::kBuiltIn) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(fInfoDlg, IDC_BUILTIN, (pageInfo.GetLocation().GetFlags() & plLocation::kBuiltIn) ? BST_CHECKED : BST_UNCHECKED);

Loading…
Cancel
Save