diff --git a/source/CCustomOpcodeSystem.cpp b/source/CCustomOpcodeSystem.cpp index 2eee2e41..df91b1f0 100644 --- a/source/CCustomOpcodeSystem.cpp +++ b/source/CCustomOpcodeSystem.cpp @@ -387,13 +387,13 @@ namespace CLEO if (str != nullptr && (size_t)str <= CCustomOpcodeSystem::MinValidAddress) { - CCustomOpcodeSystem::lastErrorMsg = stringPrintf("Writing string from invalid '0x%X' pointer", target.data); + CCustomOpcodeSystem::lastErrorMsg = StringPrintf("Writing string from invalid '0x%X' pointer", target.data); return false; } if ((size_t)target.data <= CCustomOpcodeSystem::MinValidAddress) { - CCustomOpcodeSystem::lastErrorMsg = stringPrintf("Writing string into invalid '0x%X' pointer argument", target.data); + CCustomOpcodeSystem::lastErrorMsg = StringPrintf("Writing string into invalid '0x%X' pointer argument", target.data); return false; } @@ -428,7 +428,7 @@ namespace CLEO if (opcodeParams[0].dwParam <= CCustomOpcodeSystem::MinValidAddress) { - CCustomOpcodeSystem::lastErrorMsg = stringPrintf("Writing string into invalid '0x%X' pointer argument", opcodeParams[0].dwParam); + CCustomOpcodeSystem::lastErrorMsg = StringPrintf("Writing string into invalid '0x%X' pointer argument", opcodeParams[0].dwParam); return result; // error } @@ -465,7 +465,7 @@ namespace CLEO } } - CCustomOpcodeSystem::lastErrorMsg = stringPrintf("Writing string, got argument %s", ToKindStr(paramType)); + CCustomOpcodeSystem::lastErrorMsg = StringPrintf("Writing string, got argument %s", ToKindStr(paramType)); CLEO_SkipOpcodeParams(thread, 1); // skip unhandled param return result; // error } diff --git a/source/CDebug.cpp b/source/CDebug.cpp index 91c3a626..7d253e51 100644 --- a/source/CDebug.cpp +++ b/source/CDebug.cpp @@ -6,23 +6,6 @@ CDebug Debug; using namespace CLEO; -std::string stringPrintf(const char* format, ...) -{ - va_list args; - - va_start(args, format); - auto len = std::vsnprintf(nullptr, 0, format, args) + 1; - va_end(args); - - std::string result(len, '\0'); - - va_start(args, format); - std::vsnprintf(result.data(), result.length(), format, args); - va_end(args); - - return result; -} - void CDebug::Trace(CLEO::eLogLevel level, const char* msg) { std::lock_guard guard(mutex); diff --git a/source/CDebug.h b/source/CDebug.h index c6223d54..74213c5d 100644 --- a/source/CDebug.h +++ b/source/CDebug.h @@ -1,8 +1,6 @@ #pragma once #include -std::string stringPrintf(const char* format, ...); - namespace CLEO { class CRunningScript; diff --git a/source/CScriptEngine.cpp b/source/CScriptEngine.cpp index ee62f041..7e3d4258 100644 --- a/source/CScriptEngine.cpp +++ b/source/CScriptEngine.cpp @@ -932,7 +932,7 @@ namespace CLEO } else // mission pack { - MainScriptFileDir = Filepath_User + stringPrintf("\\MPACK\\MPACK%d", CGame::bMissionPackGame); + MainScriptFileDir = Filepath_User + StringPrintf("\\MPACK\\MPACK%d", CGame::bMissionPackGame); MainScriptFileName = "scr.scm"; } @@ -1066,7 +1066,7 @@ namespace CLEO if(saveSlot == -1) return; - auto saveFile = FS::path(Filepath_Cleo).append(stringPrintf("cleo_saves\\cs%d.sav", saveSlot)).string(); + auto saveFile = FS::path(Filepath_Cleo).append(StringPrintf("cleo_saves\\cs%d.sav", saveSlot)).string(); safe_info = nullptr; stopped_info = nullptr;