Browse Source

Provide some plFormat samples with floats/doubles

Michael Hansen 10 years ago
parent
commit
1a0420127c
  1. 4
      Sources/Plasma/CoreLib/plFileSystem.cpp
  2. 6
      Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp
  3. 2
      Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp
  4. 12
      Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.cpp

4
Sources/Plasma/CoreLib/plFileSystem.cpp

@ -556,9 +556,9 @@ plString plFileSystem::ConvertFileSize(uint64_t size)
float decimal = static_cast<float>(last_div) / 1024.f; float decimal = static_cast<float>(last_div) / 1024.f;
// Kilobytes are so small that we only care about whole numbers // Kilobytes are so small that we only care about whole numbers
if (i < 1) if (i < 1)
return plString::Format("%.0f %s", decimal, labels[i]); return plFormat("{.0f} {}", decimal, labels[i]);
else else
return plString::Format("%.2f %s", decimal, labels[i]); return plFormat("{.2f} {}", decimal, labels[i]);
} }
last_div = my_div; last_div = my_div;
} }

6
Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp

@ -257,10 +257,10 @@ static bool DumpSpecificMsgInfo(plMessage* msg, plString& info)
PrintKIType(kGZFlashUpdate); // flash an update without saving (for animation of GZFill in) PrintKIType(kGZFlashUpdate); // flash an update without saving (for animation of GZFill in)
PrintKIType(kNoCommand); PrintKIType(kNoCommand);
info = plString::Format("Type: %s Str: %s User: %s(%d) Delay: %f Int: %d", info = plFormat("Type: {} Str: {} User: {}({}) Delay: {} Int: {}",
typeName, typeName,
kiMsg->GetString().c_str("(nil)"), kiMsg->GetString(),
kiMsg->GetUser().c_str("(nil)"), kiMsg->GetUser(),
kiMsg->GetPlayerID(), kiMsg->GetPlayerID(),
kiMsg->GetDelay(), kiMsg->GetDelay(),
kiMsg->GetIntValue()); kiMsg->GetIntValue());

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

@ -1566,7 +1566,7 @@ void cyMisc::FogSetDefExp2(float end, float density)
void cyMisc::SetClearColor(float red, float green, float blue) void cyMisc::SetClearColor(float red, float green, float blue)
{ {
// do this command via the console to keep the maxplugins from barfing // do this command via the console to keep the maxplugins from barfing
plString command = plString::Format("Graphics.Renderer.SetClearColor %f %f %f", red, green, blue); plString command = plFormat("Graphics.Renderer.SetClearColor {f} {f} {f}", red, green, blue);
// create message to send to the console // create message to send to the console
plControlEventMsg* pMsg = new plControlEventMsg; plControlEventMsg* pMsg = new plControlEventMsg;

12
Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.cpp

@ -563,17 +563,17 @@ bool plAvTaskSeek::IUpdateObjective(plArmatureMod *avatar)
// ---------- // ----------
void plAvTaskSeek::DumpDebug(const char *name, int &x, int&y, int lineHeight, plDebugText &debugTxt) void plAvTaskSeek::DumpDebug(const char *name, int &x, int&y, int lineHeight, plDebugText &debugTxt)
{ {
debugTxt.DrawString(x, y, plString::Format("duration: %.2f pos: (%.3f, %.3f, %.3f) goalPos: (%.3f, %.3f, %.3f) ", debugTxt.DrawString(x, y, plFormat("duration: {.2f} pos: ({.3f}, {.3f}, {.3f}) goalPos: ({.3f}, {.3f}, {.3f}) ",
hsTimer::GetSysSeconds() - fStartTime, hsTimer::GetSysSeconds() - fStartTime,
fPosition.fX, fPosition.fY, fPosition.fZ, fSeekPos.fX, fSeekPos.fY, fSeekPos.fZ)); fPosition.fX, fPosition.fY, fPosition.fZ, fSeekPos.fX, fSeekPos.fY, fSeekPos.fZ));
y += lineHeight; y += lineHeight;
debugTxt.DrawString(x, y, plString::Format("positioning: %d rotating %d goalVec: (%.3f, %.3f, %.3f) dist: %.3f angFwd: %.3f angRt: %.3f", debugTxt.DrawString(x, y, plFormat("positioning: {} rotating {} goalVec: ({.3f}, {.3f}, {.3f}) dist: {.3f} angFwd: {.3f} angRt: {.3f}",
fStillPositioning, fStillRotating, fGoalVec.fX, fGoalVec.fY, fGoalVec.fZ, fStillPositioning, fStillRotating, fGoalVec.fX, fGoalVec.fY, fGoalVec.fZ,
fDistance, fAngForward, fAngRight)); fDistance, fAngForward, fAngRight));
y += lineHeight; y += lineHeight;
debugTxt.DrawString(x, y, plString::Format(" distFwd: %.3f distRt: %.3f shufRange: %.3f sidAngle: %.3f sidRange: %.3f, fMinWalk: %.3f", debugTxt.DrawString(x, y, plFormat(" distFwd: {.3f} distRt: {.3f} shufRange: {.3f} sidAngle: {.3f} sidRange: {.3f}, fMinWalk: {.3f}",
fDistForward, fDistRight, fShuffleRange, fMaxSidleAngle, fMaxSidleRange, fMinFwdAngle)); fDistForward, fDistRight, fShuffleRange, fMaxSidleAngle, fMaxSidleRange, fMinFwdAngle));
y += lineHeight; y += lineHeight;
} }
@ -583,17 +583,17 @@ void plAvTaskSeek::DumpToAvatarLog(plArmatureMod *avatar)
plStatusLog *log = plAvatarMgr::GetInstance()->GetLog(); plStatusLog *log = plAvatarMgr::GetInstance()->GetLog();
log->AddLine(avatar->GetMoveKeyString().c_str()); log->AddLine(avatar->GetMoveKeyString().c_str());
log->AddLine(plString::Format(" duration: %.2f pos: (%.3f, %.3f, %.3f) goalPos: (%.3f, %.3f, %.3f) ", log->AddLine(plFormat(" duration: {.2f} pos: ({.3f}, {.3f}, {.3f}) goalPos: ({.3f}, {.3f}, {.3f}) ",
hsTimer::GetSysSeconds() - fStartTime, hsTimer::GetSysSeconds() - fStartTime,
fPosition.fX, fPosition.fY, fPosition.fZ, fPosition.fX, fPosition.fY, fPosition.fZ,
fSeekPos.fX, fSeekPos.fY, fSeekPos.fZ).c_str()); fSeekPos.fX, fSeekPos.fY, fSeekPos.fZ).c_str());
log->AddLine(plString::Format(" positioning: %d rotating %d goalVec: (%.3f, %.3f, %.3f) dist: %.3f angFwd: %.3f angRt: %.3f", log->AddLine(plFormat(" positioning: {} rotating {} goalVec: ({.3f}, {.3f}, {.3f}) dist: {.3f} angFwd: {.3f} angRt: {.3f}",
fStillPositioning, fStillRotating, fStillPositioning, fStillRotating,
fGoalVec.fX, fGoalVec.fY, fGoalVec.fZ, fGoalVec.fX, fGoalVec.fY, fGoalVec.fZ,
fDistance, fAngForward, fAngRight).c_str()); fDistance, fAngForward, fAngRight).c_str());
log->AddLine(plString::Format(" distFwd: %.3f distRt: %.3f shufRange: %.3f sidAngle: %.3f sidRange: %.3f, fMinWalk: %.3f", log->AddLine(plFormat(" distFwd: {.3f} distRt: {.3f} shufRange: {.3f} sidAngle: {.3f} sidRange: {.3f}, fMinWalk: {.3f}",
fDistForward, fDistRight, fShuffleRange, fDistForward, fDistRight, fShuffleRange,
fMaxSidleAngle, fMaxSidleRange, fMinFwdAngle).c_str()); fMaxSidleAngle, fMaxSidleRange, fMinFwdAngle).c_str());
} }

Loading…
Cancel
Save