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 ----------------------- 1 file changed, 36 deletions(-) (limited to 'src/resources/resourcemanager/resourcemanager.cpp') 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; -- cgit v1.2.3-70-g09d2