From 59271755dc75f5de6c288308df92f687deaa32b4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 24 May 2016 23:43:33 +0300 Subject: Move music load functions from resourcemanager into separate file. --- src/resources/resourcemanager/resourcemanager.cpp | 36 ----------------------- src/resources/resourcemanager/resourcemanager.h | 12 -------- 2 files changed, 48 deletions(-) (limited to 'src/resources/resourcemanager') diff --git a/src/resources/resourcemanager/resourcemanager.cpp b/src/resources/resourcemanager/resourcemanager.cpp index c59b09618..abec23475 100644 --- a/src/resources/resourcemanager/resourcemanager.cpp +++ b/src/resources/resourcemanager/resourcemanager.cpp @@ -527,42 +527,6 @@ Resource *ResourceManager::get(const std::string &idPath, return resource; } -struct ResourceLoader final -{ - ResourceManager *manager; - std::string path; - ResourceManager::loader fun; - - static Resource *load(const void *const v) - { - if (!v) - return nullptr; - const ResourceLoader *const - rl = static_cast(v); - SDL_RWops *const rw = MPHYSFSRWOPS_openRead(rl->path.c_str()); - if (!rw) - { - reportAlways("Error loading resource: %s", - rl->path.c_str()); - return nullptr; - } - Resource *const res = rl->fun(rw, rl->path); - return res; - } -}; - -SDLMusic *ResourceManager::getMusic(const std::string &idPath) -{ - ResourceLoader rl = { this, idPath, &SDLMusic::load }; - return static_cast(get(idPath, ResourceLoader::load, &rl)); -} - -SoundEffect *ResourceManager::getSoundEffect(const std::string &idPath) -{ - ResourceLoader rl = { this, idPath, &SoundEffect::load }; - return static_cast(get(idPath, ResourceLoader::load, &rl)); -} - struct DyedImageLoader final { ResourceManager *manager; diff --git a/src/resources/resourcemanager/resourcemanager.h b/src/resources/resourcemanager/resourcemanager.h index 2c2caabce..613934f91 100644 --- a/src/resources/resourcemanager/resourcemanager.h +++ b/src/resources/resourcemanager/resourcemanager.h @@ -139,18 +139,6 @@ class ResourceManager final : public MemoryCounter */ Image *getImage(const std::string &idPath) A_WARN_UNUSED; - /** - * Convenience wrapper around ResourceManager::get for loading - * songs. - */ - SDLMusic *getMusic(const std::string &idPath) A_WARN_UNUSED; - - /** - * Convenience wrapper around ResourceManager::get for loading - * samples. - */ - SoundEffect *getSoundEffect(const std::string &idPath) A_WARN_UNUSED; - /** * Creates a image set based on the image referenced by the given * path and the supplied sprite sizes -- cgit v1.2.3-70-g09d2