Browse Source

Fix additional issues from review

Michael Hansen 12 years ago
parent
commit
3e92022db2
  1. 16
      Sources/Plasma/CoreLib/hsStream.cpp
  2. 7
      Sources/Plasma/NucleusLib/pnKeyedObject/plKeyImp.cpp
  3. 4
      Sources/Plasma/NucleusLib/pnKeyedObject/plMsgForwarder.cpp
  4. 2
      Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.cpp
  5. 6
      Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.cpp
  6. 4
      Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.h
  7. 2
      Sources/Plasma/PubUtilLib/plAvatar/plAGChannel.cpp
  8. 2
      Sources/Plasma/PubUtilLib/plAvatar/plMultistageBehMod.cpp
  9. 10
      Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp
  10. 2
      Sources/Plasma/PubUtilLib/plDrawable/plInstanceDrawInterface.cpp
  11. 8
      Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.cpp
  12. 6
      Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp
  13. 3
      Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.h
  14. 4
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp
  15. 6
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp
  16. 4
      Sources/Plasma/PubUtilLib/plSurface/hsGMaterial.cpp
  17. 1
      Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp
  18. 2
      Sources/Tools/MaxConvert/hsConverterUtils.cpp
  19. 2
      Sources/Tools/MaxConvert/hsMaterialConverter.cpp

16
Sources/Plasma/CoreLib/hsStream.cpp

@ -146,12 +146,12 @@ uint32_t hsStream::WriteSafeStringLong(const plString &string)
if (len > 0)
{
const char *buffp = string.c_str();
int i;
uint32_t i;
for (i = 0; i < len; i++)
{
WriteByte(~buffp[i]);
}
return static_cast<uint32_t>(i);
return i;
}
else
return 0;
@ -164,9 +164,8 @@ uint32_t hsStream::WriteSafeWStringLong(const plString &string)
WriteLE32(len);
if (len > 0)
{
int i;
const wchar_t *buffp = wbuff.GetData();
for (i=0; i<len; i++)
for (uint32_t i=0; i<len; i++)
{
WriteLE16((uint16_t)~buffp[i]);
}
@ -229,13 +228,13 @@ uint32_t hsStream::WriteSafeString(const plString &string)
WriteLE16(len | 0xf000);
if (len > 0)
{
int i;
uint32_t i;
const char *buffp = string.c_str();
for (i = 0; i < len; i++)
{
WriteByte(~buffp[i]);
}
return static_cast<uint32_t>(i);
return i;
}
else
return 0;
@ -244,16 +243,15 @@ uint32_t hsStream::WriteSafeString(const plString &string)
uint32_t hsStream::WriteSafeWString(const plString &string)
{
plStringBuffer<wchar_t> wbuff = string.ToWchar();
int len = wbuff.GetSize();
uint32_t len = wbuff.GetSize();
hsAssert(len<0xf000, xtl::format("string len of %d is too long for WriteSafeWString, use WriteSafeWStringLong",
len).c_str() );
WriteLE16(len | 0xf000);
if (len > 0)
{
int i;
const wchar_t *buffp = wbuff.GetData();
for (i=0; i<len; i++)
for (uint32_t i=0; i<len; i++)
{
WriteLE16((uint16_t)~buffp[i]);
}

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

@ -68,7 +68,7 @@ static uint16_t kClassType = CLASS_INDEX_SCOPED(plSceneNode);
static uint32_t kCloneID = 0;
bool IsTrackedKey(const plKeyImp* key)
{
return (strcmp(key->GetName(), kObjName) == 0) &&
return (key->GetName() == kObjName) &&
key->GetUoid().GetClassType() == kClassType &&
key->GetUoid().GetCloneID() == kCloneID;
}
@ -348,7 +348,7 @@ void plKeyImp::AddNotifyCreated(plRefMsg* msg, plRefFlags::Type flags)
#ifdef LOG_ACTIVE_REFS
if (IsTrackedKey(this))
{
hsStatusMessageF("@@@ %s(%s) adding active ref to %s (%d total)", msg->GetReceiver(0)->GetName(),
hsStatusMessageF("@@@ %s(%s) adding active ref to %s (%d total)", msg->GetReceiver(0)->GetName().c_str(),
plFactory::GetNameOfClass(msg->GetReceiver(0)->GetUoid().GetClassType()), kObjName, fNumActiveRefs+1);
}
#endif // LOG_ACTIVE_REFS
@ -635,7 +635,8 @@ void plKeyImp::IRelease(plKeyImp* iTargetKey)
// it has been notified it is going away.
#ifdef LOG_ACTIVE_REFS
if (isActive && IsTrackedKey(iTargetKey))
hsStatusMessageF("@@@ %s(%s) releasing active ref on %s (%d total)", GetName(), plFactory::GetNameOfClass(GetUoid().GetClassType()), kObjName, iTargetKey->fNumActiveRefs-1);
hsStatusMessageF("@@@ %s(%s) releasing active ref on %s (%d total)", GetName().c_str(),
plFactory::GetNameOfClass(GetUoid().GetClassType()), kObjName, iTargetKey->fNumActiveRefs-1);
#endif // LOG_ACTIVE_REFS
if (isActive && iTargetKey->GetActiveRefs() && !iTargetKey->DecActiveRefs())

4
Sources/Plasma/NucleusLib/pnKeyedObject/plMsgForwarder.cpp

@ -142,13 +142,13 @@ bool plMsgForwarder::IForwardCallbackMsg(plMessage *msg)
#if 0
hsStatusMessageF("Adding CBMsg, eventSender=%s, eventRemoteMsg=%d\n",
event->GetSender() ? event->GetSender()->GetName() : "nil", fc->fNetPropogate);
event->GetSender() ? event->GetSender()->GetName().c_str() : "nil", fc->fNetPropogate);
#endif
}
}
#if 0
hsStatusMessageF("Fwding CBMsg, sender=%s, remoteMsg=%d",
msg->GetSender() ? msg->GetSender()->GetName() : "nil", msg->HasBCastFlag(plMessage::kNetNonLocal));
msg->GetSender() ? msg->GetSender()->GetName().c_str() : "nil", msg->HasBCastFlag(plMessage::kNetNonLocal));
#endif
IForwardMsg(callbackMsg);

2
Sources/Plasma/NucleusLib/pnModifier/plLogicModBase.cpp

@ -275,7 +275,7 @@ void plLogicModBase::UnTrigger()
#ifdef HS_DEBUGGING
char str[256];
sprintf(str, "LogicModifier %s is Un-triggering, activatorType=%d\n",
GetKeyName(), HasFlag(kTypeActivator));
GetKeyName().c_str(), HasFlag(kTypeActivator));
plNetClientApp::GetInstance()->DebugMsg(str);
#endif
fNotify->SetSender(this->GetKey());

6
Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.cpp

@ -78,8 +78,8 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
//
/////////////////////////////////////////////////////////////////////////////////////////
#ifdef TRACK_AG_ALLOCS
extern const char *gGlobalAnimName = nil;
extern const char *gGlobalChannelName = nil;
plString gGlobalAnimName;
plString gGlobalChannelName;
#endif // TRACK_AG_ALLOCS
/////////////////////////////////////////////////////////////////////////////////////////
@ -172,7 +172,7 @@ plAGAnimInstance::plAGAnimInstance(plAGAnim * anim, plAGMasterMod * master,
fFadeBlend = fFadeAmp = false;
#ifdef TRACK_AG_ALLOCS
gGlobalAnimName = nil;
gGlobalAnimName = "";
#endif // TRACK_AG_ALLOCS
}

4
Sources/Plasma/PubUtilLib/plAvatar/plAGAnimInstance.h

@ -261,8 +261,8 @@ protected:
//#endif
#ifdef TRACK_AG_ALLOCS
extern const char *gGlobalAnimName;
extern const char *gGlobalChannelName;
extern plString gGlobalAnimName;
extern plString gGlobalChannelName;
void RegisterAGAlloc(plAGChannel *object, const char *chanName, const char *animName, uint16_t classIndex);
void UnRegisterAGAlloc(plAGChannel *object);

2
Sources/Plasma/PubUtilLib/plAvatar/plAGChannel.cpp

@ -61,7 +61,7 @@ plAGChannel::plAGChannel()
{
#ifdef TRACK_AG_ALLOCS
fName = gGlobalAnimName;
RegisterAGAlloc(this, gGlobalChannelName, gGlobalAnimName, this->ClassIndex());
RegisterAGAlloc(this, gGlobalChannelName.c_str(), gGlobalAnimName.c_str(), this->ClassIndex());
#endif // TRACK_AG_ALLOCS
}

2
Sources/Plasma/PubUtilLib/plAvatar/plMultistageBehMod.cpp

@ -161,7 +161,7 @@ bool plMultistageBehMod::MsgReceive(plMessage* msg)
#ifdef DEBUG_MULTISTAGE
char sbuf[256];
sprintf(sbuf,"plMultistageModMsg - starting multistage from %s",sender->GetName());
sprintf(sbuf,"plMultistageModMsg - starting multistage from %s",sender->GetName().c_str());
plAvatarMgr::GetInstance()->GetLog()->AddLine(sbuf);
#endif
plAvSeekMsg *seeker = new plAvSeekMsg(nil, avModKey, seekKey, 1.0f, fSmartSeek);

10
Sources/Plasma/PubUtilLib/plDrawable/plDrawableSpansExport.cpp

@ -197,7 +197,7 @@ void plDrawableSpans::Write( hsStream* s, hsResMgr* mgr )
hsUNIXStream log;
log.Open("log\\GBuf.log", "ab");
char buf[256];
sprintf(buf, "Drawable Span: %s, GroupNum: %u\r\n", GetKeyName(), i);
sprintf(buf, "Drawable Span: %s, GroupNum: %u\r\n", GetKeyName().c_str(), i);
log.WriteString(buf);
log.Close();
#endif
@ -387,7 +387,7 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan*
statusLog->AddLineF("From obj <%s> mat <%s> size %d bytes grp=%d (%d offset)",
geo->fMaxOwner.c_str("<unknown>"),
geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "<unknown>",
geo->fMaterial ? geo->fMaterial->GetKeyName().c_str() : "<unknown>",
geo->GetVertexSize(geo->fFormat) * geo->fNumVerts + sizeof(uint16_t) * geo->fNumIndices,
span->fGroupIdx,
ptr
@ -405,7 +405,7 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan*
{
statusLog->AddLineF("Instanced obj <%s> mat <%s> grp=%d (%d/%d/%d/%d/%d/%d/%d/%d)",
geo->fMaxOwner.c_str("<unknown>"),
geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "<unknown>",
geo->fMaterial ? geo->fMaterial->GetKeyName().c_str() : "<unknown>",
span->fGroupIdx,
span->fVBufferIdx,
span->fCellIdx,
@ -424,7 +424,7 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan*
{
statusLog->AddLineF("From obj <%s> mat <%s> size %d bytes grp=%d (%d/%d/%d/%d/%d)",
geo->fMaxOwner.c_str("<unknown>"),
geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "<unknown>",
geo->fMaterial ? geo->fMaterial->GetKeyName().c_str() : "<unknown>",
geo->GetVertexSize(geo->fFormat) * geo->fNumVerts + sizeof(uint16_t) * geo->fNumIndices,
span->fGroupIdx,
span->fVBufferIdx,
@ -438,7 +438,7 @@ static void ILogSpan(plStatusLog* statusLog, plGeometrySpan* geo, plVertexSpan*
{
statusLog->AddLineF("Instanced obj <%s> mat <%s> grp=%d (%d/%d/%d/%d/%d)",
geo->fMaxOwner.c_str("<unknown>"),
geo->fMaterial ? geo->fMaterial->GetKey()->GetName().c_str() : "<unknown>",
geo->fMaterial ? geo->fMaterial->GetKeyName().c_str() : "<unknown>",
span->fGroupIdx,
span->fVBufferIdx,
span->fCellIdx,

2
Sources/Plasma/PubUtilLib/plDrawable/plInstanceDrawInterface.cpp

@ -114,7 +114,7 @@ void plInstanceDrawInterface::AddSharedMesh(plSharedMesh *mesh, hsGMaterial *mat
#ifdef MF_NOSHADOW_ACC
// TESTHACKERY FOLLOWS - GlassesNoShadow
uint32_t noShadHack = 0;
if( mesh->GetKey() && (strstr(mesh->GetKey()->GetName(), "lasses") || strstr(mesh->GetKey()->GetName(), "oggles")) )
if( mesh->GetKey() && (mesh->GetKey()->GetName().Find("lasses") >= 0 || mesh->GetKey()->GetName().Find("oggles") >= 0) )
noShadHack = plGeometrySpan::kPropNoShadowCast;
#endif // MF_NOSHADOW_ACC

8
Sources/Plasma/PubUtilLib/plDrawable/plProxyGen.cpp

@ -158,8 +158,8 @@ hsGMaterial* plProxyGen::IMakeProxyMaterial() const
hsGMaterial* retVal = new hsGMaterial();
plString buff;
if( !GetKey()->GetName().IsNull() )
buff = plString::Format("%s_Material", GetKey()->GetName().c_str());
if( !GetKeyName().IsNull() )
buff = plString::Format("%s_Material", GetKeyName().c_str());
else
buff = "ProxyMaterial";
hsgResMgr::ResMgr()->NewKey( buff, retVal, GetKey() ? GetKey()->GetUoid().GetLocation() : plLocation::kGlobalFixedLoc );
@ -233,8 +233,8 @@ void plProxyGen::IGenerateProxy()
if( fProxyDrawables[idx] && !fProxyDrawables[idx]->GetKey() )
{
plString buff;
if( !GetKey()->GetName().IsNull() )
buff = plString::Format("%s_ProxyDrawable", GetKey()->GetName().c_str());
if( !GetKeyName().IsNull() )
buff = plString::Format("%s_ProxyDrawable", GetKeyName().c_str());
else
buff = "ProxyDrawable";

6
Sources/Plasma/PubUtilLib/plInputCore/plInputDevice.cpp

@ -292,12 +292,12 @@ void plMouseDevice::IUpdateCursorSize()
}
}
void plMouseDevice::AddNameToCursor(const char* name)
void plMouseDevice::AddNameToCursor(const plString& name)
{
if (fInstance && name)
if (fInstance && !name.IsNull())
{
plDebugText &txt = plDebugText::Instance();
txt.DrawString(fInstance->fWXPos + 12 ,fInstance->fWYPos - 7,name);
txt.DrawString(fInstance->fWXPos + 12 ,fInstance->fWYPos - 7,name.c_str());
}
}
void plMouseDevice::AddCCRToCursor()

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

@ -188,8 +188,7 @@ public:
static void SetCursorOpacity( float opacity = 1.f );
static bool GetInverted() { return plMouseDevice::bInverted; }
static void SetInverted(bool inverted) { plMouseDevice::bInverted = inverted; }
static void AddNameToCursor(const char* name);
static void AddNameToCursor(const plString& name) { AddNameToCursor(name); }
static void AddNameToCursor(const plString& name);
static void AddIDNumToCursor(uint32_t idNum);
static void AddCCRToCursor();

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

@ -1457,8 +1457,8 @@ bool plNetClientMgr::IFindModifier(plSynchedObject* obj, int16_t classIdx)
cnt++;
}
hsAssert(cnt<2, xtl::format("Object %s has multiple SDL modifiers of the same kind (%s)?",
obj->GetKeyName(), plFactory::GetNameOfClass(classIdx)).c_str());
hsAssert(cnt<2, plString::Format("Object %s has multiple SDL modifiers of the same kind (%s)?",
obj->GetKeyName().c_str(), plFactory::GetNameOfClass(classIdx)).c_str());
return cnt==0 ? false : true;
}

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

@ -396,9 +396,9 @@ int plNetClientMgr::ISendGameMessage(plMessage* msg)
{
#if 0
hsLogEntry(plNetObjectDebugger::GetInstance()->LogMsg(
xtl::format("<SND> object:%s, rcvr %s %s",
msg->GetSender(),
msg->GetNumReceivers() ? msg->GetReceiver(0)->GetName() : "?",
plString::Format("<SND> object:%s, rcvr %s %s",
msg->GetSender().GetKeyName().c_str(),
msg->GetNumReceivers() ? msg->GetReceiver(0)->GetName().c_str() : "?",
netMsgWrap->AsStdString().c_str()).c_str()));
#endif
}

4
Sources/Plasma/PubUtilLib/plSurface/hsGMaterial.cpp

@ -133,8 +133,8 @@ plLayer* hsGMaterial::MakeBaseLayer()
hsAssert(GetKey(), "All materials need a key (or temp key)");
plString buff;
if( !GetKey()->GetName().IsNull() )
buff = plString::Format("%s_Layer", GetKey()->GetName().c_str());
if( !GetKeyName().IsNull() )
buff = plString::Format("%s_Layer", GetKeyName().c_str());
else
buff = "Layer";
hsgResMgr::ResMgr()->NewKey( buff, newLay, GetKey() != nil ? GetKey()->GetUoid().GetLocation() : plLocation::kGlobalFixedLoc );

1
Sources/Plasma/PubUtilLib/plUnifiedTime/plUnifiedTime.cpp

@ -40,6 +40,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
*==LICENSE==*/
#include <float.h>
#include <cmath>
#include "plUnifiedTime.h"
#include "hsStlUtils.h"

2
Sources/Tools/MaxConvert/hsConverterUtils.cpp

@ -346,7 +346,7 @@ INode* hsConverterUtils::FindINodeFromKeyedObject(hsKeyedObject* obj)
{
hsGuardBegin("hsConverterUtils::FindINodeFromKeyedObject");
INode* retVal = FindINodeFromMangledName(obj->GetKey()->GetName().c_str());
INode* retVal = FindINodeFromMangledName(obj->GetKeyName().c_str());
if( retVal )
return (retVal);

2
Sources/Tools/MaxConvert/hsMaterialConverter.cpp

@ -4951,7 +4951,7 @@ void hsMaterialConverter::IPrintDoneMat(hsStream* stream, const char* prefix, Do
stream->WriteString(buff);
sprintf(buff, "\t\t\tTexture %s\n", layer->GetTexture() && layer->GetTexture()->GetKey()
? layer->GetTexture()->GetKey()->GetName().c_str("None")
? layer->GetTexture()->GetKeyName().c_str("None")
: "None");
stream->WriteString(buff);

Loading…
Cancel
Save