1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00

Fix locations of movies, sounds, config and pictures

This commit is contained in:
Mathieu Schroeter 2017-02-11 22:39:25 +01:00
parent 7d9c1b524b
commit 716bbbfc5a
4 changed files with 9 additions and 8 deletions

View File

@ -68,7 +68,9 @@ bool ReadConfig(int argc, char *argv[])
char* pText;
size_t nb;
file = fopen("data/config.ini", "rb");
const auto config = GetBaseDir () + "data/config.ini";
file = fopen(config.c_str (), "rb");
if ( file == nullptr ) return false;
nb = fread(buffer, sizeof(char), 200-1, file);
buffer[nb] = 0;

View File

@ -79,8 +79,7 @@ void CMovie::fileCloseMovie()
bool CMovie::fileOpenMovie(RECT rect, const char *pFilename)
{
std::string path = GetBaseDir ();
path += pFilename;
const auto path = GetBaseDir () + pFilename;
// we got a filename, now close any old movie and open the new one. */
if ( m_fMovieOpen ) fileCloseMovie();
@ -195,11 +194,9 @@ bool CMovie::GetEnable()
bool CMovie::IsExist(const char *pFilename)
{
std::string path = GetBaseDir ();
const auto path = GetBaseDir () + pFilename;
FILE* file;
path += pFilename;
file = fopen(path.c_str (), "rb");
if ( file == nullptr ) return false;

View File

@ -198,7 +198,7 @@ bool CPixmap::Cache(int channel, const char *pFilename, POINT totalDim, POINT ic
{
if ( channel < 0 || channel >= MAXIMAGE ) return false;
std::string file = pFilename;
std::string file = GetBaseDir () + pFilename;
if (access ((file + ".bmp").c_str (), 0 /* F_OK */) != -1)
file += ".bmp";

View File

@ -151,7 +151,9 @@ bool CSound::Cache(int channel, const char *pFilename)
if (m_lpSDL[channel])
Flush(channel);
m_lpSDL[channel] = Mix_LoadWAV (pFilename);
const auto file = GetBaseDir () + pFilename;
m_lpSDL[channel] = Mix_LoadWAV (file.c_str ());
if (!m_lpSDL[channel])
{
SDL_Log ("Mix_LoadWAV: %s\n", Mix_GetError ());