Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor static references to s_szPath to use CN3Base::PathGet getter. #252

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/engine/N3Base/N3BaseFileAccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ void CN3BaseFileAccess::FileNameSet(const std::string & szFileName) {
if (!szTmpFN.empty()) {
CharLower(&(szTmpFN[0])); // 모두 소문자로 만든다..
}
int iPos = szTmpFN.find(s_szPath); // 문자열에 Base Path 와 일치하는 이름이 있는지 본다.
int iPos = szTmpFN.find(CN3Base::PathGet()); // 문자열에 Base Path 와 일치하는 이름이 있는지 본다.
if (iPos >= 0) {
m_szFileName = szTmpFN.substr(s_szPath.size()); // 경로가 일치하면.. 긴경로는 짤라준다..
m_szFileName = szTmpFN.substr(CN3Base::PathGet().size()); // 경로가 일치하면.. 긴경로는 짤라준다..
} else {
m_szFileName = szTmpFN;
}
Expand Down Expand Up @@ -66,8 +66,8 @@ bool CN3BaseFileAccess::LoadFromFile() {
{
szFullPath = m_szFileName;
} else {
if (NULL != s_szPath.size() > 0) {
szFullPath = s_szPath;
if (NULL != CN3Base::PathGet().size() > 0) {
szFullPath = CN3Base::PathGet();
}
szFullPath += m_szFileName;
}
Expand Down Expand Up @@ -111,8 +111,8 @@ bool CN3BaseFileAccess::SaveToFile() {
{
szFullPath = m_szFileName;
} else {
if (s_szPath.size() > 0) {
szFullPath = s_szPath;
if (CN3Base::PathGet().size() > 0) {
szFullPath = CN3Base::PathGet();
}
szFullPath += m_szFileName;
}
Expand Down
4 changes: 2 additions & 2 deletions src/engine/N3Base/N3Eng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ CN3Eng::CN3Eng() {
}

// 프로그램이 실행된 경로..
if (s_szPath.empty()) {
if (CN3Base::PathGet().empty()) {
char szPath[256];
char szDrive[_MAX_DRIVE], szDir[_MAX_DIR];
::GetModuleFileName(NULL, szPath, 256);
_splitpath(szPath, szDrive, szDir, NULL, NULL);
sprintf(szPath, "%s%s", szDrive, szDir);
this->PathSet(szPath); // 경로 설정..
CN3Base::PathSet(szPath); // 경로 설정..
}

#ifdef _N3GAME
Expand Down
4 changes: 2 additions & 2 deletions src/engine/N3Base/N3Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ bool CN3Scene::LoadDataAndResourcesFromFile(const std::string & szFN) {
::_makepath(szPath, szDrv, szDir, NULL, NULL);

this->Release();
this->PathSet(szPath);
CN3Base::PathSet(szPath);
return LoadFromFile(szFN);
}

Expand All @@ -622,7 +622,7 @@ bool CN3Scene::SaveDataAndResourcesToFile(const std::string & szFN) {
::_splitpath(szFN.c_str(), szDrv, szDir, NULL, NULL);
::_makepath(szPath, szDrv, szDir, NULL, NULL);

this->PathSet(szPath);
CN3Base::PathSet(szPath);
return SaveToFile(szFN);
}

Expand Down
4 changes: 2 additions & 2 deletions src/engine/N3Base/N3Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ bool CN3Texture::LoadFromFile(const std::string & szFileName) {
{
szFullPath = m_szFileName;
} else {
if (NULL != s_szPath[0]) {
szFullPath = s_szPath;
if (NULL != CN3Base::PathGet()[0]) {
szFullPath = CN3Base::PathGet();
}
szFullPath += m_szFileName;
}
Expand Down
4 changes: 2 additions & 2 deletions src/engine/N3Base/N3UIBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ void CN3UIBase::SetSndOpen(const std::string & strFileName) {
CN3BaseFileAccess tmpBase;
tmpBase.FileNameSet(strFileName); // Base경로에 대해서 상대적 경로를 넘겨준다.

SetCurrentDirectory(tmpBase.PathGet().c_str());
SetCurrentDirectory(CN3Base::PathGet().c_str());
m_pSnd_OpenUI = s_SndMgr.CreateObj(tmpBase.FileName(), SNDTYPE_2D);
}

Expand All @@ -988,7 +988,7 @@ void CN3UIBase::SetSndClose(const std::string & strFileName) {
CN3BaseFileAccess tmpBase;
tmpBase.FileNameSet(strFileName); // Base경로에 대해서 상대적 경로를 넘겨준다.

SetCurrentDirectory(tmpBase.PathGet().c_str());
SetCurrentDirectory(CN3Base::PathGet().c_str());
m_pSnd_CloseUI = s_SndMgr.CreateObj(tmpBase.FileName(), SNDTYPE_2D);
}

Expand Down
4 changes: 2 additions & 2 deletions src/engine/N3Base/N3UIButton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ void CN3UIButton::SetSndOn(const std::string & strFileName) {
CN3BaseFileAccess tmpBase;
tmpBase.FileNameSet(strFileName); // Base경로에 대해서 상대적 경로를 넘겨준다.

SetCurrentDirectory(tmpBase.PathGet().c_str());
SetCurrentDirectory(CN3Base::PathGet().c_str());
m_pSnd_On = s_SndMgr.CreateObj(tmpBase.FileName(), SNDTYPE_2D);
}

Expand All @@ -382,7 +382,7 @@ void CN3UIButton::SetSndClick(const std::string & strFileName) {
CN3BaseFileAccess tmpBase;
tmpBase.FileNameSet(strFileName); // Base경로에 대해서 상대적 경로를 넘겨준다.

SetCurrentDirectory(tmpBase.PathGet().c_str());
SetCurrentDirectory(CN3Base::PathGet().c_str());
m_pSnd_Click = s_SndMgr.CreateObj(tmpBase.FileName(), SNDTYPE_2D);
}

Expand Down
6 changes: 3 additions & 3 deletions src/engine/N3Base/N3UIEdit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ LRESULT APIENTRY CN3UIEdit::EditWndProc(HWND hWnd, WORD Message, WPARAM wParam,
DWORD dwCmd = wParam;
switch(dwCmd)
{
case IMC_GETCANDIDATEPOS:
case IMC_GETCANDIDATEPOS:
iiii = 0;
break;
case IMC_OPENSTATUSWINDOW:
Expand Down Expand Up @@ -290,7 +290,7 @@ LRESULT APIENTRY CN3UIEdit::EditWndProc(HWND hWnd, WORD Message, WPARAM wParam,
case IMN_SETCOMPOSITIONWINDOW:
{
int iiii = 0;

COMPOSITIONFORM CompForm;
CompForm.dwStyle = CFS_RECT;
int msg2 = (UINT) WM_IME_CONTROL;
Expand Down Expand Up @@ -706,7 +706,7 @@ void CN3UIEdit::SetSndTyping(const std::string & strFileName) {
CN3BaseFileAccess tmpBase;
tmpBase.FileNameSet(strFileName); // Base경로에 대해서 상대적 경로를 넘겨준다.

SetCurrentDirectory(tmpBase.PathGet().c_str());
SetCurrentDirectory(CN3Base::PathGet().c_str());
m_pSnd_Typing = s_SndMgr.CreateObj(tmpBase.FileName(), SNDTYPE_2D);
}

Expand Down
2 changes: 1 addition & 1 deletion src/engine/N3Base/N3UIStatic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ void CN3UIStatic::SetSndClick(const std::string & strFileName) {
CN3BaseFileAccess tmpBase;
tmpBase.FileNameSet(strFileName); // Base경로에 대해서 상대적 경로를 넘겨준다.

SetCurrentDirectory(tmpBase.PathGet().c_str());
SetCurrentDirectory(CN3Base::PathGet().c_str());
m_pSnd_Click = s_SndMgr.CreateObj(tmpBase.FileName(), SNDTYPE_2D);
}

Expand Down
6 changes: 3 additions & 3 deletions src/tool/N3CE/N3CEDoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ BOOL CN3CEDoc::OnOpenDocument(LPCTSTR lpszPathName) {

m_bLoadingNow = TRUE;

m_Scene.PathSet(szPath); // 경로를 정해주고..
CN3Base::PathSet(szPath); // 경로를 정해주고..
m_Scene.ChrGet(0)->Release();
m_Scene.ChrGet(0)->LoadFromFile(lpszPathName);
CN3Joint * pJoint = m_Scene.ChrGet(0)->Joint();
Expand Down Expand Up @@ -147,7 +147,7 @@ BOOL CN3CEDoc::OnSaveDocument(LPCTSTR lpszPathName) {
char szDrive[_MAX_DRIVE], szDir[_MAX_DIR], szFName[_MAX_FNAME];
_splitpath(lpszPathName, szDrive, szDir, szFName, NULL);

m_Scene.PathSet(szPath); // 경로를 정해주고..
CN3Base::PathSet(szPath); // 경로를 정해주고..
CN3Chr * pChr = m_Scene.ChrGet(0);
pChr->m_szName = szFName; // 이름을 정하고..

Expand Down Expand Up @@ -200,7 +200,7 @@ void CN3CEDoc::OnFileSaveAsOneFolder() {
char szDrive[_MAX_DRIVE], szDir[_MAX_DIR];
_splitpath(szFullFileName, szDrive, szDir, NULL, NULL);

m_Scene.PathSet(szPath); // 경로를 정해주고..
CN3Base::PathSet(szPath); // 경로를 정해주고..
CN3Chr * pChr = m_Scene.ChrGet(0);

CN3Joint * pJoint = pChr->Joint();
Expand Down
2 changes: 1 addition & 1 deletion src/tool/N3FXE/DlgEditFxg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ void CDlgEditFxg::OnBtnSaveAs() {
pBaseFileAccess->FileNameSet((LPCTSTR)PathName);

m_strFileName.Empty();
m_strFileName = pBaseFileAccess->PathGet().c_str();
m_strFileName = CN3Base::PathGet().c_str();
m_strFileName += pBaseFileAccess->FileName().c_str();

delete pBaseFileAccess;
Expand Down
2 changes: 1 addition & 1 deletion src/tool/N3FXE/DlgEditPartBillBoard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ void CDlgEditPartBillBoard::OnPartBoardBtnSaveAs() {
pBaseFileAccess->FileNameSet((LPCTSTR)PathName);

m_strPathName.Empty();
m_strPathName = pBaseFileAccess->PathGet().c_str();
m_strPathName = CN3Base::PathGet().c_str();
m_strPathName += pBaseFileAccess->FileName().c_str();

delete pBaseFileAccess;
Expand Down
2 changes: 1 addition & 1 deletion src/tool/N3FXE/DlgEditPartGround.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ void CDlgEditPartGround::OnPartGroundBtnSaveAs() {
pBaseFileAccess->FileNameSet((LPCTSTR)PathName);

m_strPathName.Empty();
m_strPathName = pBaseFileAccess->PathGet().c_str();
m_strPathName = CN3Base::PathGet().c_str();
m_strPathName += pBaseFileAccess->FileName().c_str();

delete pBaseFileAccess;
Expand Down
2 changes: 1 addition & 1 deletion src/tool/N3FXE/DlgEditPartMesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ void CDlgEditPartMesh::OnPartMeshBtnSaveAs() {
pBaseFileAccess->FileNameSet((LPCTSTR)PathName);

m_strPathName.Empty();
m_strPathName = pBaseFileAccess->PathGet().c_str();
m_strPathName = CN3Base::PathGet().c_str();
m_strPathName += pBaseFileAccess->FileName().c_str();

delete pBaseFileAccess;
Expand Down
2 changes: 1 addition & 1 deletion src/tool/N3FXE/DlgEditPartParticle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ void CDlgEditPartParticle::OnPartParticleBtnSaveAs() {
pBaseFileAccess->FileNameSet((LPCTSTR)PathName);

m_strPathName.Empty();
m_strPathName = pBaseFileAccess->PathGet().c_str();
m_strPathName = CN3Base::PathGet().c_str();
m_strPathName += pBaseFileAccess->FileName().c_str();

delete pBaseFileAccess;
Expand Down
12 changes: 6 additions & 6 deletions src/tool/N3FXE/DlgEditScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ bool CDlgEditScript::LoadBundle(CString & strPathName) {
CN3FXPartBase * pPart = m_pFXBundle->GetPart(i);
if (pPart) {
std::string szPartFullPath;
szPartFullPath = pPart->PathGet() + pPart->FileName();
szPartFullPath = CN3Base::PathGet() + pPart->FileName();

char szScriptFullPath[_MAX_PATH];
char szDrive[_MAX_DRIVE], szDir[_MAX_DIR], szFName[_MAX_FNAME], szExt[_MAX_EXT];
Expand Down Expand Up @@ -353,7 +353,7 @@ bool CDlgEditScript::NewBundle() {
/*
for(int i=0;i<MAX_FX_PART;i++)
{
(*m_pPartStartTime[i]) = 0.0f;
(*m_pPartStartTime[i]) = 0.0f;
m_pPartName[i]->SetCurSel(0);
}
m_fVelocity = 0.0f;
Expand Down Expand Up @@ -388,7 +388,7 @@ BOOL CDlgEditScript::OnInitDialog() {

CString strPath;
CN3BaseFileAccess * pBaseFileAccess = new CN3BaseFileAccess;
strPath = pBaseFileAccess->PathGet().c_str();
strPath = CN3Base::PathGet().c_str();
delete pBaseFileAccess;
strPath += "fx\\";

Expand Down Expand Up @@ -428,7 +428,7 @@ void CDlgEditScript::RefreshParts() {
if (idx > 0) {
CString strPath;
CN3BaseFileAccess * pBaseFileAccess = new CN3BaseFileAccess;
strPath = pBaseFileAccess->PathGet().c_str();
strPath = CN3Base::PathGet().c_str();
delete pBaseFileAccess;
strPath += "fx\\";

Expand Down Expand Up @@ -460,7 +460,7 @@ void CDlgEditScript::ReloadCombo() {
// m_CBPartName들 채우기..
CString strPath;
CN3BaseFileAccess * pBaseFileAccess = new CN3BaseFileAccess;
strPath = pBaseFileAccess->PathGet().c_str();
strPath = CN3Base::PathGet().c_str();
delete pBaseFileAccess;
strPath += "fx\\";

Expand Down Expand Up @@ -655,7 +655,7 @@ void CDlgEditScript::OnBtnSaveAs() {
pBaseFileAccess->FileNameSet((LPCTSTR)PathName);

m_strPathName.Empty();
m_strPathName = pBaseFileAccess->PathGet().c_str();
m_strPathName = CN3Base::PathGet().c_str();
m_strPathName += pBaseFileAccess->FileName().c_str();

delete pBaseFileAccess;
Expand Down
4 changes: 2 additions & 2 deletions src/tool/N3Indoor/MainFrm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ void CMainFrame::LoadSourceObjects() {

// source\Chr 폴더의 모든 캐릭터 추가
CString szChrPath;
szChrPath.Format("%sChr\\", CN3Base::s_szPath.c_str());
szChrPath.Format("%sChr\\", CN3Base::PathGet().c_str());
SetCurrentDirectory(szChrPath); // szFolder\Chr 폴더로 경로를 바꾸고..
HANDLE hFind = FindFirstFile("*.N3Chr", &FindFileData);

Expand All @@ -434,7 +434,7 @@ void CMainFrame::LoadSourceObjects() {

// source\Data 폴더의 모든 shape 추가
CString szShapePath;
szShapePath.Format("%sObject\\", CN3Base::s_szPath.c_str());
szShapePath.Format("%sObject\\", CN3Base::PathGet().c_str());
SetCurrentDirectory(szShapePath); // szFolder\Mesh 폴더로 경로를 바꾸고..
hFind = FindFirstFile("*.N3Shape", &FindFileData); // 파일 찾기.

Expand Down
4 changes: 2 additions & 2 deletions src/tool/N3ME/DTexGroupMng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ char * CDTexGroupMng::GetGroupName(int id) {
//
bool CDTexGroupMng::LoadFromFile(CString RealFileName) {
Init(m_pMainFrm);
SetCurrentDirectory(CN3Base::s_szPath.c_str());
SetCurrentDirectory(CN3Base::PathGet().c_str());

char szDTexInfoFileName[_MAX_PATH];
sprintf(szDTexInfoFileName, "dtex\\%s.tgx", (LPCTSTR)RealFileName);
Expand Down Expand Up @@ -389,7 +389,7 @@ bool CDTexGroupMng::LoadFromFile(CString RealFileName) {
//
//
bool CDTexGroupMng::SaveToFile(CString RealFileName) {
SetCurrentDirectory(CN3Base::s_szPath.c_str());
SetCurrentDirectory(CN3Base::PathGet().c_str());

CreateDirectory("dtex", NULL);

Expand Down
23 changes: 12 additions & 11 deletions src/tool/N3ME/DTexMng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ bool CDTexMng::AddDTex(CString FileName) {
pDTex->m_ID = m_NextID;

std::string szOldPath = CN3Base::PathGet();
pDTex->m_pTex->PathSet(szNewPath);
CN3Base::PathSet(szNewPath);
pDTex->m_pTex->LoadFromFile(szNewFN);
pDTex->m_pTex->PathSet(szOldPath);
CN3Base::PathSet(szOldPath);

m_pDTex.push_back(pDTex);
m_NextID++;
Expand Down Expand Up @@ -120,7 +120,7 @@ void CDTexMng::DelDTexByID(int id) {
void CDTexMng::LoadFromFile(CString RealFileName) {
Init(m_pMainFrm);
char szDTexInfoFileName[_MAX_PATH];
wsprintf(szDTexInfoFileName, "%sDTEX\\%s.dtx", s_szPath.c_str(), (LPCTSTR)RealFileName);
wsprintf(szDTexInfoFileName, "%sDTEX\\%s.dtx", CN3Base::PathGet().c_str(), (LPCTSTR)RealFileName);

FILE * stream = fopen(szDTexInfoFileName, "r");
if (!stream) {
Expand Down Expand Up @@ -160,7 +160,8 @@ void CDTexMng::LoadFromFile(CString RealFileName) {
// 그에 관한 타일 정보들을 읽고..
char szDir[_MAX_DIR], szFName[_MAX_FNAME];
_splitpath(szDTexFileName, NULL, szDir, szFName, NULL);
wsprintf(szDTexInfoFileName, "%s%s%s.dif", s_szPath.c_str(), szDir, szFName); // Texture Information file
wsprintf(szDTexInfoFileName, "%s%s%s.dif", CN3Base::PathGet().c_str(), szDir,
szFName); // Texture Information file

HANDLE hFile =
CreateFile(szDTexInfoFileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
Expand Down Expand Up @@ -237,7 +238,7 @@ void CDTexMng::LoadFromFile(CString RealFileName) {
// 그에 관한 타일 정보들을 읽고..
char szDir[_MAX_DIR], szFName[_MAX_FNAME];
_splitpath(szDTexFileName, NULL, szDir, szFName, NULL);
wsprintf(szDTexInfoFileName, "%s%s%s.dif", s_szPath.c_str(), szDir,
wsprintf(szDTexInfoFileName, "%s%s%s.dif", CN3Base::PathGet().c_str(), szDir,
szFName); // Texture Information file

HANDLE hFile =
Expand Down Expand Up @@ -268,11 +269,11 @@ void CDTexMng::LoadFromFile(CString RealFileName) {
//
void CDTexMng::SaveToFile(CString RealFileName) {
char szDTexDir[_MAX_PATH];
wsprintf(szDTexDir, "%sDTex", s_szPath.c_str());
wsprintf(szDTexDir, "%sDTex", CN3Base::PathGet().c_str());
CreateDirectory("dtex", NULL); // 경로 만들고..

char szDTexInfoFileName[_MAX_PATH];
wsprintf(szDTexInfoFileName, "%sDTEX\\%s.dtx", s_szPath.c_str(), (LPCTSTR)RealFileName);
wsprintf(szDTexInfoFileName, "%sDTEX\\%s.dtx", CN3Base::PathGet().c_str(), (LPCTSTR)RealFileName);

FILE * stream = fopen(szDTexInfoFileName, "w");
if (!stream) {
Expand Down Expand Up @@ -308,9 +309,9 @@ void CDTexMng::SaveToFile(CString RealFileName) {
// dif파일만들기...
//
char szDir[_MAX_DIR], szFName[_MAX_FNAME];

_splitpath(szDTexFileName, NULL, szDir, szFName, NULL);
wsprintf(szDTexInfoFileName, "%s%s%s.dif", s_szPath.c_str(), szDir, szFName); // Texture Information file
wsprintf(szDTexInfoFileName, "%s%s%s.dif", CN3Base::PathGet().c_str(), szDir, szFName); // Texture Information file

// 그에 관한 타일 정보들을 읽고..
HANDLE hFile = CreateFile(szDTexInfoFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
Expand All @@ -325,7 +326,7 @@ void CDTexMng::SaveToFile(CString RealFileName) {
}
}
}
CloseHandle(hFile);
CloseHandle(hFile);
*/
}
fclose(stream);
Expand All @@ -345,7 +346,7 @@ void CDTexMng::SaveGameTile() {
char * pTargetImg;

char szDTexDir[_MAX_PATH];
wsprintf(szDTexDir, "%sDTex\\", s_szPath.c_str());
wsprintf(szDTexDir, "%sDTex\\", CN3Base::PathGet().c_str());
char szDrive[_MAX_DRIVE], szDir[_MAX_DIR], szFName[_MAX_FNAME];
_splitpath(szDTexDir, szDrive, szDir, NULL, NULL);

Expand Down
Loading