Use an absolute directory in /usr/share/games/ for game datamaster
authorMiriam Ruiz <miriam@debian.org>
Wed, 3 Dec 2008 11:10:31 +0000 (3 12:10 +0100)
committerMiriam Ruiz <miriam@debian.org>
Wed, 3 Dec 2008 11:10:31 +0000 (3 12:10 +0100)
src/filehelp.cpp
src/gkernel.cpp

index 0462026..a385235 100644 (file)
 // --------------------------------------------------------\r
 char *where_is_the_filename(char *buffer, const char *filename)\r
 {\r
-char str[2048], str2[2048]; // buffer for path making\r
+char str[2048] = "/usr/share/games/kball/",
+     str2[2048]; // buffer for path making\r
 \r
 // check in current executable path\r
-get_executable_name(str, 2048);\r
+//get_executable_name(str, 2048);
 replace_filename(str2, str, filename, 2048);\r
 \r
 if (! exists(filename) )\r
index 1b10bae..554b7f7 100644 (file)
@@ -794,12 +794,14 @@ void CGameKernel::play_a_full_campaign(char *level_filename)
                        clear_bitmap(screen);
                        textout_centre_ex(screen, font, "[   Please wait... loading...   ]", SCREEN_W / 2, SCREEN_H / 2, makecol(255, 255, 255), makecol(0, 0, 64));
                        
-                       DATAFILE *dattmp = load_datafile_object(SPRITES_FILE, "WON_BMP");
+                       char tmp_file_buf[2048];
+                       
+                       DATAFILE *dattmp = load_datafile_object(where_is_the_filename(tmp_file_buf, SPRITES_FILE), "WON_BMP");
                        if (!dattmp)
                                raise_error("CGameKernel::play_a_full_campaign\nCan't load %s -> WON_BMP\n", SPRITES_FILE);
                        BITMAP *bmp_won = (BITMAP *)dattmp->dat;
 
-                       DATAFILE *dattmp2 = load_datafile_object(SPRITES_FILE, "GAME_SCORE_FONT");
+                       DATAFILE *dattmp2 = load_datafile_object(where_is_the_filename(tmp_file_buf, SPRITES_FILE), "GAME_SCORE_FONT");
                        if (!dattmp2)
                                raise_error("CGameKernel::play_a_full_campaign\nCan't load %s -> GAME_SCORE_FONT\n", SPRITES_FILE);
                        FONT *fs = (FONT *)dattmp2->dat;
@@ -810,7 +812,7 @@ void CGameKernel::play_a_full_campaign(char *level_filename)
                        stats.print(screen, 150, makecol(0,0,255), -1, fs);
 
                        // sound
-                       DATAFILE *dattmp3 = load_datafile_object(SPRITES_FILE, "WON_WAV");
+                       DATAFILE *dattmp3 = load_datafile_object(where_is_the_filename(tmp_file_buf, SPRITES_FILE), "WON_WAV");
                        if (dattmp3)
                        {
                                play_sample((SAMPLE *)dattmp3->dat,255,128,1000,0);