From 1a0420127c13e8ad70f80f720bd802166072ab3b Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Sun, 25 May 2014 14:34:00 -0700 Subject: [PATCH] Provide some plFormat samples with floats/doubles --- Sources/Plasma/CoreLib/plFileSystem.cpp | 4 ++-- .../Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp | 6 +++--- Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp | 2 +- Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.cpp | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Sources/Plasma/CoreLib/plFileSystem.cpp b/Sources/Plasma/CoreLib/plFileSystem.cpp index 8d223d11..9a318cde 100644 --- a/Sources/Plasma/CoreLib/plFileSystem.cpp +++ b/Sources/Plasma/CoreLib/plFileSystem.cpp @@ -556,9 +556,9 @@ plString plFileSystem::ConvertFileSize(uint64_t size) float decimal = static_cast(last_div) / 1024.f; // Kilobytes are so small that we only care about whole numbers if (i < 1) - return plString::Format("%.0f %s", decimal, labels[i]); + return plFormat("{.0f} {}", decimal, labels[i]); else - return plString::Format("%.2f %s", decimal, labels[i]); + return plFormat("{.2f} {}", decimal, labels[i]); } last_div = my_div; } diff --git a/Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp b/Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp index 16c21527..0517fe9c 100644 --- a/Sources/Plasma/FeatureLib/pfConsole/pfDispatchLog.cpp +++ b/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(kNoCommand); - info = plString::Format("Type: %s Str: %s User: %s(%d) Delay: %f Int: %d", + info = plFormat("Type: {} Str: {} User: {}({}) Delay: {} Int: {}", typeName, - kiMsg->GetString().c_str("(nil)"), - kiMsg->GetUser().c_str("(nil)"), + kiMsg->GetString(), + kiMsg->GetUser(), kiMsg->GetPlayerID(), kiMsg->GetDelay(), kiMsg->GetIntValue()); diff --git a/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp b/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp index 15c26c4d..021ed081 100644 --- a/Sources/Plasma/FeatureLib/pfPython/cyMisc.cpp +++ b/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) { // 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 plControlEventMsg* pMsg = new plControlEventMsg; diff --git a/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.cpp b/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.cpp index ed36367d..3f80b997 100644 --- a/Sources/Plasma/PubUtilLib/plAvatar/plAvTaskSeek.cpp +++ b/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) { - 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, fPosition.fX, fPosition.fY, fPosition.fZ, fSeekPos.fX, fSeekPos.fY, fSeekPos.fZ)); 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, fDistance, fAngForward, fAngRight)); 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)); y += lineHeight; } @@ -583,17 +583,17 @@ void plAvTaskSeek::DumpToAvatarLog(plArmatureMod *avatar) plStatusLog *log = plAvatarMgr::GetInstance()->GetLog(); 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, fPosition.fX, fPosition.fY, fPosition.fZ, 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, fGoalVec.fX, fGoalVec.fY, fGoalVec.fZ, 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, fMaxSidleAngle, fMaxSidleRange, fMinFwdAngle).c_str()); }