Recovered CLatch Class.

git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@135 4df4b0f3-56ce-47cb-b001-ed939b7d65a6
This commit is contained in:
gerstrong
2009-07-24 11:48:39 +00:00
parent 2e7291ce22
commit 035714c5f0
3 changed files with 12 additions and 7 deletions

View File

@@ -17,7 +17,7 @@ using namespace std;
CExeFile::CExeFile(int episode, const std::string& datadirectory) {
m_episode = episode;
m_datadirectory = datadirectory;
if(m_datadirectory != "") m_datadirectory += "/";
if( m_datadirectory != "" && *(m_datadirectory.end()) != '/') m_datadirectory += "/";
m_data = NULL;
}

View File

@@ -193,7 +193,7 @@ bool loadStartMenu(stCloneKeenPlus *pCKP)
fade.rate = FADE_NORM;
fade.mode = FADE_GO;
if( GamesMenu->getSelection()+1 < pCKP->numGames )
if( GamesMenu->getSelection() < pCKP->numGames )
{
ret = true;
pCKP->Resources.GameSelected = GamesMenu->getSelection()+1;

View File

@@ -328,7 +328,7 @@ bool CSound::loadSoundData(unsigned short Episode, const std::string& DataDirect
buf = "keen" + itoa(Episode) + ".exe";
g_pLogFile->ftextOut("sound_load_all(): \"%s\" was not found in the data directory. Looking for \"%s\" in \"%s\" and trying to extract this file<br>", soundfile.c_str(), buf.c_str(), formatPathString(path).c_str());
extractOfExeFile(formatPathString(path), Episode);
extractOfExeFile(path, Episode);
}
else
fclose(p_file);
@@ -411,7 +411,6 @@ char CSound::extractOfExeFile(const std::string& inputpath, int episode)
int bit_count;
int pos, sounds_start, sounds_end, ret = 0;
std::string buffer;
std::string inputfname;
pos = 0;
bit_count = 0;
@@ -431,19 +430,25 @@ char CSound::extractOfExeFile(const std::string& inputpath, int episode)
}
else
{
g_pLogFile->ftextOut("Error: Unknown keen executable name: %s<br>", inputfname.c_str());
g_pLogFile->ftextOut("Error: Unknown episode: %d<br>", episode);
return 1;
}
CExeFile *ExeFile = new CExeFile(episode, inputfname);
CExeFile *ExeFile = new CExeFile(episode, inputpath);
if(!ExeFile->readData()) ret = 1;
else
{
FILE *fout;
if(!(fout = fopen(outputfname.c_str(),"wb"))) ret = 1;
buffer = "data/" + inputpath;
if( *(buffer.end()) != '/') buffer += "/";
buffer += outputfname;
if(!(fout = fopen(buffer.c_str(),"wb"))) ret = 1;
else
{
fwrite( ExeFile->getData()+sounds_start, 1, (sounds_end-sounds_start), fout);
g_pLogFile->ftextOut(GREEN,"Sounds extraction completed successfully<br>");
fclose(fout);
}
}