Fix automatic resource file search
authorPhilip Chimento <philip.chimento@gmail.com>
Sun, 16 Sep 2012 17:11:36 +0000 (19:11 +0200)
committerPhilip Chimento <philip.chimento@gmail.com>
Sun, 16 Sep 2012 17:11:36 +0000 (19:11 +0200)
Fixes #21. Don't look for an extra resource file if the game to be
loaded already has a blorb file extension.

player/callbacks.c

index a4cc173593c8a1185ecf272519fad2d4e71c390f..94b9e5b3aaa0d8f547e2fe60dc78c7f01673a668 100644 (file)
@@ -79,7 +79,18 @@ search_for_graphics_file(const char *filename, ChimaraIF *glk)
 
        /* First get the name of the story file */
        char *scratch = g_path_get_basename(filename);
 
        /* First get the name of the story file */
        char *scratch = g_path_get_basename(filename);
-       *(strrchr(scratch, '.')) = '\0';
+       char *ext = strrchr(scratch, '.');
+       if(strcmp(ext, ".zlb") == 0 ||
+               strcmp(ext, ".zblorb") == 0 ||
+               strcmp(ext, ".glb") == 0 ||
+               strcmp(ext, ".gblorb") == 0 ||
+               strcmp(ext, ".blorb") == 0 ||
+               strcmp(ext, ".blb") == 0)
+       {
+               g_object_set(glk, "graphics-file", NULL, NULL);
+               return;
+       }
+       *ext = '\0';
 
        /* Check in the stored resource path, if set */
        char *resource_path;
 
        /* Check in the stored resource path, if set */
        char *resource_path;