lazily load tile images to speedup startup times
[supertux.git] / src / resources.cpp
index 6dbe55d..5267f4b 100644 (file)
@@ -25,9 +25,9 @@
 #include "gui/menu.h"
 #include "gui/button.h"
 #include "scene.h"
-#include "player.h"
-#include "gameobjs.h"
 #include "resources.h"
+#include "object/gameobjs.h"
+#include "object/player.h"
 
 Surface* img_waves[3]; 
 Surface* img_water;
@@ -249,7 +249,7 @@ void loadshared()
 
   /* Herring song */
   herring_song = SoundManager::get
-                   ()->load_music(datadir + "/music/SALCON.MOD");
+                   ()->load_music(datadir + "/music/salcon.mod");
   level_end_song = SoundManager::get
                      ()->load_music(datadir + "/music/leveldone.mod");
 }
@@ -304,3 +304,16 @@ void unloadshared(void)
   sprite_manager = 0;
 }
 
+std::string get_resource_filename(const std::string& resource)
+{
+  std::string filepath = st_dir + resource;
+  if(access(filepath.c_str(), R_OK) == 0)
+    return filepath;
+  
+  filepath = datadir + resource;
+  if(access(filepath.c_str(), R_OK) == 0)
+    return filepath;
+
+  std::cerr << "Couldn't find resource: '" << resource  << "'." << std::endl;
+  return "";
+}