From 37625747ee7521366ed681ad86d9631958095544 Mon Sep 17 00:00:00 2001 From: albertzeyer Date: Fri, 24 Jul 2009 15:53:49 +0000 Subject: [PATCH] all ifstream/ofstream uses searchpath system git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@152 4df4b0f3-56ce-47cb-b001-ed939b7d65a6 --- src/fileio/CExeFile.cpp | 4 ++-- src/fileio/CPatcher.cpp | 5 +++-- src/menu.cpp | 3 ++- src/sdl/CVideoDriver.cpp | 3 ++- src/vorticon/CEGAGraphics.cpp | 4 ++-- src/vorticon/CHighScores.cpp | 5 +++-- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/fileio/CExeFile.cpp b/src/fileio/CExeFile.cpp index b9e8c325e..45ae82653 100644 --- a/src/fileio/CExeFile.cpp +++ b/src/fileio/CExeFile.cpp @@ -10,7 +10,7 @@ #include #include #include "../StringUtils.h" - +#include "../FindFile.h" using namespace std; @@ -29,7 +29,7 @@ bool CExeFile::readData() { std::string filename = "data/" + m_datadirectory + "keen" + itoa(m_episode) + ".exe"; - std::ifstream File(filename.c_str(),ios::binary); + std::ifstream File; OpenGameFileR(File, filename, ios::binary); // TODO: If Exe-file wasn't detected, make the program quit somehow, or it crashes if(!File) return false; diff --git a/src/fileio/CPatcher.cpp b/src/fileio/CPatcher.cpp index 353c850ad..194d5480a 100644 --- a/src/fileio/CPatcher.cpp +++ b/src/fileio/CPatcher.cpp @@ -9,6 +9,7 @@ #include #include #include +#include "../FindFile.h" CPatcher::CPatcher(int episode, int version,unsigned char *data, const std::string& datadir) { m_episode = episode; @@ -123,7 +124,7 @@ bool CPatcher::loadPatchfile() // The file was found! now read it into the memory! char* buf; - std::ifstream Patchfile(dp->d_name); + std::ifstream Patchfile; OpenGameFileR(Patchfile, dp->d_name); while(!Patchfile.eof()) { @@ -163,7 +164,7 @@ void CPatcher::patchMemfromFile(const std::string& patch_file_name, int offset) unsigned char *buf_to_patch; unsigned char byte; - std::ifstream Patchfile(patch_file_name.c_str(), std::ios::binary); + std::ifstream Patchfile; OpenGameFileR(Patchfile, patch_file_name, std::ios::binary); if(!Patchfile) return; diff --git a/src/menu.cpp b/src/menu.cpp index e36c42d99..6969e35e6 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -27,6 +27,7 @@ #include #include #include "StringUtils.h" +#include "FindFile.h" #define SELMOVE_SPD 3 @@ -64,7 +65,7 @@ short loadResourcesforStartMenu(stCloneKeenPlus *pCKP, CGame *Game) { std::string line; - std::ifstream gamescfg("data/games.cfg"); + std::ifstream gamescfg; OpenGameFileR(gamescfg, "data/games.cfg"); if (gamescfg.is_open()) { diff --git a/src/sdl/CVideoDriver.cpp b/src/sdl/CVideoDriver.cpp index e6e3dde96..9c8557f30 100644 --- a/src/sdl/CVideoDriver.cpp +++ b/src/sdl/CVideoDriver.cpp @@ -14,6 +14,7 @@ #include "../scale2x/scalebit.h" #include "../CLogFile.h" #include "../CGraphics.h" +#include "../FindFile.h" #include #include using namespace std; @@ -102,7 +103,7 @@ void CVideoDriver::initResolutionList() st_resolution resolution; char buf[256]; - ifstream ResolutionFile("resolutions.cfg"); + ifstream ResolutionFile; OpenGameFileR(ResolutionFile, "resolutions.cfg"); if(!ResolutionFile) { g_pLogFile->textOut(PURPLE,"Warning: resolutions.cfg could not be read! Maybe your files weren't extracted correctly!
"); diff --git a/src/vorticon/CEGAGraphics.cpp b/src/vorticon/CEGAGraphics.cpp index 51df16a25..f9bbadcea 100644 --- a/src/vorticon/CEGAGraphics.cpp +++ b/src/vorticon/CEGAGraphics.cpp @@ -13,7 +13,7 @@ #include #include #include "../StringUtils.h" - +#include "../FindFile.h" using namespace std; @@ -62,7 +62,7 @@ bool CEGAGraphics::loadData() buf = "egahead.ck" + itoa(m_episode); else buf = m_path + "/egahead.ck" + itoa(m_episode); - std::ifstream HeadFile(buf.c_str(),ios::binary); + std::ifstream HeadFile; OpenGameFileR(HeadFile, buf, ios::binary); if(!HeadFile) return false; diff --git a/src/vorticon/CHighScores.cpp b/src/vorticon/CHighScores.cpp index 434ae4a06..94ee694f5 100644 --- a/src/vorticon/CHighScores.cpp +++ b/src/vorticon/CHighScores.cpp @@ -19,6 +19,7 @@ #include "../sdl/CTimer.h" #include "../CGraphics.h" #include "../StringUtils.h" +#include "../FindFile.h" #define HIGHSCORETABLE_X 1344 #define HIGHSCORETABLE_Y 32 @@ -374,7 +375,7 @@ char CHighScores::loadHighScoreTable(void) sBuf.append(chBuf); sBuf.append(".dat"); - ifstream ScoreTableFile (sBuf.c_str(), ios::binary); + ifstream ScoreTableFile; OpenGameFileR(ScoreTableFile, sBuf, ios::binary); if(ScoreTableFile == NULL) { @@ -407,7 +408,7 @@ char CHighScores::saveHighScoreTable(void) sBuf.append(chBuf); sBuf.append(".dat"); - ofstream ScoreTableFile (sBuf.data(), ios::binary); + ofstream ScoreTableFile; OpenGameFileW(ScoreTableFile, sBuf, ios::binary); if(ScoreTableFile == NULL) {