From 01c6db1b9b7b0c92f3d68370eb4e2211b915f36a Mon Sep 17 00:00:00 2001 From: albertzeyer Date: Fri, 24 Jul 2009 18:28:43 +0000 Subject: [PATCH] some more fixes git-svn-id: https://clonekeenplus.svn.sourceforge.net/svnroot/clonekeenplus/cgenius/trunk@157 4df4b0f3-56ce-47cb-b001-ed939b7d65a6 --- src/CGraphics.cpp | 4 ++-- src/CLogFile.cpp | 8 ++++---- src/CLogFile.h | 8 ++++---- src/hqp/CHQBitmap.cpp | 2 +- src/hqp/hq_sound.cpp | 14 ++++++++++---- src/misc.cpp | 6 +++--- 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/CGraphics.cpp b/src/CGraphics.cpp index 9740c6f33..af43c1f91 100644 --- a/src/CGraphics.cpp +++ b/src/CGraphics.cpp @@ -64,12 +64,12 @@ void CGraphics::freemem(void) if (scrollbuffer) { delete[] scrollbuffer; scrollbuffer = NULL; - g_pLogFile->ftextOut(BLACK,true," Scrollbuffer memory released to system.
"); + g_pLogFile->fltextOut(BLACK,true," Scrollbuffer memory released to system.
"); } if (blitbuffer) { delete[] blitbuffer; blitbuffer = NULL; - g_pLogFile->ftextOut(BLACK,true," Blitbuffer memory released to system.
"); + g_pLogFile->fltextOut(BLACK,true," Blitbuffer memory released to system.
"); } } diff --git a/src/CLogFile.cpp b/src/CLogFile.cpp index f62b881f3..b8a26184a 100644 --- a/src/CLogFile.cpp +++ b/src/CLogFile.cpp @@ -72,13 +72,13 @@ void CLogFile::WriteTopic(const char *Topic, int Size) // Now with colors -void CLogFile::textOut(int Color, const char *Text) +void CLogFile::textOut(FONTCOLORS Color, const char *Text) { textOut(Color, false, Text); } // Now the entire definition (with list and color) -void CLogFile::textOut(int Color, bool List, const char *Text) +void CLogFile::textOut(FONTCOLORS Color, bool List, const char *Text) { if(List == true) textOut("
  • "); @@ -128,7 +128,7 @@ void CLogFile::ftextOut(const char *Text, ...) textOut(buffer); } -void CLogFile::ftextOut(int Color, bool List, const char *Text, ...) +void CLogFile::fltextOut(FONTCOLORS Color, bool List, const char *Text, ...) { char buffer[MAX_BUFFER]; va_list pArgList; @@ -140,7 +140,7 @@ void CLogFile::ftextOut(int Color, bool List, const char *Text, ...) textOut(Color, List, buffer); } -void CLogFile::ftextOut(int Color, const char *Text, ...) +void CLogFile::ftextOut(FONTCOLORS Color, const char *Text, ...) { char buffer[MAX_BUFFER]; va_list pArgList; diff --git a/src/CLogFile.h b/src/CLogFile.h index f9956121d..2d1ffa16a 100644 --- a/src/CLogFile.h +++ b/src/CLogFile.h @@ -33,11 +33,11 @@ public: void CreateLogfile (const char *LogName); void WriteTopic (const char *Topic, int Size); void textOut (const char *Text); - void textOut (int Color, const char *Text); - void textOut (int Color, bool List, const char *Text); + void textOut (FONTCOLORS Color, const char *Text); + void textOut (FONTCOLORS Color, bool List, const char *Text); void ftextOut (const char *Text, ...); - void ftextOut (int Color, const char *Text, ...); - void ftextOut (int Color, bool List, const char *Text, ...); + void ftextOut (FONTCOLORS Color, const char *Text, ...); + void fltextOut (FONTCOLORS Color, bool List, const char *Text, ...); void FunctionResult (const char *Name, bool Result); private: diff --git a/src/hqp/CHQBitmap.cpp b/src/hqp/CHQBitmap.cpp index 24f07613a..48bef4ae8 100644 --- a/src/hqp/CHQBitmap.cpp +++ b/src/hqp/CHQBitmap.cpp @@ -64,7 +64,7 @@ bool CHQBitmap::loadImage(const std::string& pFilename, int wsize, int hsize) } else { - + SDL_GetError(); } return m_active; diff --git a/src/hqp/hq_sound.cpp b/src/hqp/hq_sound.cpp index 687621b21..a8bb66743 100644 --- a/src/hqp/hq_sound.cpp +++ b/src/hqp/hq_sound.cpp @@ -40,10 +40,16 @@ short HQSndDrv_Load(SDL_AudioSpec *AudioSpec, stHQSound *psound, const std::stri g_pLogFile->textOut(PURPLE,"Sorry, OGG-Support is disabled!
    "); buf = "data/hqp/snd/"+ soundfile + ".WAV"; - // Check, if it is a wav file or go back to classic sounds - if (SDL_LoadWAV (buf.c_str(), &AudioFileSpec, &(psound->sound_buffer), &(psound->sound_len)) == NULL) + std::string fullfname = GetFullFileName(buf); + if(fullfname.size() == 0) { + g_pLogFile->textOut(PURPLE,"Wave file not found: \"%s\". Trying to load the classical sound
    ", buf.c_str()); + return 1; + } + + // Check, if it is a wav file or go back to classic sounds + if (SDL_LoadWAV (Utf8ToSystemNative(fullfname).c_str(), &AudioFileSpec, &(psound->sound_buffer), &(psound->sound_len)) == NULL) { - g_pLogFile->textOut(PURPLE,"Wave file could not be opened: \"%s\". Trying to load the classical sound
    ", buf.c_str()); + g_pLogFile->textOut(PURPLE,"Wave file %s could not be opened: \"%s\". Trying to load the classical sound
    ", buf.c_str(), SDL_GetError()); return 1; } @@ -60,7 +66,7 @@ short HQSndDrv_Load(SDL_AudioSpec *AudioSpec, stHQSound *psound, const std::stri // Check, if it is a wav file or go back to classic sounds if (SDL_LoadWAV (Utf8ToSystemNative(fullfname).c_str(), &AudioFileSpec, &(psound->sound_buffer), &(psound->sound_len)) == NULL) { - g_pLogFile->textOut(PURPLE,"Wave file could not be opened: \"%s\". Trying to load the classical sounds
    ", buf.c_str()); + g_pLogFile->ftextOut(PURPLE, "Wave file %s could not be opened: \"%s\". Trying to load the classical sounds
    ", buf.c_str(), SDL_GetError()); return 1; } } diff --git a/src/misc.cpp b/src/misc.cpp index f864ece04..0674eca68 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -53,7 +53,7 @@ void cleanup(stCloneKeenPlus *CKP) { if(CKP->GameData){ delete[] CKP->GameData; CKP->GameData = NULL; } - g_pLogFile->ftextOut(BLACK,true," Freed %d strings.
    ", freestrings()); + g_pLogFile->fltextOut(BLACK,true," Freed %d strings.
    ", freestrings()); JoyDrv_Stop(&(CKP->Joystick)); g_pLogFile->textOut(BLACK,true," Joystick driver shut down.
    "); @@ -77,11 +77,11 @@ void cleanup(stCloneKeenPlus *CKP) if (demofile) { fclose(demofile); - g_pLogFile->ftextOut(BLACK,true," Demo file closed.
    "); + g_pLogFile->fltextOut(BLACK,true," Demo file closed.
    "); } g_pGraphics->stopGraphics(); - g_pLogFile->ftextOut(BLACK,true," Graphics driver shut down.
    "); + g_pLogFile->fltextOut(BLACK,true," Graphics driver shut down.
    "); g_pGraphics->freemem();