# HG changeset patch # User Ritor1 # Date 1412231032 -21600 # Node ID fc5e83bbafd1c759bfb4ca35d9ed6b610ed68a01 # Parent 491f0babd563c5573875d914bb699946a7a243fd FileExists diff -r 491f0babd563 -r fc5e83bbafd1 Engine/MMT.cpp --- a/Engine/MMT.cpp Thu Oct 02 11:52:31 2014 +0600 +++ b/Engine/MMT.cpp Thu Oct 02 12:23:52 2014 +0600 @@ -1,7 +1,7 @@ #define _CRTDBG_MAP_ALLOC #include #include - +#include #define _CRT_SECURE_NO_WARNINGS #include "MMT.h" @@ -19,6 +19,10 @@ #include "Game.h" #include "Log.h" +bool FileExists(const char *fname) +{ + return access(fname, 0) != -1; +} void ShowLogoVideo() { @@ -86,6 +90,11 @@ { if ( use_music_folder ) { + if (!FileExists("Music\\14.mp3")) + { + Log::Warning(L"File 14.mp3 in Music\\ folder not found"); + return; + } PlayAudio(L"Music\\14.mp3"); alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]); } diff -r 491f0babd563 -r fc5e83bbafd1 Engine/MMT.h --- a/Engine/MMT.h Thu Oct 02 11:52:31 2014 +0600 +++ b/Engine/MMT.h Thu Oct 02 12:23:52 2014 +0600 @@ -4,6 +4,7 @@ void MMT_MainMenu_Loop(); void MMT_MenuMessageProc(); void DrawMMTCopyrightWindow(); +extern bool FileExists(const char *fname); extern bool use_MMT; extern bool use_music_folder; diff -r 491f0babd563 -r fc5e83bbafd1 Media/Audio/AudioPlayer.cpp --- a/Media/Audio/AudioPlayer.cpp Thu Oct 02 11:52:31 2014 +0600 +++ b/Media/Audio/AudioPlayer.cpp Thu Oct 02 12:23:52 2014 +0600 @@ -447,6 +447,11 @@ { alSourceStop(mSourceID); sprintf(string, "Music\\%d.mp3", eTrack); + if (!FileExists(string)) + { + Log::Warning(L"File 14.mp3 in Music\\ folder not found"); + return; + } char2wchar_t(string,wStr); PlayAudio(wStr); alSourcef (mSourceID, AL_GAIN, pSoundVolumeLevels[uMusicVolimeMultiplier]);