X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fresources.cpp;h=07e0b0471e09081dca80f2348116d947eaf19c9d;hb=42fb8d56e45ca60bc85dde797eb5816569977c9c;hp=5267f4b8ac1ec0382eaeec1651ae9c38cd842689;hpb=6f801c22d97251799740317fb1d0caf2e744b321;p=supertux.git diff --git a/src/resources.cpp b/src/resources.cpp index 5267f4b8a..07e0b0471 100644 --- a/src/resources.cpp +++ b/src/resources.cpp @@ -26,6 +26,7 @@ #include "gui/button.h" #include "scene.h" #include "resources.h" +#include "tile_manager.h" #include "object/gameobjs.h" #include "object/player.h" @@ -52,6 +53,7 @@ MusicRef herring_song; MusicRef level_end_song; SpriteManager* sprite_manager = 0; +TileManager* tile_manager = 0; char * soundfilenames[NUM_SOUNDS] = { "/sounds/jump.wav", @@ -114,7 +116,9 @@ void loadshared() int i; - sprite_manager = new SpriteManager(datadir + "/images/supertux.strf"); + sprite_manager = new SpriteManager( + get_resource_filename("/images/supertux.strf")); + tile_manager = new TileManager("/images/tilesets/supertux.stgt"); /* Tuxes: */ smalltux_star = sprite_manager->create("smalltux-star"); @@ -302,16 +306,18 @@ void unloadshared(void) delete sprite_manager; sprite_manager = 0; + delete tile_manager; + tile_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) + if(FileSystem::faccessible(filepath)) return filepath; filepath = datadir + resource; - if(access(filepath.c_str(), R_OK) == 0) + if(FileSystem::faccessible(filepath)) return filepath; std::cerr << "Couldn't find resource: '" << resource << "'." << std::endl;