diff --git a/src/common/StdBase.h b/src/common/StdBase.h index 5dee11ad..53244c5d 100644 --- a/src/common/StdBase.h +++ b/src/common/StdBase.h @@ -19,3 +19,5 @@ #include #include +#include +#include diff --git a/src/engine/N3Base/LogWriter.cpp b/src/engine/N3Base/LogWriter.cpp index 7b8f20e1..f8ede96c 100644 --- a/src/engine/N3Base/LogWriter.cpp +++ b/src/engine/N3Base/LogWriter.cpp @@ -1,138 +1,74 @@ -// LogWriter.cpp: implementation of the CLogWriter class. -// -////////////////////////////////////////////////////////////////////// - -#include #include "StdAfx.h" #include "LogWriter.h" -////////////////////////////////////////////////////////////////////// -// Construction/Destruction -////////////////////////////////////////////////////////////////////// -//HANDLE CLogWriter::s_hFile = NULL; fs::path CLogWriter::s_fsLogFile; -CLogWriter::CLogWriter() {} - -CLogWriter::~CLogWriter() {} +static std::mutex s_mtxLog; void CLogWriter::Open(const fs::path & fsFile) { - // if (s_hFile || fsFile.empty()) { - // return; - // } if (fsFile.empty()) { return; } - s_fsLogFile = fsFile; + std::lock_guard lock(s_mtxLog); - HANDLE hFile = CreateFileW(s_fsLogFile.c_str(), GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (INVALID_HANDLE_VALUE == hFile) { - hFile = CreateFileW(s_fsLogFile.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if (INVALID_HANDLE_VALUE == hFile) { - return; - } - } + s_fsLogFile = fsFile; - DWORD dwSizeHigh = 0; - DWORD dwSizeLow = ::GetFileSize(hFile, &dwSizeHigh); - if (dwSizeLow > 256000) // 파일 사이즈가 너무 크면 지운다.. - { - CloseHandle(hFile); + // Remove the file if its size exceeds 512 KB + if (fs::exists(s_fsLogFile) && fs::file_size(s_fsLogFile) > 512000) { fs::remove(s_fsLogFile); - hFile = CreateFileW(s_fsLogFile.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if (INVALID_HANDLE_VALUE == hFile) { - return; - } } - ::SetFilePointer(hFile, 0, NULL, FILE_END); // 추가 하기 위해서 파일의 끝으로 옮기고.. - - char szBuff[1024]; - SYSTEMTIME time; - GetLocalTime(&time); - DWORD dwRWC = 0; - - sprintf(szBuff, "---------------------------------------------------------------------------\r\n"); - int iLength = lstrlen(szBuff); - WriteFile(hFile, szBuff, iLength, &dwRWC, NULL); + std::ofstream ofsFile(s_fsLogFile, std::ios::app | std::ios::binary); + if (!ofsFile) { + return; + } - sprintf(szBuff, "// Begin writing log... [%.2d/%.2d %.2d:%.2d]\r\n", time.wMonth, time.wDay, time.wHour, - time.wMinute); - iLength = lstrlen(szBuff); - WriteFile(hFile, szBuff, iLength, &dwRWC, NULL); + auto tpNow = std::chrono::system_clock::now(); + auto tmLocal = std::chrono::current_zone()->to_local(tpNow); - CloseHandle(hFile); + ofsFile << "---------------------------------------------------------------------------\n"; + ofsFile << std::format("// Begin writing log... [{:%m/%d %H:%M}]\n", tmLocal); } void CLogWriter::Close() { - HANDLE hFile = CreateFileW(s_fsLogFile.c_str(), GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (INVALID_HANDLE_VALUE == hFile) { - hFile = CreateFileW(s_fsLogFile.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if (INVALID_HANDLE_VALUE == hFile) { - hFile = NULL; - } + if (s_fsLogFile.empty()) { + return; } - if (hFile) { - ::SetFilePointer(hFile, 0, NULL, FILE_END); // 추가 하기 위해서 파일의 끝으로 옮기고.. + std::lock_guard lock(s_mtxLog); - char szBuff[1024]; - SYSTEMTIME time; - GetLocalTime(&time); - DWORD dwRWC = 0; + std::ofstream ofsFile(s_fsLogFile, std::ios::app | std::ios::binary); + if (!ofsFile) { + return; + } - sprintf(szBuff, "// End writing log... [%.2d/%.2d %.2d:%.2d]\r\n", time.wMonth, time.wDay, time.wHour, - time.wMinute); - int iLength = lstrlen(szBuff); - WriteFile(hFile, szBuff, iLength, &dwRWC, NULL); + auto tpNow = std::chrono::system_clock::now(); + auto tmLocal = std::chrono::current_zone()->to_local(tpNow); - sprintf(szBuff, "---------------------------------------------------------------------------\r\n"); - iLength = lstrlen(szBuff); - WriteFile(hFile, szBuff, iLength, &dwRWC, NULL); + ofsFile << std::format("// End writing log... [{:%m/%d %H:%M}]\n", tmLocal); + ofsFile << "---------------------------------------------------------------------------\n"; - CloseHandle(hFile); - hFile = NULL; - } + s_fsLogFile.clear(); } -void CLogWriter::Write(const char * lpszFormat, ...) { - if (s_fsLogFile.empty() || NULL == lpszFormat) { +void CLogWriter::WriteImpl(std::string_view szFmt, const std::format_args fmtArgs) { + if (s_fsLogFile.empty() || szFmt.empty()) { return; } - static char szFinal[1024]; - static SYSTEMTIME time; - GetLocalTime(&time); - szFinal[0] = NULL; - - DWORD dwRWC = 0; - sprintf(szFinal, " [%.2d:%.2d:%.2d] ", time.wHour, time.wMinute, time.wSecond); - - static char szBuff[1024]; - szBuff[0] = NULL; - va_list argList; - va_start(argList, lpszFormat); - vsprintf(szBuff, lpszFormat, argList); - va_end(argList); - N3_DEBUG("CLogWriter::Write: {}", szBuff); - - lstrcat(szFinal, szBuff); - lstrcat(szFinal, "\r\n"); - int iLength = lstrlen(szFinal); - - HANDLE hFile = CreateFileW(s_fsLogFile.c_str(), GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (INVALID_HANDLE_VALUE == hFile) { - hFile = CreateFileW(s_fsLogFile.c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - if (INVALID_HANDLE_VALUE == hFile) { - hFile = NULL; - } - } + std::lock_guard lock(s_mtxLog); + + std::string szMsg = std::vformat(szFmt, fmtArgs); + N3_DEBUG("CLogWriter::Write: {:s}", szMsg); + + auto tpNow = std::chrono::system_clock::now(); + auto tmLocal = std::chrono::current_zone()->to_local(tpNow); - if (hFile) { - ::SetFilePointer(hFile, 0, NULL, FILE_END); // 추가 하기 위해서 파일의 끝으로 옮기고.. + std::string szLog = std::format(" [{:%H:%M:%S}] ", tmLocal) + szMsg + "\n"; - WriteFile(hFile, szFinal, iLength, &dwRWC, NULL); - CloseHandle(hFile); + std::ofstream ofsFile(s_fsLogFile, std::ios::app | std::ios::binary); + if (ofsFile) { + ofsFile.write(szLog.c_str(), szLog.size()); } } diff --git a/src/engine/N3Base/LogWriter.h b/src/engine/N3Base/LogWriter.h index 67fb49dd..f5c94e8e 100644 --- a/src/engine/N3Base/LogWriter.h +++ b/src/engine/N3Base/LogWriter.h @@ -1,21 +1,17 @@ -// LogWriter.h: interface for the CLogWriter class. -// -////////////////////////////////////////////////////////////////////// - #pragma once -#include - class CLogWriter { - protected: - // static HANDLE s_hFile; - static fs::path s_fsLogFile; - public: static void Open(const fs::path & fsFile); static void Close(); - static void Write(const char * lpszFormat, ...); - CLogWriter(); - virtual ~CLogWriter(); + template static void Write(std::string_view szFmt, T &&... fmtArgs) { + WriteImpl(szFmt, std::make_format_args(fmtArgs...)); + } + + private: + static void WriteImpl(std::string_view szFmt, const std::format_args fmtArgs); + + private: + static fs::path s_fsLogFile; }; diff --git a/src/engine/N3Base/N3BaseFileAccess.cpp b/src/engine/N3Base/N3BaseFileAccess.cpp index ec82eaa8..0850534c 100644 --- a/src/engine/N3Base/N3BaseFileAccess.cpp +++ b/src/engine/N3Base/N3BaseFileAccess.cpp @@ -68,12 +68,12 @@ bool CN3BaseFileAccess::LoadFromFile() { HANDLE hFile = ::CreateFileW(FilePathAbs().c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (INVALID_HANDLE_VALUE == hFile) { - std::string szErr = FilePathAbs().string() + " - Can't open file (read)"; + std::string szErr = std::format("{:s} - Can't open file (read)", FilePathAbs()); #ifdef _N3TOOL MessageBox(::GetActiveWindow(), szErr.c_str(), "File Handle error", MB_OK); #endif #ifdef _N3GAME - CLogWriter::Write(szErr.c_str()); + CLogWriter::Write(szErr); #endif return false; } @@ -98,7 +98,7 @@ bool CN3BaseFileAccess::SaveToFile() { HANDLE hFile = ::CreateFileW(FilePathAbs().c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { - std::string szErr = FilePathAbs().string() + " - Can't open file(write)"; + std::string szErr = std::format("{:s} - Can't open file(write)", FilePathAbs()); MessageBox(::GetActiveWindow(), szErr.c_str(), "File Handle error", MB_OK); return false; } diff --git a/src/engine/N3Base/N3Eng.cpp b/src/engine/N3Base/N3Eng.cpp index 5b338aaa..efe33a10 100644 --- a/src/engine/N3Base/N3Eng.cpp +++ b/src/engine/N3Base/N3Eng.cpp @@ -205,7 +205,7 @@ bool CN3Eng::Init(BOOL bWindowed, HWND hWnd, DWORD dwWidth, DWORD dwHeight, DWOR errMsg << "]"; MessageBox(hWnd, errMsg.str().c_str(), "Initialization", MB_OK); #ifdef _N3GAME - CLogWriter::Write(errMsg.str().c_str()); + CLogWriter::Write(errMsg.str()); #endif LocalFree(pszDebug); // for (int iii = 0; iii < 3; iii++) { // 여러번 삑~ @@ -403,7 +403,7 @@ void CN3Eng::Present(HWND hWnd, RECT * pRC) { #ifdef _N3GAME // char szErr[256]; // D3DXGetErrorString(rval, szErr, 256); - // CLogWriter::Write("CNEng::Present - device present failed (%s)", szErr); + // CLogWriter::Write("CNEng::Present - device present failed ({:s})", szErr); // Beep(2000, 50); #endif } else { @@ -414,7 +414,7 @@ void CN3Eng::Present(HWND hWnd, RECT * pRC) { #ifdef _N3GAME // char szErr[256]; // D3DXGetErrorString(rval, szErr, 256); - // CLogWriter::Write("CNEng::Present - device present failed (%s)", szErr); + // CLogWriter::Write("CNEng::Present - device present failed ({:s})", szErr); // Beep(2000, 50); #endif } diff --git a/src/engine/N3Base/N3FXShape.cpp b/src/engine/N3Base/N3FXShape.cpp index f61fb502..bf0808af 100644 --- a/src/engine/N3Base/N3FXShape.cpp +++ b/src/engine/N3Base/N3FXShape.cpp @@ -243,7 +243,7 @@ bool CN3FXSPart::Load(HANDLE hFile) { ReadFile(hFile, &iLen, 4, &dwRWC, NULL); // Mesh FileName if (iLen <= 0) { - N3_ERROR("CN3FXShape's n3shape file without n3pmesh ({:s})", FilePath().string()); + N3_ERROR("CN3FXShape's n3shape file without n3pmesh ({:s})", FilePath()); return false; } diff --git a/src/engine/N3Base/N3IMesh.cpp b/src/engine/N3Base/N3IMesh.cpp index 4caad0ca..63f737e2 100644 --- a/src/engine/N3Base/N3IMesh.cpp +++ b/src/engine/N3Base/N3IMesh.cpp @@ -73,7 +73,7 @@ bool CN3IMesh::Create(int nFC, int nVC, int nUVC) { #ifdef _N3GAME if (nFC > 32768) { - CLogWriter::Write("CN3IMesh::Create - Too many faces. (more than 32768) (%s)", FilePath().string().c_str()); + CLogWriter::Write("CN3IMesh::Create - Too many faces. (more than 32768) ({:s})", FilePath()); } #endif @@ -96,7 +96,7 @@ bool CN3IMesh::Create(int nFC, int nVC, int nUVC) { // // if (NULL == m_lpVB) { //#ifdef _N3GAME - // CLogWriter::Write("CN3IMesh::Create - Can't Create VertexBuffer (%s)", FilePath().string().c_str()); + // CLogWriter::Write("CN3IMesh::Create - Can't Create VertexBuffer ({:s})", FilePath()); //#endif // this->Release(); // return false; diff --git a/src/engine/N3Base/N3Mesh.cpp b/src/engine/N3Base/N3Mesh.cpp index d8d43746..b0b1793c 100644 --- a/src/engine/N3Base/N3Mesh.cpp +++ b/src/engine/N3Base/N3Mesh.cpp @@ -146,8 +146,7 @@ void CN3Mesh::Create(int nVC, int nIC) { { #ifdef _N3GAME if (nVC > 32768) { - CLogWriter::Write("CN3IMesh::Create - Too many vertices. (more than 32768) (%s)", - FilePath().string().c_str()); + CLogWriter::Write("CN3IMesh::Create - Too many vertices. (more than 32768) ({:s})", FilePath()); } #endif if (m_pVertices) { @@ -162,8 +161,7 @@ void CN3Mesh::Create(int nVC, int nIC) { { #ifdef _N3GAME if (nIC > 32768) { - CLogWriter::Write("CN3IMesh::Create - Too many indices. (more than 32768) (%s)", - FilePath().string().c_str()); + CLogWriter::Write("CN3IMesh::Create - Too many indices. (more than 32768) ({:s})", FilePath()); } #endif if (m_psnIndices) { diff --git a/src/engine/N3Base/N3SndEng.cpp b/src/engine/N3Base/N3SndEng.cpp index d9ea4ab8..7fc916bb 100644 --- a/src/engine/N3Base/N3SndEng.cpp +++ b/src/engine/N3Base/N3SndEng.cpp @@ -134,7 +134,7 @@ bool CN3SndEng::LoadSource(LPSOUNDSOURCE pSrc) { HRESULT hr = WaveFile.Open(pSrc->fsFile, NULL, 1); //#define WAVEFILE_READ 1 if (FAILED(hr)) { #ifdef _N3GAME - CLogWriter::Write("CN3SndEng::LoadSource - WaveFile Open Failed.. (%)", pSrc->fsFile.string().c_str()); + CLogWriter::Write("CN3SndEng::LoadSource - WaveFile Open Failed.. ({:s})", pSrc->fsFile); #endif return false; } @@ -157,14 +157,14 @@ bool CN3SndEng::LoadSource(LPSOUNDSOURCE pSrc) { hr = m_pDS->CreateSoundBuffer(&dsbd, &(pSrc->pDSBuff), NULL); if (FAILED(hr)) { #ifdef _N3GAME - CLogWriter::Write("CN3SndEng::LoadSource - CreateSoundBuffer Failed.. (%)", pSrc->fsFile.string().c_str()); + CLogWriter::Write("CN3SndEng::LoadSource - CreateSoundBuffer Failed.. ({:s})", pSrc->fsFile); #endif return false; } if (!FillBufferWithSound(pSrc, &WaveFile)) { #ifdef _N3GAME - CLogWriter::Write("CN3SndEng::LoadSource - FillBufferWithSound Failed.. (%)", pSrc->fsFile.string().c_str()); + CLogWriter::Write("CN3SndEng::LoadSource - FillBufferWithSound Failed.. ({:s})", pSrc->fsFile); #endif return false; } diff --git a/src/engine/N3Base/N3SndObj.cpp b/src/engine/N3Base/N3SndObj.cpp index b2e56fd2..831761a5 100644 --- a/src/engine/N3Base/N3SndObj.cpp +++ b/src/engine/N3Base/N3SndObj.cpp @@ -188,7 +188,7 @@ bool CN3SndObj::Create(const fs::path & fsFile, e_SndType eType) { if (FAILED(hr)) { #ifdef _N3GAME if (!fsFile.empty()) { - CLogWriter::Write("CN3SndEng::LoadSource - WaveFile Open Failed.. (%s)", fsFile.string().c_str()); + CLogWriter::Write("CN3SndEng::LoadSource - WaveFile Open Failed.. ({:s})", fsFile); } #endif return false; @@ -212,14 +212,14 @@ bool CN3SndObj::Create(const fs::path & fsFile, e_SndType eType) { hr = s_lpDS->CreateSoundBuffer(&dsbd, &m_lpDSBuff, NULL); if (FAILED(hr)) { #ifdef _N3GAME - CLogWriter::Write("CN3SndObj::Create - CreateSoundBuffer Failed.. (%)", fsFile.string().c_str()); + CLogWriter::Write("CN3SndObj::Create - CreateSoundBuffer Failed.. {:s})", fsFile); #endif return false; } if (!FillBufferWithSound(&WaveFile)) { #ifdef _N3GAME - CLogWriter::Write("CN3SndObj::Create - FillBufferWithSound Failed.. (%)", fsFile.string().c_str()); + CLogWriter::Write("CN3SndObj::Create - FillBufferWithSound Failed.. {:s})", fsFile); #endif return false; } diff --git a/src/engine/N3Base/N3TableBase.h b/src/engine/N3Base/N3TableBase.h index 4aa2b061..e1c57576 100644 --- a/src/engine/N3Base/N3TableBase.h +++ b/src/engine/N3Base/N3TableBase.h @@ -277,7 +277,7 @@ template BOOL CN3TableBase::LoadFromFile(const fs::path & fsF if (INVALID_HANDLE_VALUE == hFile) { #ifdef _N3GAME - CLogWriter::Write("N3TableBase - Can't open file(read) File Handle error (%s)", fsFile.string().c_str()); + CLogWriter::Write("N3TableBase - Can't open file(read) File Handle error ({:s})", fsFile); #endif return FALSE; } @@ -342,7 +342,7 @@ template BOOL CN3TableBase::LoadFromFile(const fs::path & fsF if (FALSE == bResult) { #ifdef _N3GAME - CLogWriter::Write("N3TableBase - incorrect table (%s)", fsFile.string().c_str()); + CLogWriter::Write("N3TableBase - incorrect table ({:s})", fsFile); #endif } diff --git a/src/engine/N3Base/N3Texture.cpp b/src/engine/N3Base/N3Texture.cpp index ccf76ef4..2e229d7c 100644 --- a/src/engine/N3Base/N3Texture.cpp +++ b/src/engine/N3Base/N3Texture.cpp @@ -115,13 +115,13 @@ bool CN3Texture::Create(int nWidth, int nHeight, D3DFORMAT Format, BOOL bGenerat #ifdef _N3GAME if (rval == D3DERR_INVALIDCALL) { - CLogWriter::Write("N3Texture: createtexture err D3DERR_INVALIDCALL(%s)", FilePath().string().c_str()); + CLogWriter::Write("N3Texture: createtexture err D3DERR_INVALIDCALL({:s})", FilePath()); return false; } else if (rval == D3DERR_OUTOFVIDEOMEMORY) { - CLogWriter::Write("N3Texture: createtexture err D3DERR_OUTOFVIDEOMEMORY(%s)", FilePath().string().c_str()); + CLogWriter::Write("N3Texture: createtexture err D3DERR_OUTOFVIDEOMEMORY({:s})", FilePath()); return false; } else if (rval == E_OUTOFMEMORY) { - CLogWriter::Write("N3Texture: createtexture err E_OUTOFMEMORY(%s)", FilePath().string().c_str()); + CLogWriter::Write("N3Texture: createtexture err E_OUTOFMEMORY({:s})", FilePath()); return false; } #endif @@ -187,8 +187,7 @@ bool CN3Texture::LoadFromFile(const fs::path & fsFile) { ::CreateFileW(FilePathAbs().c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) { #ifdef _N3GAME - CLogWriter::Write("invalid file handle(%d) - Can't open texture file(%s)", (int)hFile, - FilePathAbs().string().c_str()); + CLogWriter::Write("invalid file handle - Can't open texture file({:s})", FilePathAbs()); #endif return false; } @@ -210,7 +209,7 @@ bool CN3Texture::LoadFromFile(const fs::path & fsFile) { bSuccess = true; } else { #ifdef _N3GAME - CLogWriter::Write("N3Texture - Failed to load texture(%s)", FilePathAbs().string().c_str()); + CLogWriter::Write("N3Texture - Failed to load texture({:s})", FilePathAbs()); #endif } @@ -250,7 +249,7 @@ bool CN3Texture::Load(HANDLE hFile) { 3 != HeaderOrg.szID[3]) // "NTF"3 - Noah Texture File Ver. 3.0 { #ifdef _N3GAME - CLogWriter::Write("N3Texture Warning - Old format DXT file (%s)", FilePath().string().c_str()); + CLogWriter::Write("N3Texture Warning - Old format DXT file ({:s})", FilePath()); #endif } @@ -310,7 +309,7 @@ bool CN3Texture::Load(HANDLE hFile) { if (m_lpTexture == NULL) { #ifdef _N3GAME - CLogWriter::Write("N3Texture error - Can't create texture (%s)", FilePath().string().c_str()); + CLogWriter::Write("N3Texture error - Can't create texture ({:s})", FilePath()); #endif return false; } @@ -501,7 +500,7 @@ bool CN3Texture::SkipFileHandle(HANDLE hFile) { 3 != HeaderOrg.szID[3]) // "NTF"3 - Noah Texture File Ver. 3.0 { #ifdef _N3GAME - CLogWriter::Write("N3Texture Warning - Old format DXT file (%s)", FilePath().string().c_str()); + CLogWriter::Write("N3Texture Warning - Old format DXT file ({:s})", FilePath()); #endif } @@ -611,7 +610,7 @@ bool CN3Texture::Save(HANDLE hFile) { } if (nMMC < nMMC2) { #ifdef _N3GAME - CLogWriter::Write("N3Texture save warning - Invalid MipMap Count (%s)", FilePath().string().c_str()); + CLogWriter::Write("N3Texture save warning - Invalid MipMap Count ({:s})", FilePath()); #endif m_Header.bMipMap = FALSE; nMMC = 1; diff --git a/src/engine/N3Base/N3VMesh.cpp b/src/engine/N3Base/N3VMesh.cpp index 8046e018..173c90cd 100644 --- a/src/engine/N3Base/N3VMesh.cpp +++ b/src/engine/N3Base/N3VMesh.cpp @@ -123,7 +123,7 @@ void CN3VMesh::CreateIndex(int nIC) { #ifdef _N3GAME if (nIC > 32768) { - CLogWriter::Write("N3VMesh creation warning (%s) - Too many Indices.", FilePath().string().c_str()); + CLogWriter::Write("N3VMesh creation warning ({:s}) - Too many Indices.", FilePath()); } #endif diff --git a/src/game/APISocket.cpp b/src/game/APISocket.cpp index 780e042e..571f4e97 100644 --- a/src/game/APISocket.cpp +++ b/src/game/APISocket.cpp @@ -305,7 +305,7 @@ void CAPISocket::Receive() { __ASSERT(0, "socket receive error!"); #ifdef _N3GAME int iErr = ::GetLastError(); - CLogWriter::Write("socket receive error! : %d", iErr); + CLogWriter::Write("socket receive error! : {:d}", iErr); TRACE("socket receive error! : %d\n", iErr); #endif break; @@ -402,7 +402,7 @@ void CAPISocket::Send(BYTE * pData, int nSize) { __ASSERT(0, "socket send error!"); #ifdef _N3GAME int iErr = ::GetLastError(); - CLogWriter::Write("socket send error! : %d", iErr); + CLogWriter::Write("socket send error! : {:d}", iErr); TRACE("socket send error! : %d\n", iErr); PostQuitMessage(-1); #endif diff --git a/src/game/DungeonManager.cpp b/src/game/DungeonManager.cpp index 089c7fad..c135d834 100644 --- a/src/game/DungeonManager.cpp +++ b/src/game/DungeonManager.cpp @@ -20,7 +20,7 @@ CDungeonManager::~CDungeonManager() {} void CDungeonManager::InitWorld(int iZoneID, const __Vector3 & vPosPlayer) { __TABLE_ZONE * pZone = s_pTbl_Zones->Find(s_pPlayer->m_InfoExt.iZoneCur); if (NULL == pZone) { - CLogWriter::Write("Null Zone data : %d", iZoneID); + CLogWriter::Write("Null Zone data : {:d}", iZoneID); return; } diff --git a/src/game/GameProcMain.cpp b/src/game/GameProcMain.cpp index 4b71ca67..c0052dcd 100644 --- a/src/game/GameProcMain.cpp +++ b/src/game/GameProcMain.cpp @@ -315,7 +315,7 @@ void CGameProcMain::Init() { } } } else { - N3_ERROR("Directory not found ({:s})", fsDir.string()); + N3_ERROR("Directory not found ({:s})", fsDir); } }; @@ -400,17 +400,14 @@ void CGameProcMain::Tick() { CAPISocket::MP_AddByte(byBuff, iOffset, N3_TEMP_TEST); s_pSocket->Send(byBuff, iOffset); - int iNPC = s_pOPMgr->m_NPCs.size(); - char szBuff[1024]; - sprintf(szBuff, "NPC Region Test : %d", iNPC); - CLogWriter::Write(szBuff); + int iNPC = s_pOPMgr->m_NPCs.size(); + CLogWriter::Write("NPC Region Test : {:d}", iNPC); it_NPC it = s_pOPMgr->m_NPCs.begin(), itEnd = s_pOPMgr->m_NPCs.end(); for (; it != itEnd; it++) { CPlayerNPC * pNPC = it->second; - sprintf(szBuff, " ID(%d) Name(%s) Pos(%.1f, %.1f)", pNPC->IDNumber(), pNPC->IDString().c_str(), - pNPC->m_vPosFromServer.x, pNPC->m_vPosFromServer.z); - CLogWriter::Write(szBuff); + CLogWriter::Write(" ID({:d}) Name({:s}) Pos({:.1f}, {:.1f})", pNPC->IDNumber(), pNPC->IDString(), + pNPC->m_vPosFromServer.x, pNPC->m_vPosFromServer.z); } } #endif @@ -726,16 +723,13 @@ bool CGameProcMain::ProcessPacket(DataPack * pDataPack, int & iOffset) { { #ifdef _DEBUG case N3_TEMP_TEST: { - int iNPC = CAPISocket::Parse_GetShort(pDataPack->m_pData, iOffset); - char szBuff[32]; - sprintf(szBuff, "NPC Region Test : %d -> ", iNPC); - std::string szLog = szBuff; + int iNPC = CAPISocket::Parse_GetShort(pDataPack->m_pData, iOffset); + std::string szLog = std::format("NPC Region Test : {:d} -> ", iNPC); for (int i = 0; i < iNPC; i++) { int iID = CAPISocket::Parse_GetShort(pDataPack->m_pData, iOffset); - sprintf(szBuff, "%d, ", iID); - szLog += szBuff; + szLog += std::format("{:d}, ", iID); } - CLogWriter::Write(szLog.c_str()); + CLogWriter::Write(szLog); } return true; #endif @@ -1697,8 +1691,8 @@ bool CGameProcMain::MsgRecv_MyInfo_All(DataPack * pDataPack, int & iOffset) { __TABLE_PLAYER_LOOKS * pLooks = s_pTbl_UPC_Looks->Find(s_pPlayer->m_InfoBase.eRace); // User Player Character Skin 구조체 포인터.. if (NULL == pLooks) { - CLogWriter::Write("CGameProcMain::MsgRecv_MyInfo_All : failed find character resource data (Race : %d)", - s_pPlayer->m_InfoBase.eRace); + CLogWriter::Write("CGameProcMain::MsgRecv_MyInfo_All : failed find character resource data (Race : {:d})", + (int)s_pPlayer->m_InfoBase.eRace); } __ASSERT(pLooks, "failed find character resource data"); s_pPlayer->InitChr(pLooks); // 관절 세팅.. @@ -1840,7 +1834,7 @@ bool CGameProcMain::MsgRecv_MyInfo_All(DataPack * pDataPack, int & iOffset) { if (NULL == pItem || NULL == pItemExt) { N3_WARN("NULL slot Item!!!"); - CLogWriter::Write("MyInfo - slot - Unknown Item %d, IDNumber", iItemIDInSlots[i]); + CLogWriter::Write("MyInfo - slot - Unknown Item {:d}, IDNumber", iItemIDInSlots[i]); continue; // 아이템이 없으면.. } @@ -1929,7 +1923,7 @@ bool CGameProcMain::MsgRecv_MyInfo_All(DataPack * pDataPack, int & iOffset) { } if (NULL == pItem || NULL == pItemExt) { N3_WARN("NULL Inv Item"); - CLogWriter::Write("MyInfo - Inv - Unknown Item %d, IDNumber", iItemIDInInventorys[i]); + CLogWriter::Write("MyInfo - Inv - Unknown Item {:d}, IDNumber", iItemIDInInventorys[i]); continue; // 아이템이 없으면.. } @@ -2413,7 +2407,7 @@ bool CGameProcMain::MsgRecv_UserIn(DataPack * pDataPack, int & iOffset, bool bWi CPlayerOther * pUPC = s_pOPMgr->UPCGetByID(iID, false); if (pUPC) // 이미 아이디 같은 캐릭이 있으면.. { - CLogWriter::Write("User In - Duplicated ID (%d, %s) Pos(%.2f,%.2f,%.2f)", iID, szName.c_str(), fXPos, fYPos, + CLogWriter::Write("User In - Duplicated ID ({:d}, {:s}) Pos({:.2f},{:.2f},{:.2f})", iID, szName, fXPos, fYPos, fZPos); TRACE("User In - Duplicated ID (%d, %s) Pos(%.2f,%.2f,%.2f)\n", iID, szName.c_str(), fXPos, fYPos, fZPos); @@ -2666,7 +2660,7 @@ bool CGameProcMain::MsgRecv_NPCIn(DataPack * pDataPack, int & iOffset) { } //#ifdef _DEBUG - // CLogWriter::Write("NPC In - ID(%d) Name(%s) Time(%.1f)", iID, szName.c_str(), CN3Base::TimeGet()); // 캐릭 세팅.. + // CLogWriter::Write("NPC In - ID({:d}) Name({:s}) Time({:.1f})", iID, szName, CN3Base::TimeGet()); // 캐릭 세팅.. //#endif e_Nation eNation = (e_Nation)CAPISocket::Parse_GetByte(pDataPack->m_pData, iOffset); // 소속 국가. 0 이면 없다. 1 @@ -2693,7 +2687,7 @@ bool CGameProcMain::MsgRecv_NPCIn(DataPack * pDataPack, int & iOffset) { CPlayerNPC * pNPC = s_pOPMgr->NPCGetByID(iID, false); if (pNPC) // 이미 아이디 같은 캐릭이 있으면.. { - CLogWriter::Write("NPC In - Duplicated ID (%d, %s) Pos(%.2f,%.2f,%.2f)", iID, szName.c_str(), fXPos, fYPos, + CLogWriter::Write("NPC In - Duplicated ID ({:d}, {:s}) Pos({:.2f},{:.2f},{:.2f})", iID, szName, fXPos, fYPos, fZPos); TRACE("NPC In - Duplicated ID (%d, %s) Pos(%.2f,%.2f,%.2f)\n", iID, szName.c_str(), fXPos, fYPos, fZPos); pNPC->Action(PSA_BASIC, true, NULL, true); // 강제로 살리고.. @@ -2832,9 +2826,7 @@ bool CGameProcMain::MsgRecv_NPCIn(DataPack * pDataPack, int & iOffset) { } } } else { - char szBuff[256]; - sprintf(szBuff, "No Resource NPC In : [Name(%s), ResourceID(%d)]", szName.c_str(), iIDResrc); - CLogWriter::Write(szBuff); + CLogWriter::Write("No Resource NPC In : [Name({:s}), ResourceID({:d})]", szName, iIDResrc); } pNPC->PositionSet(__Vector3(fXPos, fYPos, fZPos), true); // 현재 위치 셋팅.. @@ -3269,8 +3261,8 @@ bool CGameProcMain::MsgRecv_UserLookChange(DataPack * pDataPack, int & iOffset) __TABLE_PLAYER_LOOKS * pLooks = s_pTbl_UPC_Looks->Find(pUPC->m_InfoBase.eRace); // User Player Character Skin 구조체 포인터.. if (NULL == pLooks) { - CLogWriter::Write("CGameProcMain::MsgRecv_UserLookChange() - failed find table : Race (%d)", - pUPC->m_InfoBase.eRace); + CLogWriter::Write("CGameProcMain::MsgRecv_UserLookChange() - failed find table : Race ({:d})", + (int)pUPC->m_InfoBase.eRace); __ASSERT(pLooks, "failed find table"); } else { if (PART_POS_HAIR_HELMET == ePartPos) { @@ -3302,7 +3294,8 @@ bool CGameProcMain::MsgRecv_UserLookChange(DataPack * pDataPack, int & iOffset) return true; } else { - CLogWriter::Write("CGameProcMain::MsgRecv_UserLookChange() - Unknown Slot(%d) Item(%d)", eSlot, dwItemID); + CLogWriter::Write("CGameProcMain::MsgRecv_UserLookChange() - Unknown Slot({:d}) Item({:d})", (int)eSlot, + dwItemID); return false; } @@ -3992,7 +3985,7 @@ void CGameProcMain::MsgRecv_TargetHP(DataPack * pDataPack, int & iOffset) { szBuff += pTarget->IDString(); } szBuff += ')'; - CLogWriter::Write(szBuff.c_str()); + CLogWriter::Write(szBuff); } __ASSERT(iTargetHPMax > 0, "최대 체력 수치는 0이상이어야 합니다."); @@ -4190,13 +4183,11 @@ void CGameProcMain::InitZone(int iZone, const __Vector3 & vPosPlayer) { s_pPlayer->m_bMoveContinous = true; // 멈춘다.. this->CommandToggleMoveContinous(); - CLogWriter::Write("CGameProcMain::InitZone -> Zone Change (%d -> %d) Position(%.1f, %.1f, %.1f)", iZonePrev, - iZone, vPosPlayer.x, vPosPlayer.y, vPosPlayer.z); + CLogWriter::Write("CGameProcMain::InitZone -> Zone Change ({:d} -> {:d}) Position({:.1f}, {:.1f}, {:.1f})", + iZonePrev, iZone, vPosPlayer.x, vPosPlayer.y, vPosPlayer.z); - m_bLoadComplete = false; // 로딩 끝남.. - CLogWriter::Write("%d->ClearDurationalMagic()", m_pMagicSkillMng); // TmpLog1122 + m_bLoadComplete = false; // 로딩 끝남.. m_pMagicSkillMng->ClearDurationalMagic(); - CLogWriter::Write("%d->ClearAll()", s_pFX); // TmpLog1122 s_pFX->ClearAll(); if (s_pUILoading) { @@ -4207,25 +4198,18 @@ void CGameProcMain::InitZone(int iZone, const __Vector3 & vPosPlayer) { s_pPlayer->m_InfoExt.iZoneCur = iZone; iZonePrev = iZone; // 최근에 읽은 존 번호를 기억해둔다. - CLogWriter::Write("%d->Find(s_pPlayer->m_InfoExt.iZoneCur)", s_pTbl_Zones); // TmpLog1122 __TABLE_ZONE * pZoneData = s_pTbl_Zones->Find(s_pPlayer->m_InfoExt.iZoneCur); if (NULL == pZoneData) { - CLogWriter::Write("can't find zone data. (zone : %d)", s_pPlayer->m_InfoExt.iZoneCur); + CLogWriter::Write("can't find zone data. (zone : {:d})", s_pPlayer->m_InfoExt.iZoneCur); __ASSERT(0, "Zone Data Not Found!"); return; } - CLogWriter::Write("%d->Release()", s_pOPMgr); // TmpLog1122 - - s_pOPMgr->Release(); // 다른 넘들 다 날린다.. - CLogWriter::Write("%d->InitWorld()", s_pWorldMgr); // TmpLog1122 + s_pOPMgr->Release(); // 다른 넘들 다 날린다.. s_pWorldMgr->InitWorld(iZone, vPosPlayer); // 미니맵 로딩.. - CLogWriter::Write("%d->GetWidthByMeterWithTerrain()", ACT_WORLD); // TmpLog1122 float fWidth = ACT_WORLD->GetWidthByMeterWithTerrain(); - CLogWriter::Write("%d->LoadMiniMap()", m_pUIStateBarAndMiniMap); // TmpLog1122 - CLogWriter::Write("%d->szMiniMapFNszMiniMapFN", pZoneData); // TmpLog1122 m_pUIStateBarAndMiniMap->LoadMiniMap(pZoneData->szMiniMapFile, fWidth, fWidth); CLogWriter::Write("GetRepresentClass()"); // TmpLog1122 @@ -4235,11 +4219,8 @@ void CGameProcMain::InitZone(int iZone, const __Vector3 & vPosPlayer) { if (CLASS_REPRESENT_ROGUE == eCR) { fZoom = 3.0f; // 로그 계열은 맵이 좀더 널리 자세히 보인다.. } - CLogWriter::Write("%d->ZoomSet()", m_pUIStateBarAndMiniMap); // TmpLog1122 m_pUIStateBarAndMiniMap->ZoomSet(fZoom); - CLogWriter::Write("%d->szGtdFile.c_str()", pZoneData); // TmpLog1122 - //fs::path fsBirdListFile = fs::path("Misc") / "bird" / fs::path(pZoneData->szGtdFile).stem() + "_Bird.lst"; m_pLightMgr->LoadZoneLight(pZoneData->szGloFile.c_str()); @@ -4264,11 +4245,10 @@ void CGameProcMain::InitZone(int iZone, const __Vector3 & vPosPlayer) { // 기본적인 캐릭터위치와 카메라 위치 잡기.. //////////////////////////////////////////////////////////////////////////////// - CLogWriter::Write("InitPlayerPosition() Position(%.1f, %.1f, %.1f)", vPosPlayer.x, vPosPlayer.y, + CLogWriter::Write("InitPlayerPosition() Position({:.1f}, {:.1f}, {:.1f})", vPosPlayer.x, vPosPlayer.y, vPosPlayer.z); // TmpLog1122 this->InitPlayerPosition(vPosPlayer); // 플레이어 위치 초기화.. 일으켜 세우고, 기본동작을 취하게 한다. - CLogWriter::Write("%d->Release()2", s_pOPMgr); // TmpLog1122 - s_pOPMgr->Release(); // 다른 플레이어 삭제... + s_pOPMgr->Release(); // 다른 플레이어 삭제... } void CGameProcMain::MsgSend_GameStart() { diff --git a/src/game/GameProcedure.cpp b/src/game/GameProcedure.cpp index 2e63cbe8..815bd0cf 100644 --- a/src/game/GameProcedure.cpp +++ b/src/game/GameProcedure.cpp @@ -379,7 +379,7 @@ void CGameProcedure::Tick() { // 패킷을 처리할 상황이 아니다. int iTempOffst = 0; int iCmd = CAPISocket::Parse_GetByte(pDataPack->m_pData, iTempOffst); - CLogWriter::Write("Invalid Packet... (%d)", iCmd); + CLogWriter::Write("Invalid Packet... ({:d})", iCmd); } delete pDataPack; s_pSocket->PktQueuePop(); // 패킷을 큐에서 꺼냄.. @@ -819,8 +819,8 @@ void CGameProcedure::ReportServerConnectionClosed(bool bNeedQuitGame) { if (s_pPlayer) { __Vector3 vPos = s_pPlayer->Position(); - CLogWriter::Write("Socket Closed... Zone(%d) Pos(%.1f, %.1f, %.1f) Exp(%d)", s_pPlayer->m_InfoExt.iZoneCur, - vPos.x, vPos.y, vPos.z, s_pPlayer->m_InfoExt.iExp); + CLogWriter::Write("Socket Closed... Zone({:d}) Pos({:.1f}, {:.1f}, {:.1f}) Exp({:d})", + s_pPlayer->m_InfoExt.iZoneCur, vPos.x, vPos.y, vPos.z, s_pPlayer->m_InfoExt.iExp); } else { CLogWriter::Write("Socket Closed..."); } @@ -835,7 +835,7 @@ void CGameProcedure::ReportDebugStringAndSendToServer(const std::string & szDebu return; } - CLogWriter::Write(szDebug.c_str()); + CLogWriter::Write(szDebug); if (s_pSocket && s_pSocket->IsConnected()) { int iLen = szDebug.size(); @@ -887,8 +887,8 @@ void CGameProcedure::MsgSend_CharacterSelect() // virtual CAPISocket::MP_AddByte(byBuff, iOffset, s_pPlayer->m_InfoExt.iZoneCur); // 캐릭터 선택창에서의 캐릭터 존 번호 s_pSocket->Send(byBuff, iOffset); // 보낸다 - CLogWriter::Write("MsgSend_CharacterSelect - name(%s) zone(%d)", s_pPlayer->IDString().c_str(), - s_pPlayer->m_InfoExt.iZoneCur); // 디버깅 로그.. + CLogWriter::Write("MsgSend_CharacterSelect - name({:s}) zone({:d})", s_pPlayer->IDString(), + s_pPlayer->m_InfoExt.iZoneCur); } void CGameProcedure::MsgSend_AliveCheck() { @@ -949,12 +949,12 @@ bool CGameProcedure::MsgRecv_CharacterSelect(DataPack * pDataPack, int & iOffset int iZonePrev = s_pPlayer->m_InfoExt.iZoneCur = iZoneCur; s_pPlayer->PositionSet(__Vector3(fX, fY, fZ), true); - CLogWriter::Write("MsgRecv_CharacterSelect - name(%s) zone(%d -> %d)", s_pPlayer->m_InfoBase.szID.c_str(), + CLogWriter::Write("MsgRecv_CharacterSelect - name({:s}) zone({:d} -> {:d})", s_pPlayer->m_InfoBase.szID, iZonePrev, iZoneCur); return true; } else // 실패 { - CLogWriter::Write("MsgRecv_CharacterSelect - failed(%d)", iResult); + CLogWriter::Write("MsgRecv_CharacterSelect - failed({:d})", iResult); return false; } diff --git a/src/game/MachineMng.cpp b/src/game/MachineMng.cpp index deeb7c15..18c7ba8b 100644 --- a/src/game/MachineMng.cpp +++ b/src/game/MachineMng.cpp @@ -129,10 +129,8 @@ void CMachineMng::AddMachine(ReplyMsg & RPMsg) { fs::path fsFile = fs::path("misc") / "machines" / "catapult.mcn"; FILE * stream = _wfopen(fsFile, L"r"); //text파일로 만든다 #if _DEBUG - char szErr[512]; if (NULL == stream) { - wsprintf(szErr, "failed to open file - %s", fsFile.string().c_str()); - __ASSERT(stream, szErr); + __ASSERT(stream, std::format("failed to open file - {:s}", fsFile).c_str()); } #endif diff --git a/src/game/MagicSkillMng.cpp b/src/game/MagicSkillMng.cpp index a5408302..5a614aa0 100644 --- a/src/game/MagicSkillMng.cpp +++ b/src/game/MagicSkillMng.cpp @@ -264,7 +264,7 @@ bool CMagicSkillMng::CheckValidSkillMagic(__TABLE_UPC_SKILL * pSkill) { } if (NULL == pItem || NULL == pItemExt) { __ASSERT(0, "NULL Item"); - CLogWriter::Write("MyInfo - Inv - Unknown Item %d, IDNumber", pSkill->dwExhaustItem); + CLogWriter::Write("MyInfo - Inv - Unknown Item {:d}, IDNumber", pSkill->dwExhaustItem); return false; // 아이템이 없으면.. } @@ -632,7 +632,7 @@ bool CMagicSkillMng::CheckValidCondition(int iTargetID, __TABLE_UPC_SKILL * pSki } if (NULL == pItem || NULL == pItemExt) { __ASSERT(0, "NULL Item"); - CLogWriter::Write("MyInfo - Inv - Unknown Item %d, IDNumber", pSkill->dwExhaustItem); + CLogWriter::Write("MyInfo - Inv - Unknown Item {:d}, IDNumber", pSkill->dwExhaustItem); return false; // 아이템이 없으면.. } @@ -1168,7 +1168,7 @@ bool CMagicSkillMng::MsgSend_MagicProcess(int iTargetID, __TABLE_UPC_SKILL * pSk return false; } StartSkillMagicAtTargetPacket(pSkill, (short)pTarget->IDNumber()); - //CLogWriter::Write("send msg : %.4f", CN3Base::TimeGet()); + //CLogWriter::Write("send msg : {:.4f}", CN3Base::TimeGet()); //TRACE("send msg : %.4f\n", CN3Base::TimeGet()); return true; } @@ -1986,7 +1986,7 @@ void CMagicSkillMng::MsgRecv_Casting(DataPack * pDataPack, int & iOffset) { pPlayer->m_fCastFreezeTime = 10.0f; pPlayer->Action(PSA_SPELLMAGIC, false, pTargetPlayer); - //CLogWriter::Write("send casting : %.4f", CN3Base::TimeGet()); + //CLogWriter::Write("send casting : {:.4f}", CN3Base::TimeGet()); //TRACE("recv casting : %.4f\n", CN3Base::TimeGet()); if (pSkill->iTarget == SKILLMAGIC_TARGET_ENEMY_ONLY) { diff --git a/src/game/N3Terrain.cpp b/src/game/N3Terrain.cpp index aad9b05c..be8c8441 100644 --- a/src/game/N3Terrain.cpp +++ b/src/game/N3Terrain.cpp @@ -2019,7 +2019,7 @@ bool CN3Terrain::LoadColorMap(const fs::path & fsFile) { HANDLE hColorMapFile = CreateFileW(fsFile.c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (INVALID_HANDLE_VALUE == hColorMapFile) { - CLogWriter::Write("Failed to load ColorMap - %s", fsFile.string().c_str()); + CLogWriter::Write("Failed to load ColorMap - {:s}", fsFile); return false; } diff --git a/src/game/N3TerrainManager.cpp b/src/game/N3TerrainManager.cpp index 00c9ace0..a44c4d76 100644 --- a/src/game/N3TerrainManager.cpp +++ b/src/game/N3TerrainManager.cpp @@ -60,28 +60,29 @@ CN3TerrainManager::~CN3TerrainManager() { void CN3TerrainManager::InitWorld(int iZoneID, const __Vector3 & vPosPlayer) { __TABLE_ZONE * pZone = s_pTbl_Zones->Find(s_pPlayer->m_InfoExt.iZoneCur); - if (NULL == pZone) { - CLogWriter::Write("Null Zone Data : %d", iZoneID); + if (!pZone) { + CLogWriter::Write("Null Zone Data : {:d}", iZoneID); return; } - CLogWriter::Write("CN3TerrainManager::InitWorld Pre Load\t%d", m_pTerrain); // TmpLog_11_22 - m_pTerrain->LoadFromFile(pZone->szGtdFile); // 지형..로드.. - CLogWriter::Write("CN3TerrainManager::InitWorld Pre Load ColorMap"); // TmpLog_11_22 - m_pTerrain->LoadColorMap(pZone->szTctFile); // 컬러맵 로드.. - CLogWriter::Write("CN3TerrainManager::InitWorld Pre Release Shapes\t%d", m_pShapes); // TmpLog_11_22 + CLogWriter::Write("CN3TerrainManager::InitWorld Load Terrain"); + m_pTerrain->LoadFromFile(pZone->szGtdFile); + + CLogWriter::Write("CN3TerrainManager::InitWorld Load ColorMap"); + m_pTerrain->LoadColorMap(pZone->szTctFile); + + CLogWriter::Write("CN3TerrainManager::InitWorld Release Shapes"); m_pShapes->Release(); - CLogWriter::Write("CN3TerrainManager::InitWorld Pre Load Shapes"); // TmpLog_11_22 - m_pShapes->LoadFromFile(pZone->szOpdFile); // 오브젝트 데이터 로드.. + CLogWriter::Write("CN3TerrainManager::InitWorld Load Shapes"); + m_pShapes->LoadFromFile(pZone->szOpdFile); - CLogWriter::Write("CN3TerrainManager::InitWorld Pre Load Birds\t%d", m_pBirdMng); // TmpLog_11_22 + CLogWriter::Write("CN3TerrainManager::InitWorld Load Birds"); fs::path fsBirdListFile = fs::path("Misc") / "bird" / fs::path(pZone->szGtdFile).stem() + "_Bird.lst"; m_pBirdMng->LoadFromFile(fsBirdListFile); - CLogWriter::Write("CN3TerrainManager::InitWorld Pre Load Sky\t%d", m_pSky); // TmpLog_11_22 - m_pSky->LoadFromFile(pZone->szSkyFile); // 하늘, 구름, 태양, 날씨 변화등 정보 및 텍스처 로딩.. - m_pSky->SunAndMoonDirectionFixByHour( - pZone->iFixedSundDirection); // 해, 달 방향을 고정하든가 혹은 0 이면 고정하지 않는다. + CLogWriter::Write("CN3TerrainManager::InitWorld Load Sky"); + m_pSky->LoadFromFile(pZone->szSkyFile); + m_pSky->SunAndMoonDirectionFixByHour(pZone->iFixedSundDirection); } void CN3TerrainManager::Tick() { diff --git a/src/game/N3WorldManager.cpp b/src/game/N3WorldManager.cpp index 9f30d2c9..fd40e688 100644 --- a/src/game/N3WorldManager.cpp +++ b/src/game/N3WorldManager.cpp @@ -48,12 +48,12 @@ void CN3WorldManager::InitWorld(int iZoneID, const __Vector3 & vPosPlayer) { // Zone 선택.. if (iZoneID != 51) // N3Terrain.. { - CLogWriter::Write("CN3WorldManager::InitWorld Pre new Terrain ZoneID(%d)", iZoneID); // TmpLog_11_22 + CLogWriter::Write("CN3WorldManager::InitWorld Pre new Terrain ZoneID({:d})", iZoneID); // TmpLog_11_22 m_pActiveWorld = new CN3TerrainManager(); m_bIndoor = false; } else { - CLogWriter::Write("CN3WorldManager::InitWorld Pre new Dungeon ZoneID(%d)", iZoneID); // TmpLog_11_22 + CLogWriter::Write("CN3WorldManager::InitWorld Pre new Dungeon ZoneID({:d})", iZoneID); // TmpLog_11_22 m_pActiveWorld = new CDungeonManager(); m_bIndoor = true; diff --git a/src/game/PlayerOther.cpp b/src/game/PlayerOther.cpp index 5be7fd65..4f0ead3e 100644 --- a/src/game/PlayerOther.cpp +++ b/src/game/PlayerOther.cpp @@ -43,7 +43,7 @@ bool CPlayerOther::Init(e_Race eRace, int iFace, int iHair, DWORD * pdwItemIDs, // 이제 패킷에 따라 캐릭터를 치장..(?) 시켜준다.. 아이템장착, 무기 장착등... __TABLE_PLAYER_LOOKS * pLooks = s_pTbl_UPC_Looks->Find(eRace); // 테이블에서 기본 스킨 .. if (NULL == pLooks) { - CLogWriter::Write("CPlayerOther::Init() Basic Resource Pointer is NULL Race(%d)", eRace); + CLogWriter::Write("CPlayerOther::Init() Basic Resource Pointer is NULL Race({:d})", (int)eRace); return false; } this->InitChr(pLooks); // 관절 세팅.. diff --git a/src/game/UIDroppedItemDlg.cpp b/src/game/UIDroppedItemDlg.cpp index f8ee3b7c..4be25be2 100644 --- a/src/game/UIDroppedItemDlg.cpp +++ b/src/game/UIDroppedItemDlg.cpp @@ -214,7 +214,7 @@ void CUIDroppedItemDlg::AddToItemTable(int iItemID, int iItemCount, int iOrder) } if (NULL == pItem || NULL == pItemExt) { __ASSERT(0, "아이템 포인터 테이블에 없음!!"); - CLogWriter::Write("CUIDroppedItemDlg::AddToItemTable - Invalidate ItemID : %d", iItemID); + CLogWriter::Write("CUIDroppedItemDlg::AddToItemTable - Invalidate ItemID : {:d}", iItemID); return; } @@ -251,7 +251,7 @@ void CUIDroppedItemDlg::AddToItemTableToInventory(int iItemID, int iItemCount, i } if (NULL == pItem || NULL == pItemExt) { __ASSERT(0, "아이템 포인터 테이블에 없음!!"); - CLogWriter::Write("CUIDroppedItemDlg::AddToItemTableToInventory - Invalidate ItemID : %d", iItemID); + CLogWriter::Write("CUIDroppedItemDlg::AddToItemTableToInventory - Invalidate ItemID : {:d}", iItemID); return; } @@ -399,7 +399,7 @@ bool CUIDroppedItemDlg::ReceiveMessage(CN3UIBase * pSender, DWORD dwMsg) { pItem = CGameBase::s_pTbl_Items_Basic->Find(spItem->pItemBasic->dwID); // 열 데이터 얻기.. if (pItem == NULL) { __ASSERT(0, "NULL Item!!!"); - CLogWriter::Write("CUIDroppedItemDlg::ReceiveMessage - UIMSG_ICON_UP - NULL Icon : %d", + CLogWriter::Write("CUIDroppedItemDlg::ReceiveMessage - UIMSG_ICON_UP - NULL Icon : {:d}", spItem->pItemBasic->dwID); break; } @@ -557,7 +557,7 @@ void CUIDroppedItemDlg::GetItemByIDToInventory(BYTE bResult, int iItemID, int64_ } if (NULL == pItem || NULL == pItemExt) { __ASSERT(0, "아이템 포인터 테이블에 없음!!"); - CLogWriter::Write("CUIDroppedItemDlg::GetItemByIDToInventory - NULL Icon : %d", iItemID); + CLogWriter::Write("CUIDroppedItemDlg::GetItemByIDToInventory - NULL Icon : {:d}", iItemID); return; } @@ -643,13 +643,13 @@ void CUIDroppedItemDlg::GetItemByIDToInventory(BYTE bResult, int iItemID, int64_ { if (iItemID == dwGold) { __ASSERT(0, "Invalidate Item ID From Server.. "); - CLogWriter::Write("CUIDroppedItemDlg::GetItemByIDToInventory - ID Pos : %d", iPos); + CLogWriter::Write("CUIDroppedItemDlg::GetItemByIDToInventory - ID Pos : {:d}", iPos); return; } if ((iPos < 0) || (iPos > (MAX_ITEM_INVENTORY - 1))) { __ASSERT(0, "Invalidate Item Pos From Server.. "); - CLogWriter::Write("CUIDroppedItemDlg::GetItemByIDToInventory - Invalidate Pos : %d", iPos); + CLogWriter::Write("CUIDroppedItemDlg::GetItemByIDToInventory - Invalidate Pos : {:d}", iPos); return; } @@ -688,7 +688,7 @@ void CUIDroppedItemDlg::GetItemByIDToInventory(BYTE bResult, int iItemID, int64_ pItem = CGameBase::s_pTbl_Items_Basic->Find(iItemID / 1000 * 1000); // 열 데이터 얻기.. if (NULL == pItem) { __ASSERT(0, "아이템 포인터 테이블에 없음!!"); - CLogWriter::Write("CUIDroppedItemDlg::GetItemByIDToInventory - NULL Icon : %d", iItemID); + CLogWriter::Write("CUIDroppedItemDlg::GetItemByIDToInventory - NULL Icon : {:d}", iItemID); return; } @@ -722,7 +722,7 @@ void CUIDroppedItemDlg::GetItemByIDToInventory(BYTE bResult, int iItemID, int64_ if (iItemID != dwGold) { if ((iPos < 0) || (iPos > (MAX_ITEM_INVENTORY - 1))) { __ASSERT(0, "Invalidate Item Pos From Server.. "); - CLogWriter::Write("CUIDroppedItemDlg::GetItemByIDToInventory - Invalidate Pos : %d", iPos); + CLogWriter::Write("CUIDroppedItemDlg::GetItemByIDToInventory - Invalidate Pos : {:d}", iPos); return; } diff --git a/src/game/UIInventory.cpp b/src/game/UIInventory.cpp index c95eccb6..f6b91531 100644 --- a/src/game/UIInventory.cpp +++ b/src/game/UIInventory.cpp @@ -2285,7 +2285,7 @@ void CUIInventory::DurabilityChange(e_ItemSlot eSlot, int iDurability) { if (eSlot < ITEM_SLOT_EAR_RIGHT || eSlot >= ITEM_SLOT_COUNT) { __ASSERT(0, "Durability Change Item Index Weird."); - CLogWriter::Write("Durability Change Item Index Weird. Slot(%d) Durability(%d)", eSlot, iDurability); + CLogWriter::Write("Durability Change Item Index Weird. Slot({:d}) Durability({:d})", (int)eSlot, iDurability); return; } @@ -2300,13 +2300,13 @@ void CUIInventory::DurabilityChange(e_ItemSlot eSlot, int iDurability) { CGameProcedure::s_pProcMain->MsgOutput(szBuf, 0xffff3b3b); } else { __ASSERT(0, "Durability Change Item NULL icon or NULL item."); - CLogWriter::Write("Durability Change Item NULL icon or NULL item. Slot(%d) Durability(%d)", eSlot, - iDurability); + CLogWriter::Write("Durability Change Item NULL icon or NULL item. Slot({:d}) Durability({:d})", + (int)eSlot, iDurability); } } } else { __ASSERT(0, "Durability Change Item NULL Slot."); - CLogWriter::Write("Durability Change Item ... NULL Slot. Slot(%d) Durability(%d)", eSlot, iDurability); + CLogWriter::Write("Durability Change Item ... NULL Slot. Slot({:d}) Durability({:d})", (int)eSlot, iDurability); } } @@ -2358,7 +2358,7 @@ void CUIInventory::ItemCountChange(int iDistrict, int iIndex, int iCount, int iI } if (NULL == pItem || NULL == pItemExt) { __ASSERT(0, "NULL Item"); - CLogWriter::Write("MyInfo - Inv - Unknown Item %d, IDNumber", iID); + CLogWriter::Write("MyInfo - Inv - Unknown Item {:d}, IDNumber", iID); return; } @@ -2412,7 +2412,7 @@ void CUIInventory::ItemCountChange(int iDistrict, int iIndex, int iCount, int iI } if (NULL == pItem || NULL == pItemExt) { __ASSERT(0, "NULL Item"); - CLogWriter::Write("MyInfo - Inv - Unknown Item %d, IDNumber", iID); + CLogWriter::Write("MyInfo - Inv - Unknown Item {:d}, IDNumber", iID); return; } @@ -2467,7 +2467,7 @@ void CUIInventory::ItemCountChange(int iDistrict, int iIndex, int iCount, int iI } if (NULL == pItem || NULL == pItemExt) { __ASSERT(0, "NULL Item"); - CLogWriter::Write("MyInfo - Inv - Unknown Item %d, IDNumber", iID); + CLogWriter::Write("MyInfo - Inv - Unknown Item {:d}, IDNumber", iID); return; } @@ -2521,7 +2521,7 @@ void CUIInventory::ItemCountChange(int iDistrict, int iIndex, int iCount, int iI } if (NULL == pItem || NULL == pItemExt) { __ASSERT(0, "NULL Item"); - CLogWriter::Write("MyInfo - Inv - Unknown Item %d, IDNumber", iID); + CLogWriter::Write("MyInfo - Inv - Unknown Item {:d}, IDNumber", iID); return; } diff --git a/src/game/UITransactionDlg.cpp b/src/game/UITransactionDlg.cpp index a72807cb..aecc2741 100644 --- a/src/game/UITransactionDlg.cpp +++ b/src/game/UITransactionDlg.cpp @@ -264,7 +264,7 @@ void CUITransactionDlg::EnterTransactionState() { if (NULL == pItem) // 아이템이 없으면.. { __ASSERT(0, "아이템 포인터 테이블에 없음!!"); - CLogWriter::Write("CUITransactionDlg::EnterTransactionState - Invalid Item ID : %d, %d", iOrg, iExt); + CLogWriter::Write("CUITransactionDlg::EnterTransactionState - Invalid Item ID : {:d}, {:d}", iOrg, iExt); continue; } @@ -280,7 +280,7 @@ void CUITransactionDlg::EnterTransactionState() { if (NULL == pItemExt) // 아이템이 없으면.. { __ASSERT(0, "아이템 포인터 테이블에 없음!!"); - CLogWriter::Write("CUITransactionDlg::EnterTransactionState - Invalid Item ID : %d, %d", iOrg, iExt); + CLogWriter::Write("CUITransactionDlg::EnterTransactionState - Invalid Item ID : {:d}, {:d}", iOrg, iExt); continue; } diff --git a/src/game/UIWareHouseDlg.cpp b/src/game/UIWareHouseDlg.cpp index d3883dd4..8239c522 100644 --- a/src/game/UIWareHouseDlg.cpp +++ b/src/game/UIWareHouseDlg.cpp @@ -1687,7 +1687,7 @@ void CUIWareHouseDlg::AddItemInWare(int iItem, int iDurability, int iCount, int } if (NULL == pItem || NULL == pItemExt) { __ASSERT(0, "NULL Item!!!"); - CLogWriter::Write("WareHouse - Ware - Unknown Item %d, IDNumber", iItem); + CLogWriter::Write("WareHouse - Ware - Unknown Item {:d}, IDNumber", iItem); return; // 아이템이 없으면.. } diff --git a/src/server/AIServer/N3BASE/N3ShapeMgr.cpp b/src/server/AIServer/N3BASE/N3ShapeMgr.cpp index 739cf970..86704b8c 100644 --- a/src/server/AIServer/N3BASE/N3ShapeMgr.cpp +++ b/src/server/AIServer/N3BASE/N3ShapeMgr.cpp @@ -338,8 +338,8 @@ void CN3ShapeMgr::GenerateCollisionData() { if (nCPC != (nFC * 3)) { #ifdef _N3GAME - CLogWriter::Write("CN3ShapeMgr::GenerateCollisionData - 충돌 체크 폴리곤의 점갯수와 면 갯수가 다릅니다. (%s)", - FilePath().string().c_str()); + CLogWriter::Write("CN3ShapeMgr::GenerateCollisionData - 충돌 체크 폴리곤의 점갯수와 면 갯수가 다릅니다. ({:s})", + FilePath()); #endif this->Release(); return; @@ -527,8 +527,8 @@ void CN3ShapeMgr::GenerateCollisionData() { if (nCCPC >= 256) { #ifdef _N3GAME CLogWriter::Write( - "CN3ShapeMgr::GenerateCollisionData - 충돌 체크 폴리곤 수가 너무 많습니다. (%s)", - FilePath().string().c_str()); + "CN3ShapeMgr::GenerateCollisionData - Too many collision check polygons. ({:s})", + FilePath()); #endif continue; } @@ -554,8 +554,7 @@ int CN3ShapeMgr::Add(CN3Shape * pShape) { int nZ = (int)(vPos.z / CELL_MAIN_SIZE); if (nX < 0 || nX >= MAX_CELL_MAIN || nZ < 0 || nZ >= MAX_CELL_MAIN) { #ifdef _N3GAME - CLogWriter::Write("CN3ShapeMgr::Add - Shape(%s) Add Failed. Check position", - pShape->FilePath().string().c_str()); + CLogWriter::Write("CN3ShapeMgr::Add - Shape({:s}) Add Failed. Check position", pShape->FilePath()); #endif return -1; } diff --git a/src/server/Ebenezer/N3BASE/N3ShapeMgr.cpp b/src/server/Ebenezer/N3BASE/N3ShapeMgr.cpp index 4772bfed..033b7e7a 100644 --- a/src/server/Ebenezer/N3BASE/N3ShapeMgr.cpp +++ b/src/server/Ebenezer/N3BASE/N3ShapeMgr.cpp @@ -336,8 +336,9 @@ void CN3ShapeMgr::GenerateCollisionData() { if (nCPC != (nFC * 3)) { #ifdef _N3GAME - CLogWriter::Write("CN3ShapeMgr::GenerateCollisionData - 충돌 체크 폴리곤의 점갯수와 면 갯수가 다릅니다. (%s)", - FilePath().string().c_str()); + CLogWriter::Write("CN3ShapeMgr::GenerateCollisionData - The number of points and faces of the collision check " + "polygon are different. ({:s})", + FilePath()); #endif this->Release(); return; @@ -525,8 +526,8 @@ void CN3ShapeMgr::GenerateCollisionData() { if (nCCPC >= 256) { #ifdef _N3GAME CLogWriter::Write( - "CN3ShapeMgr::GenerateCollisionData - 충돌 체크 폴리곤 수가 너무 많습니다. (%s)", - FilePath().string().c_str()); + "CN3ShapeMgr::GenerateCollisionData - Too many collision check polygons. ({:s})", + FilePath()); #endif continue; } @@ -552,8 +553,7 @@ int CN3ShapeMgr::Add(CN3Shape * pShape) { int nZ = (int)(vPos.z / CELL_MAIN_SIZE); if (nX < 0 || nX >= MAX_CELL_MAIN || nZ < 0 || nZ >= MAX_CELL_MAIN) { #ifdef _N3GAME - CLogWriter::Write("CN3ShapeMgr::Add - Shape(%s) Add Failed. Check position", - pShape->FilePath().string().c_str()); + CLogWriter::Write("CN3ShapeMgr::Add - Shape({:s}) Add Failed. Check position", pShape->FilePath()); #endif return -1; } diff --git a/src/tool/N3CE/DlgChrProperty.cpp b/src/tool/N3CE/DlgChrProperty.cpp index 1bfe3022..f1136264 100644 --- a/src/tool/N3CE/DlgChrProperty.cpp +++ b/src/tool/N3CE/DlgChrProperty.cpp @@ -176,13 +176,13 @@ void CDlgChrProperty::UpdateInfo() { int nPartCount = pChr->PartCount(); m_CBChrPart.ResetContent(); for (int i = 0; i < nPartCount; i++) { - CString szTmp; + std::string szTmp; if (pChr->Part(i)) { - szTmp.Format("Part(%d) : %s", i, pChr->Part(i)->FilePath().string().c_str()); + szTmp = std::format("Part({:d}) : {:s}", i, pChr->Part(i)->FilePath()); } else { - szTmp.Format("Part(%d) : Null Pointer !!!", i); + szTmp = std::format("Part({:d}) : Null Pointer !!!", i); } - m_CBChrPart.AddString(szTmp); + m_CBChrPart.AddString(szTmp.c_str()); } if (nPart < 0) {