mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
Some additional sprintf and std::string cleanup
This commit is contained in:
@ -256,12 +256,12 @@ plAGAnimInstance * plAnimStage::Attach(plArmatureMod *armature, plArmatureBrain
|
||||
fAnimInstance->SetCurrentTime(fLocalTime);
|
||||
#ifdef DEBUG_MULTISTAGE
|
||||
char sbuf[256];
|
||||
snprintf(sbuf, sizeof(sbuf), "AnimStage::Attach - attaching stage %s", fAnimName.c_str());
|
||||
snprintf(sbuf, arrsize(sbuf), "AnimStage::Attach - attaching stage %s", fAnimName.c_str());
|
||||
plAvatarMgr::GetInstance()->GetLog()->AddLine(sbuf);
|
||||
#endif
|
||||
} else {
|
||||
char buf[256];
|
||||
snprintf(buf, sizeof(buf), "Can't find animation <%s> for animation stage. Anything could happen.", fAnimName.c_str());
|
||||
snprintf(buf, arrsize(buf), "Can't find animation <%s> for animation stage. Anything could happen.", fAnimName.c_str());
|
||||
hsAssert(false, buf);
|
||||
#ifdef DEBUG_MULTISTAGE
|
||||
plAvatarMgr::GetInstance()->GetLog()->AddLine(buf);
|
||||
@ -328,7 +328,7 @@ bool plAnimStage::Detach(plArmatureMod *armature)
|
||||
|
||||
#ifdef DEBUG_MULTISTAGE
|
||||
char sbuf[256];
|
||||
snprintf(sbuf, sizeof(sbuf), "AnimStage::Detach - detaching stage %s", fAnimName.c_str());
|
||||
snprintf(sbuf, arrsize(sbuf), "AnimStage::Detach - detaching stage %s", fAnimName.c_str());
|
||||
plAvatarMgr::GetInstance()->GetLog()->AddLine(sbuf);
|
||||
#endif
|
||||
// hsStatusMessageF("Detaching plAnimStage <%s>", fAnimName.c_str());
|
||||
|
@ -2800,41 +2800,41 @@ void plAvBoneMap::AddBoneMapping(uint32_t boneID, const plSceneObject *SO)
|
||||
|
||||
void plArmatureMod::DebugDumpMoveKeys(int &x, int &y, int lineHeight, plDebugText &debugTxt)
|
||||
{
|
||||
char buff[256];
|
||||
snprintf(buff, sizeof(buff), "Mouse Input Map: %s", plAvatarInputInterface::GetInstance()->GetInputMapName());
|
||||
debugTxt.DrawString(x, y, buff);
|
||||
debugTxt.DrawString(x, y, plString::Format("Mouse Input Map: %s",
|
||||
plAvatarInputInterface::GetInstance()->GetInputMapName()));
|
||||
y += lineHeight;
|
||||
|
||||
snprintf(buff, sizeof(buff), "Turn strength: %.2f (key: %.2f, analog: %.2f)",
|
||||
GetTurnStrength(), GetKeyTurnStrength(), GetAnalogTurnStrength());
|
||||
debugTxt.DrawString(x, y, buff);
|
||||
debugTxt.DrawString(x, y, plString::Format("Turn strength: %.2f (key: %.2f, analog: %.2f)",
|
||||
GetTurnStrength(), GetKeyTurnStrength(), GetAnalogTurnStrength()));
|
||||
y += lineHeight;
|
||||
|
||||
GetMoveKeyString(buff);
|
||||
debugTxt.DrawString(x, y, buff);
|
||||
debugTxt.DrawString(x, y, GetMoveKeyString());
|
||||
y += lineHeight;
|
||||
}
|
||||
|
||||
void plArmatureMod::GetMoveKeyString(char *buff)
|
||||
plString plArmatureMod::GetMoveKeyString() const
|
||||
{
|
||||
sprintf(buff, "Move keys: ");
|
||||
plStringStream keys;
|
||||
keys << "Move keys: ";
|
||||
|
||||
if(FastKeyDown())
|
||||
strcat(buff, "FAST ");
|
||||
keys << "FAST ";
|
||||
if(StrafeKeyDown())
|
||||
strcat(buff, "STRAFE ");
|
||||
keys << "STRAFE ";
|
||||
if(ForwardKeyDown())
|
||||
strcat(buff, "FORWARD ");
|
||||
keys << "FORWARD ";
|
||||
if(BackwardKeyDown())
|
||||
strcat(buff, "BACKWARD ");
|
||||
keys << "BACKWARD ";
|
||||
if(TurnLeftKeyDown())
|
||||
strcat(buff, "TURNLEFT ");
|
||||
keys << "TURNLEFT ";
|
||||
if(TurnRightKeyDown())
|
||||
strcat(buff, "TURNRIGHT ");
|
||||
keys << "TURNRIGHT ";
|
||||
if(StrafeLeftKeyDown())
|
||||
strcat(buff, "STRAFELEFT ");
|
||||
keys << "STRAFELEFT ";
|
||||
if(StrafeRightKeyDown())
|
||||
strcat(buff, "STRAFERIGHT ");
|
||||
keys << "STRAFERIGHT ";
|
||||
if(JumpKeyDown())
|
||||
strcat(buff, "JUMP ");
|
||||
keys << "JUMP ";
|
||||
|
||||
return keys.GetString();
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ public:
|
||||
void SetTurnRightKeyDown(bool status = true);
|
||||
void SetJumpKeyDown();
|
||||
void DebugDumpMoveKeys(int &x, int &y, int lineHeight, plDebugText &debugTxt);
|
||||
void GetMoveKeyString(char *buff);
|
||||
plString GetMoveKeyString() const;
|
||||
|
||||
void SynchIfLocal(double timeNow, int force); // Just physical state
|
||||
void SynchInputState(uint32_t rcvID = kInvalidPlayerID);
|
||||
|
@ -922,23 +922,23 @@ void plAvBrainClimb::DumpToDebugDisplay(int &x, int &y, int lineHeight, plDebugT
|
||||
// --------------------
|
||||
void plAvBrainClimb::IDumpClimbDirections(int &x, int &y, int lineHeight, plDebugText &debugTxt)
|
||||
{
|
||||
const char * prolog = "Allowed directions: ";
|
||||
std::string str;
|
||||
static const char prolog[] = "Allowed directions: ";
|
||||
plStringStream str;
|
||||
|
||||
str = prolog;
|
||||
str << prolog;
|
||||
if(fAllowedDirections & plClimbMsg::kUp)
|
||||
str = str + "UP ";
|
||||
str << "UP ";
|
||||
if(fAllowedDirections & plClimbMsg::kDown)
|
||||
str = str + "DOWN ";
|
||||
str << "DOWN ";
|
||||
if(fAllowedDirections & plClimbMsg::kLeft)
|
||||
str = str + "LEFT ";
|
||||
str << "LEFT ";
|
||||
if(fAllowedDirections & plClimbMsg::kRight)
|
||||
str = str + "RIGHT ";
|
||||
str << "RIGHT ";
|
||||
|
||||
if(str.size() == strlen(prolog))
|
||||
str = str + "- NONE -";
|
||||
if(str.GetLength() == strlen(prolog))
|
||||
str << "- NONE -";
|
||||
|
||||
debugTxt.DrawString(x, y, str.c_str());
|
||||
debugTxt.DrawString(x, y, str.GetString());
|
||||
y += lineHeight;
|
||||
}
|
||||
|
||||
@ -946,49 +946,49 @@ void plAvBrainClimb::IDumpClimbDirections(int &x, int &y, int lineHeight, plDebu
|
||||
// -----------------------
|
||||
void plAvBrainClimb::IDumpDismountDirections(int &x, int &y, int lineHeight, plDebugText &debugTxt)
|
||||
{
|
||||
const char * prolog = "Enabled dismounts: ";
|
||||
std::string str;
|
||||
static const char prolog[] = "Enabled dismounts: ";
|
||||
plStringStream str;
|
||||
|
||||
str = prolog;
|
||||
str << prolog;
|
||||
if(fAllowedDismounts & plClimbMsg::kUp)
|
||||
str = str + "UP ";
|
||||
str << "UP ";
|
||||
if(fAllowedDismounts & plClimbMsg::kDown)
|
||||
str = str + "DOWN ";
|
||||
str << "DOWN ";
|
||||
if(fAllowedDismounts & plClimbMsg::kLeft)
|
||||
str = str + "LEFT ";
|
||||
str << "LEFT ";
|
||||
if(fAllowedDismounts & plClimbMsg::kRight)
|
||||
str = str + "RIGHT ";
|
||||
str << "RIGHT ";
|
||||
|
||||
if(str.size() == strlen(prolog))
|
||||
str = str + "- NONE -";
|
||||
if(str.GetLength() == strlen(prolog))
|
||||
str << "- NONE -";
|
||||
|
||||
debugTxt.DrawString(x, y, str.c_str());
|
||||
debugTxt.DrawString(x, y, str.GetString());
|
||||
y += lineHeight;
|
||||
}
|
||||
|
||||
void plAvBrainClimb::IDumpBlockedDirections(int &x, int &y, int lineHeight, plDebugText &debugTxt)
|
||||
{
|
||||
const char * prolog = "Physically blocked: ";
|
||||
std::string str;
|
||||
static const char prolog[] = "Physically blocked: ";
|
||||
plStringStream str;
|
||||
|
||||
str = prolog;
|
||||
str << prolog;
|
||||
if(fOldPhysicallyBlockedDirections & plClimbMsg::kUp)
|
||||
str = str + "UP ";
|
||||
str << "UP ";
|
||||
if(fOldPhysicallyBlockedDirections & plClimbMsg::kDown)
|
||||
str = str + "DOWN ";
|
||||
str << "DOWN ";
|
||||
if(fOldPhysicallyBlockedDirections & plClimbMsg::kLeft)
|
||||
str = str + "LEFT ";
|
||||
str << "LEFT ";
|
||||
if(fOldPhysicallyBlockedDirections & plClimbMsg::kRight)
|
||||
str = str + "RIGHT ";
|
||||
str << "RIGHT ";
|
||||
|
||||
if(str.size() == strlen(prolog))
|
||||
str = str + "- NONE -";
|
||||
if(str.GetLength() == strlen(prolog))
|
||||
str << "- NONE -";
|
||||
|
||||
debugTxt.DrawString(x, y, str.c_str());
|
||||
debugTxt.DrawString(x, y, str.GetString());
|
||||
y += lineHeight;
|
||||
}
|
||||
|
||||
const char * plAvBrainClimb::WorldDirStr(plClimbMsg::Direction dir)
|
||||
const char *plAvBrainClimb::WorldDirStr(plClimbMsg::Direction dir)
|
||||
{
|
||||
switch(dir)
|
||||
{
|
||||
|
@ -104,8 +104,8 @@ public:
|
||||
virtual void LoadFromSDL(const plStateDataRecord *sdl);
|
||||
|
||||
void DumpToDebugDisplay(int &x, int &y, int lineHeight, plDebugText &debugTxt);
|
||||
const char * WorldDirStr(plClimbMsg::Direction dir);
|
||||
const char *ModeStr(Mode mode);
|
||||
static const char *WorldDirStr(plClimbMsg::Direction dir);
|
||||
static const char *ModeStr(Mode mode);
|
||||
|
||||
// plasma protocol
|
||||
virtual bool MsgReceive(plMessage *msg);
|
||||
|
@ -576,22 +576,21 @@ void plAvTaskSeek::DumpDebug(const char *name, int &x, int&y, int lineHeight, pl
|
||||
void plAvTaskSeek::DumpToAvatarLog(plArmatureMod *avatar)
|
||||
{
|
||||
plStatusLog *log = plAvatarMgr::GetInstance()->GetLog();
|
||||
char strBuf[256];
|
||||
avatar->GetMoveKeyString(strBuf);
|
||||
log->AddLine(strBuf);
|
||||
log->AddLine(avatar->GetMoveKeyString().c_str());
|
||||
|
||||
sprintf(strBuf, " duration: %.2f pos: (%.3f, %.3f, %.3f) goalPos: (%.3f, %.3f, %.3f) ",
|
||||
log->AddLine(plString::Format(" 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);
|
||||
log->AddLine(strBuf);
|
||||
|
||||
sprintf(strBuf, " positioning: %d rotating %d goalVec: (%.3f, %.3f, %.3f) dist: %.3f angFwd: %.3f angRt: %.3f",
|
||||
fStillPositioning, fStillRotating, fGoalVec.fX, fGoalVec.fY, fGoalVec.fZ, fDistance, fAngForward, fAngRight);
|
||||
log->AddLine(strBuf);
|
||||
fPosition.fX, fPosition.fY, fPosition.fZ,
|
||||
fSeekPos.fX, fSeekPos.fY, fSeekPos.fZ).c_str());
|
||||
|
||||
sprintf(strBuf, " distFwd: %.3f distRt: %.3f shufRange: %.3f sidAngle: %.3f sidRange: %.3f, fMinWalk: %.3f",
|
||||
fDistForward, fDistRight, fShuffleRange, fMaxSidleAngle, fMaxSidleRange, fMinFwdAngle);
|
||||
log->AddLine(strBuf);
|
||||
log->AddLine(plString::Format(" positioning: %d rotating %d 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",
|
||||
fDistForward, fDistRight, fShuffleRange,
|
||||
fMaxSidleAngle, fMaxSidleRange, fMinFwdAngle).c_str());
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -84,9 +84,7 @@ HRESULT hsGDirect3DTnLEnumerate::SelectFromDevMode(const hsG3DDeviceRecord* devR
|
||||
}
|
||||
}
|
||||
}
|
||||
char errStr[256];
|
||||
|
||||
sprintf(errStr, "Can't find requested device - %s:%s:%s:%s:%s",
|
||||
plString errStr = plString::Format("Can't find requested device - %s:%s:%s:%s:%s",
|
||||
devRec->GetG3DDeviceTypeName(),
|
||||
devRec->GetDriverDesc().c_str(),
|
||||
devRec->GetDriverName().c_str(),
|
||||
|
@ -89,7 +89,6 @@ set(MaxComponent_HEADERS
|
||||
plVolumeGadgetComponent.h
|
||||
plWaterComponent.h
|
||||
plXImposter.h
|
||||
WavFileStructs.h
|
||||
)
|
||||
|
||||
set(MaxComponent_RESOURCES
|
||||
|
@ -1,41 +0,0 @@
|
||||
/*==LICENSE==*
|
||||
|
||||
CyanWorlds.com Engine - MMOG client, server and tools
|
||||
Copyright (C) 2011 Cyan Worlds, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Additional permissions under GNU GPL version 3 section 7
|
||||
|
||||
If you modify this Program, or any covered work, by linking or
|
||||
combining it with any of RAD Game Tools Bink SDK, Autodesk 3ds Max SDK,
|
||||
NVIDIA PhysX SDK, Microsoft DirectX SDK, OpenSSL library, Independent
|
||||
JPEG Group JPEG library, Microsoft Windows Media SDK, or Apple QuickTime SDK
|
||||
(or a modified version of those libraries),
|
||||
containing parts covered by the terms of the Bink SDK EULA, 3ds Max EULA,
|
||||
PhysX SDK EULA, DirectX SDK EULA, OpenSSL and SSLeay licenses, IJG
|
||||
JPEG Library README, Windows Media SDK EULA, or QuickTime SDK EULA, the
|
||||
licensors of this Program grant you additional
|
||||
permission to convey the resulting work. Corresponding Source for a
|
||||
non-source form of such a combination shall include the source code for
|
||||
the parts of OpenSSL and IJG JPEG Library used as well as that of the covered
|
||||
work.
|
||||
|
||||
You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
or by snail mail at:
|
||||
Cyan Worlds, Inc.
|
||||
14617 N Newport Hwy
|
||||
Mead, WA 99021
|
||||
|
||||
*==LICENSE==*/
|
@ -196,7 +196,7 @@ public:
|
||||
plClothingElement *element = tileset->fElements.Get(i);
|
||||
SendMessage(GetDlgItem(hWnd, plClothingMtl::TextConstants[2 * i]),
|
||||
WM_SETTEXT, NULL, (LPARAM)element->fName.c_str());
|
||||
sprintf(buff, "(%d, %d)", element->fWidth, element->fHeight);
|
||||
snprintf(buff, arrsize(buff), "(%d, %d)", element->fWidth, element->fHeight);
|
||||
SendMessage(GetDlgItem(hWnd, plClothingMtl::TextConstants[2 * i + 1]),
|
||||
WM_SETTEXT, NULL, (LPARAM)buff);
|
||||
|
||||
|
Reference in New Issue
Block a user