Browse Source

Fix the rest of the plString::Format calls

Michael Hansen 10 years ago
parent
commit
5c6b6bbc7c
  1. 10
      Sources/Plasma/FeatureLib/pfAnimation/plAnimDebugList.cpp
  2. 12
      Sources/Plasma/FeatureLib/pfAudio/plListener.cpp
  3. 5
      Sources/Plasma/NucleusLib/pnDispatch/plDispatch.cpp
  4. 2
      Sources/Plasma/NucleusLib/pnNetCommon/plGenericVar.cpp
  5. 11
      Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp
  6. 5
      Sources/Plasma/PubUtilLib/plAvatar/plAvBehaviors.cpp
  7. 2
      Sources/Plasma/PubUtilLib/plAvatar/plAvBrainHuman.cpp
  8. 4
      Sources/Plasma/PubUtilLib/plAvatar/plAvBrainSwim.cpp
  9. 8
      Sources/Plasma/PubUtilLib/plContainer/plKeysAndValues.cpp
  10. 2
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgr.cpp
  11. 8
      Sources/Plasma/PubUtilLib/plNetClient/plNetClientMgrSend.cpp
  12. 10
      Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp
  13. 21
      Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSDLModifier.cpp
  14. 6
      Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp
  15. 13
      Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp
  16. 4
      Sources/Tools/MaxConvert/plBitmapCreator.cpp

10
Sources/Plasma/FeatureLib/pfAnimation/plAnimDebugList.cpp

@ -123,10 +123,10 @@ void plAnimDebugList::ShowReport()
plLayerAnimation *layerAnim = plLayerAnimation::ConvertNoRef(layer);
if (layerAnim)
{
str = plString::Format("%s: %s %.3f (%.3f)", mat->GetKeyName().c_str(), layerAnim->GetKeyName().c_str(),
str = plFormat("{}: {} {.3f} ({.3f})", mat->GetKeyName(), layerAnim->GetKeyName(),
layerAnim->GetTimeConvert().CurrentAnimTime(),
layerAnim->GetTimeConvert().WorldToAnimTimeNoUpdate(hsTimer::GetSysSeconds()));
txt.DrawString(x, y, str.c_str());
txt.DrawString(x, y, str);
y += yOff;
}
layer = layer->GetOverLay();
@ -148,16 +148,16 @@ void plAnimDebugList::ShowReport()
continue;
str = plFormat(" {}", so->GetKeyName());
txt.DrawString(x, y, str.c_str());
txt.DrawString(x, y, str);
y += yOff;
for (j = 0; j < mod->GetNumATCAnimations(); j++)
{
plAGAnimInstance *anim = mod->GetATCAnimInstance(j);
str = plString::Format(" %s: %.3f (%.3f)", anim->GetAnimation()->GetName().c_str(),
str = plFormat(" {}: {.3f} ({.3f})", anim->GetAnimation()->GetName(),
anim->GetTimeConvert()->CurrentAnimTime(),
anim->GetTimeConvert()->WorldToAnimTimeNoUpdate(hsTimer::GetSysSeconds()));
txt.DrawString(x, y, str.c_str());
txt.DrawString(x, y, str);
y += yOff;
}
}

12
Sources/Plasma/FeatureLib/pfAudio/plListener.cpp

@ -183,19 +183,23 @@ bool plListener::IEval(double secs, float del, uint32_t dirty)
if( fPrintDbgInfo )
{
plString str;
str = plString::Format( "Direction: (%3.2f,%3.2f,%3.2f) from %s", dir.fX, dir.fY, dir.fZ, ( facingType == kObject ) ? pRefObject->GetKey()->GetUoid().GetObjectName().c_str() : "VCam" );
str = plFormat("Direction: ({3.2f},{3.2f},{3.2f}) from {}", dir.fX, dir.fY, dir.fZ,
(facingType == kObject) ? pRefObject->GetKeyName() : "VCam");
plDebugText::Instance().DrawString( x, y, str.c_str(), (uint32_t)0xffffffff );
y += 12;
str = plString::Format( "Up: (%3.2f,%3.2f,%3.2f) from %s", up.fX, up.fY, up.fZ, ( facingType == kObject ) ? pRefObject->GetKey()->GetUoid().GetObjectName().c_str() : "VCam" );
str = plFormat("Up: ({3.2f},{3.2f},{3.2f}) from {}", up.fX, up.fY, up.fZ,
(facingType == kObject) ? pRefObject->GetKeyName() : "VCam");
plDebugText::Instance().DrawString( x, y, str.c_str(), (uint32_t)0xffffffff );
y += 12;
str = plString::Format( "Position: (%3.2f,%3.2f,%3.2f) from %s", position.fX, position.fY, position.fZ, ( posType == kObject ) ? pRefObject->GetKey()->GetUoid().GetObjectName().c_str() : "VCam" );
str = plFormat("Position: ({3.2f},{3.2f},{3.2f}) from {}", position.fX, position.fY, position.fZ,
(posType == kObject) ? pRefObject->GetKeyName() : "VCam");
plDebugText::Instance().DrawString( x, y, str.c_str(), (uint32_t)0xffffffff );
y += 12;
str = plString::Format( "Velocity: (%3.2f,%3.2f,%3.2f) from %s", velocity.fX, velocity.fY, velocity.fZ, ( velType == kObject ) ? pRefObject->GetKey()->GetUoid().GetObjectName().c_str() : "VCam" );
str = plFormat("Velocity: ({3.2f},{3.2f},{3.2f}) from {}", velocity.fX, velocity.fY, velocity.fZ,
(velType == kObject) ? pRefObject->GetKeyName() : "VCam");
plDebugText::Instance().DrawString( x, y, str.c_str(), (uint32_t)0xffffffff );
y += 12;
}

5
Sources/Plasma/NucleusLib/pnDispatch/plDispatch.cpp

@ -335,8 +335,9 @@ void plDispatch::IMsgDispatch()
if (plNetObjectDebuggerBase::GetInstance()->IsDebugObject(ko))
{
hsLogEntry(plNetObjectDebuggerBase::GetInstance()->LogMsg(
plString::Format("<RCV> object:%s, GameMessage %s st=%.3f rt=%.3f",
ko->GetKeyName().c_str(), msg->ClassName(), hsTimer::GetSysSeconds(), hsTimer::GetSeconds()).c_str()));
plFormat("<RCV> object:{}, GameMessage {} st={.3f} rt={.3f}",
ko->GetKeyName(), msg->ClassName(), hsTimer::GetSysSeconds(),
hsTimer::GetSeconds()).c_str()));
}
}
}

2
Sources/Plasma/NucleusLib/pnNetCommon/plGenericVar.cpp

@ -244,7 +244,7 @@ plString plGenericType::GetAsString() const
return plFormat("{}", fU);
case kFloat :
case kDouble :
return plString::Format("%f", fType==kDouble?fD:fF);
return plFormat("{f}", fType==kDouble ? fD : fF);
case kChar :
return plFormat("{}", fC);
case kAny :

11
Sources/Plasma/PubUtilLib/plAvatar/plArmatureMod.cpp

@ -2664,9 +2664,8 @@ void plArmatureMod::DumpToDebugDisplay(int &x, int &y, int lineHeight, plDebugTe
hsMatrix44 l2w = SO->GetLocalToWorld();
hsPoint3 worldPos = l2w.GetTranslate();
const char *opaque = IsOpaque() ? "yes" : "no";
debugTxt.DrawString(x, y, plString::Format("position(world): %.2f, %.2f, %.2f Opaque: %3s",
worldPos.fX, worldPos.fY, worldPos.fZ, opaque));
debugTxt.DrawString(x, y, plFormat("position(world): {.2f}, {.2f}, {.2f} Opaque: {>3}",
worldPos.fX, worldPos.fY, worldPos.fZ, IsOpaque() ? "yes" : "no"));
y += lineHeight;
const char* frozen = "n.a.";
@ -2687,8 +2686,8 @@ void plArmatureMod::DumpToDebugDisplay(int &x, int &y, int lineHeight, plDebugTe
hsPoint3 physPos;
GetPositionAndRotationSim(&physPos, nil);
const hsVector3& vel = fController->GetLinearVelocity();
details = plString::Format("position(physical): <%.2f, %.2f, %.2f> velocity: <%5.2f, %5.2f, %5.2f>",
physPos.fX, physPos.fY, physPos.fZ, vel.fX, vel.fY, vel.fZ);
details = plFormat("position(physical): <{.2f}, {.2f}, {.2f}> velocity: <{5.2f}, {5.2f}, {5.2f}>",
physPos.fX, physPos.fY, physPos.fZ, vel.fX, vel.fY, vel.fZ);
}
else
{
@ -2796,7 +2795,7 @@ void plArmatureMod::DebugDumpMoveKeys(int &x, int &y, int lineHeight, plDebugTex
plAvatarInputInterface::GetInstance()->GetInputMapName()));
y += lineHeight;
debugTxt.DrawString(x, y, plString::Format("Turn strength: %.2f (key: %.2f, analog: %.2f)",
debugTxt.DrawString(x, y, plFormat("Turn strength: {.2f} (key: {.2f}, analog: {.2f})",
GetTurnStrength(), GetKeyTurnStrength(), GetAnalogTurnStrength()));
y += lineHeight;

5
Sources/Plasma/PubUtilLib/plAvatar/plAvBehaviors.cpp

@ -105,16 +105,15 @@ void plArmatureBehavior::DumpDebug(int &x, int &y, int lineHeight, plDebugText &
{
float strength = GetStrength();
const char *onOff = strength > 0 ? "on" : "off";
char blendBar[11] = "||||||||||";
char blendBar[] = "||||||||||";
int bars = (int)min(10 * strength, 10);
blendBar[bars] = '\0';
plString details;
if (fAnim)
{
plString animName = fAnim->GetName();
float time = fAnim->GetTimeConvert()->CurrentAnimTime();
details = plString::Format("%20s %3s time: %5.2f %s", animName.c_str(), onOff, time, blendBar);
details = plFormat("{>20} {>3} time: {5.2f} {}", fAnim->GetName(), onOff, time, blendBar);
}
else
details = plFormat(" Behavior {2} {>3} {}", fIndex, onOff, blendBar);

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

@ -903,7 +903,7 @@ void plAvBrainHuman::DumpToDebugDisplay(int &x, int &y, int lineHeight, plDebugT
const char *grounded = fWalkingStrategy->IsOnGround() ? "yes" : "no";
const char *pushing = (fWalkingStrategy->GetPushingPhysical() ? (fWalkingStrategy->GetFacingPushingPhysical() ? "facing" : "behind") : "none");
debugTxt.DrawString(x, y, plString::Format("Ground: %3s, AirTime: %5.2f (Peak: %5.2f), PushingPhys: %6s",
debugTxt.DrawString(x, y, plFormat("Ground: {>3}, AirTime: {5.2f} (Peak: {5.2f}), PushingPhys: {>6}",
grounded, fWalkingStrategy->GetAirTime(), fWalkingStrategy->GetImpactTime(), pushing));
y += lineHeight;

4
Sources/Plasma/PubUtilLib/plAvatar/plAvBrainSwim.cpp

@ -619,11 +619,11 @@ void plAvBrainSwim::DumpToDebugDisplay(int &x, int &y, int lineHeight, plDebugTe
y += lineHeight;
float buoy = fSwimStrategy ? fSwimStrategy->GetBuoyancy() : 0.0f;
debugTxt.DrawString(x, y, plString::Format("Distance to surface: %f Buoyancy: %f", fSurfaceDistance, buoy));
debugTxt.DrawString(x, y, plFormat("Distance to surface: {f} Buoyancy: {f}", fSurfaceDistance, buoy));
y += lineHeight;
hsVector3 linV = fAvMod->GetController()->GetAchievedLinearVelocity();
debugTxt.DrawString(x, y, plString::Format("Linear Velocity: (%5.2f, %5.2f, %5.2f)", linV.fX, linV.fY, linV.fZ));
debugTxt.DrawString(x, y, plFormat("Linear Velocity: ({5.2f}, {5.2f}, {5.2f})", linV.fX, linV.fY, linV.fZ));
y += lineHeight;
int i;

8
Sources/Plasma/PubUtilLib/plContainer/plKeysAndValues.cpp

@ -92,7 +92,7 @@ bool plKeysAndValues::KeyHasValue(const plString & key, int value)
bool plKeysAndValues::KeyHasValue(const plString & key, double value)
{
return KeyHasValue(key, plString::Format("%f", value));
return KeyHasValue(key, plFormat("{f}", value));
}
bool plKeysAndValues::AddValue(const plString & key, const plString & value, KAddValueMode mode)
@ -121,7 +121,7 @@ bool plKeysAndValues::AddValue(const plString & key, int value, KAddValueMode mo
bool plKeysAndValues::AddValue(const plString & key, double value, KAddValueMode mode)
{
return AddValue(key, plString::Format("%f", value), mode);
return AddValue(key, plFormat("{f}", value), mode);
}
bool plKeysAndValues::AddValues(const plString & key, const std::vector<plString> & values, KAddValueMode mode)
@ -144,7 +144,7 @@ bool plKeysAndValues::SetValue(const plString & key, int value)
bool plKeysAndValues::SetValue(const plString & key, double value)
{
return SetValue(key, plString::Format("%f", value));
return SetValue(key, plFormat("{f}", value));
}
plString plKeysAndValues::GetValue(const plString & key, const plString & defval, bool * outFound) const
@ -170,7 +170,7 @@ int plKeysAndValues::GetValue(const plString & key, int defval, bool * outFound)
double plKeysAndValues::GetValue(const plString & key, double defval, bool * outFound) const
{
return GetValue(key, plString::Format("%f", defval), outFound).ToDouble();
return GetValue(key, plFormat("{f}", defval), outFound).ToDouble();
}
std::vector<plString> plKeysAndValues::GetAllValues(const plString & key)

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

@ -279,7 +279,7 @@ bool plNetClientMgr::Log(const char* str) const
return true;
// prepend raw time
plString buf2 = plString::Format("%.2f %s", hsTimer::GetSeconds(), ProcessTab(str));
plString buf2 = plFormat("{.2f} {}", hsTimer::GetSeconds(), ProcessTab(str));
if ( GetConsoleOutput() )
hsStatusMessage(buf2.c_str());

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

@ -393,10 +393,10 @@ int plNetClientMgr::ISendGameMessage(plMessage* msg)
{
#if 0
hsLogEntry(plNetObjectDebugger::GetInstance()->LogMsg(
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()));
plFormat("<SND> object:{}, rcvr {} {}",
msg->GetSender().GetKeyName(),
msg->GetNumReceivers() ? msg->GetReceiver(0)->GetName() : "?",
netMsgWrap->AsStdString()).c_str()));
#endif
}

10
Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp

@ -858,7 +858,7 @@ void plPXPhysicalControllerCore::IDrawDebugDisplay(int controllerIdx)
{
y = 10;
debugString = plFormat("Controller Count: {}", gControllers.size());
debugTxt.DrawString(x, y, debugString.c_str());
debugTxt.DrawString(x, y, debugString);
y += lineHeight;
}
@ -868,7 +868,7 @@ void plPXPhysicalControllerCore::IDrawDebugDisplay(int controllerIdx)
{
debugString = plFormat("Controller #{} ({}) Collisions:",
controllerIdx + 1, gControllers[controllerIdx]->fOwner->GetName());
debugTxt.DrawString(x, y, debugString.c_str());
debugTxt.DrawString(x, y, debugString);
y += lineHeight;
for (int i = 0; i < collisionCount; i++)
@ -876,11 +876,11 @@ void plPXPhysicalControllerCore::IDrawDebugDisplay(int controllerIdx)
hsVector3 normal = fDbgCollisionInfo[i].fNormal;
const char* overlapStr = fDbgCollisionInfo[i].fOverlap ? "yes" : "no";
float angle = hsRadiansToDegrees(acos(normal * hsVector3(0, 0, 1)));
debugString = plString::Format("\tObj: %s, Normal: (%.2f, %.2f, %.2f), Angle(%.1f), Overlap(%s)",
fDbgCollisionInfo[i].fSO->GetKeyName().c_str(),
debugString = plFormat("\tObj: {}, Normal: ({.2f}, {.2f}, {.2f}), Angle({.1f}), Overlap({})",
fDbgCollisionInfo[i].fSO->GetKeyName(),
normal.fX, normal.fY, normal.fZ, angle,
overlapStr);
debugTxt.DrawString(x, y, debugString.c_str());
debugTxt.DrawString(x, y, debugString);
y += lineHeight;
}
}

21
Sources/Plasma/PubUtilLib/plPhysical/plPhysicalSDLModifier.cpp

@ -215,29 +215,30 @@ void plPhysicalSDLModifier::ILogState(const plStateDataRecord* state, bool useDi
plPhysical* phys = IGetPhysical();
plString log = plFormat("{}: {}", phys->GetKeyName(), prefix);
plStringStream log;
log << phys->GetKeyName() << ": " << prefix;
if (isPosSet)
log += plString::Format(" Pos=%.1f %.1f %.1f", pos.fX, pos.fY, pos.fZ);
log << plFormat(" Pos={.1f} {.1f} {.1f}", pos.fX, pos.fY, pos.fZ);
else
log += " Pos=None";
log << " Pos=None";
if (isLinVSet)
log += plString::Format(" LinV=%.1f %.1f %.1f", linV.fX, linV.fY, linV.fZ);
log << plFormat(" LinV={.1f} {.1f} {.1f}", linV.fX, linV.fY, linV.fZ);
else
log += " LinV=None";
log << " LinV=None";
if (isAngVSet)
log += plString::Format(" AngV=%.1f %.1f %.1f", angV.fX, angV.fY, angV.fZ);
log << plFormat(" AngV={.1f} {.1f} {.1f}", angV.fX, angV.fY, angV.fZ);
else
log += " AngV=None";
log << " AngV=None";
if (isRotSet)
log += plString::Format(" Rot=%.1f %.1f %.1f %.1f", rot.fX, rot.fY, rot.fZ, rot.fW);
log << plFormat(" Rot={.1f} {.1f} {.1f} {.1f}", rot.fX, rot.fY, rot.fZ, rot.fW);
else
log += " Rot=None";
log << " Rot=None";
IGetLog()->AddLine(log.c_str(), color);
IGetLog()->AddLine(log.GetString().c_str(), color);
}
plStatusLog* plPhysicalSDLModifier::IGetLog()

6
Sources/Plasma/PubUtilLib/plSDL/plStateVariable.cpp

@ -437,14 +437,14 @@ plString plSimpleStateVariable::GetAsString(int idx) const
else if (type==plVarDescriptor::kByte)
str << fBy[i++];
else if (type==plVarDescriptor::kFloat || type==plVarDescriptor::kAgeTimeOfDay)
str << plString::Format( "%.3f", fF[i++]);
str << plFormat("{.3f}", fF[i++]);
else if (type==plVarDescriptor::kDouble)
str << plString::Format( "%.3f", fD[i++]);
str << plFormat("{.3f}", fD[i++]);
else if (type==plVarDescriptor::kTime)
{
double tmp;
Get(&tmp, i++);
str << plString::Format( "%.3f", tmp);
str << plFormat("{.3f}", tmp);
}
if (j==fVar.GetAtomicCount()-1)

13
Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp

@ -715,21 +715,22 @@ bool plStatusLog::IPrintLineToFile( const char *line, uint32_t count )
}
if ( fFlags & kDebugOutput )
plString out_str = plString::FromUtf8(line, count) + "\n";
if (fFlags & kDebugOutput)
{
#if HS_BUILD_FOR_WIN32
#ifndef PLASMA_EXTERNAL_RELEASE
plString str = plString::Format( "%.*s\n", count, line );
OutputDebugString( str.c_str() );
OutputDebugString(out_str.c_str());
#endif
#else
fprintf( stderr, "%.*s\n", count, line );
fputs(str.c_str(), str);
#endif
}
if ( fFlags & kStdout )
if (fFlags & kStdout)
{
fprintf( stdout, "%.*s\n", count, line );
fputs(out_str.c_str(), stdout);
}
return ret;

4
Sources/Tools/MaxConvert/plBitmapCreator.cpp

@ -538,11 +538,11 @@ plBitmap *plBitmapCreator::ICreateTexture( plBitmapData *bd, const plLocation &l
{
// Mangle of the form: name@dropStart&dropStop&max&min
if( clipID != -1 )
name = plString::Format( "%s*%x#%d@%s&%3.2f&%3.2f&%3.2f&%3.2f", temp.c_str(), bd->texFlags, clipID,
name = plFormat("{}*{x}#{}@{}&{3.2f}&{3.2f}&{3.2f}&{3.2f}", temp, bd->texFlags, clipID,
bd->createFlags & plMipmap::kCreateDetailAlpha ? "al" : ( bd->createFlags & plMipmap::kCreateDetailAdd ? "ad" : "mu" ),
bd->detailDropoffStart, bd->detailDropoffStop, bd->detailMax, bd->detailMin );
else
name = plString::Format( "%s*%x@%s&%3.2f&%3.2f&%3.2f&%3.2f", temp.c_str(), bd->texFlags,
name = plFormat("{}*{x}@{}&{3.2f}&{3.2f}&{3.2f}&{3.2f}", temp, bd->texFlags,
bd->createFlags & plMipmap::kCreateDetailAlpha ? "al" : ( bd->createFlags == plMipmap::kCreateDetailAdd ? "ad" : "mu" ),
bd->detailDropoffStart, bd->detailDropoffStop, bd->detailMax, bd->detailMin );
}

Loading…
Cancel
Save