diff options
Diffstat (limited to 'src/resources/loaders')
28 files changed, 0 insertions, 1595 deletions
diff --git a/src/resources/loaders/atlasloader.cpp b/src/resources/loaders/atlasloader.cpp deleted file mode 100644 index 9f7b4ab09..000000000 --- a/src/resources/loaders/atlasloader.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifdef USE_OPENGL - -#include "resources/atlas/atlasmanager.h" -#include "resources/atlas/atlasresource.h" - -#include "resources/loaders/atlasloader.h" - -#include "resources/resourcemanager/resourcemanager.h" - -#include "utils/checkutils.h" - -#include "debug.h" - -struct AtlasLoader final -{ - A_DEFAULT_COPY(AtlasLoader) - - const std::string name; - const StringVect *const files; - - static Resource *load(const void *const v) - { - if (v == nullptr) - return nullptr; - - const AtlasLoader *const rl = static_cast<const AtlasLoader *>(v); - AtlasResource *const resource = AtlasManager::loadTextureAtlas( - rl->name, *rl->files); - if (resource == nullptr) - reportAlways("Atlas creation error: %s", rl->name.c_str()); - return resource; - } -}; - -Resource *Loader::getAtlas(const std::string &name, - const StringVect &files) -{ - AtlasLoader rl = { name, &files }; - return ResourceManager::get("atlas_" + name, AtlasLoader::load, &rl); -} - -#endif // USE_OPENGL diff --git a/src/resources/loaders/atlasloader.h b/src/resources/loaders/atlasloader.h deleted file mode 100644 index 34aec22a8..000000000 --- a/src/resources/loaders/atlasloader.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef RESOURCES_LOADERS_ATLASLOADER_H -#define RESOURCES_LOADERS_ATLASLOADER_H -#ifdef USE_OPENGL - -#include "utils/stringvector.h" - -#include "localconsts.h" - -class Resource; - -namespace Loader -{ - Resource *getAtlas(const std::string &name, - const StringVect &files) A_WARN_UNUSED; -} // namespace Loader - -#endif // USE_OPENGL -#endif // RESOURCES_LOADERS_ATLASLOADER_H diff --git a/src/resources/loaders/emptyatlasloader.cpp b/src/resources/loaders/emptyatlasloader.cpp deleted file mode 100644 index 3138c821b..000000000 --- a/src/resources/loaders/emptyatlasloader.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifdef USE_OPENGL - -#include "resources/atlas/atlasmanager.h" -#include "resources/atlas/atlasresource.h" - -#include "resources/loaders/emptyatlasloader.h" - -#include "resources/resourcemanager/resourcemanager.h" - -#include "utils/checkutils.h" - -#include "debug.h" - -struct EmptyAtlasLoader final -{ - A_DEFAULT_COPY(EmptyAtlasLoader) - - const std::string name; - const StringVect *const files; - - static Resource *load(const void *const v) - { - if (v == nullptr) - return nullptr; - - const EmptyAtlasLoader *const rl = - static_cast<const EmptyAtlasLoader *>(v); - AtlasResource *const resource = AtlasManager::loadEmptyAtlas( - rl->name, *rl->files); - if (resource == nullptr) - reportAlways("Empty atlas creation error: %s", rl->name.c_str()); - return resource; - } -}; - -Resource *Loader::getEmptyAtlas(const std::string &name, - const StringVect &files) -{ - EmptyAtlasLoader rl = { name, &files }; - return ResourceManager::get("atlas_" + name, EmptyAtlasLoader::load, &rl); -} - -#endif // USE_OPENGL diff --git a/src/resources/loaders/emptyatlasloader.h b/src/resources/loaders/emptyatlasloader.h deleted file mode 100644 index 8a731f8b6..000000000 --- a/src/resources/loaders/emptyatlasloader.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef RESOURCES_LOADERS_EMPTYATLASLOADER_H -#define RESOURCES_LOADERS_EMPTYATLASLOADER_H -#ifdef USE_OPENGL - -#include "utils/stringvector.h" - -#include "localconsts.h" - -class Resource; - -namespace Loader -{ - Resource *getEmptyAtlas(const std::string &name, - const StringVect &files) A_WARN_UNUSED; -} // namespace Loader - -#endif // USE_OPENGL -#endif // RESOURCES_LOADERS_EMPTYATLASLOADER_H diff --git a/src/resources/loaders/imageloader.cpp b/src/resources/loaders/imageloader.cpp deleted file mode 100644 index c5635ef14..000000000 --- a/src/resources/loaders/imageloader.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "resources/imagehelper.h" - -#include "fs/virtfs/rwops.h" - -#include "resources/image/image.h" - -#include "resources/loaders/imageloader.h" - -#include "resources/resourcemanager/resourcemanager.h" - -#include "resources/dye/dye.h" - -#include "utils/checkutils.h" - -#include "debug.h" - -namespace -{ - struct DyedImageLoader final - { - A_DEFAULT_COPY(DyedImageLoader) - - std::string path; - static Resource *load(const void *const v) - { - BLOCK_START("DyedImageLoader::load") - if (v == nullptr) - { - BLOCK_END("DyedImageLoader::load") - return nullptr; - } - - const DyedImageLoader *const rl - = static_cast<const DyedImageLoader *>(v); - - std::string path1 = rl->path; - const size_t p = path1.find('|'); - Dye *d = nullptr; - if (p != std::string::npos) - { - d = new Dye(path1.substr(p + 1)); - path1 = path1.substr(0, p); - } - SDL_RWops *const rw = VirtFs::rwopsOpenRead(path1); - if (rw == nullptr) - { - delete d; - reportAlways("Image loading error: %s", path1.c_str()); - BLOCK_END("DyedImageLoader::load") - return nullptr; - } - Resource *const res = d != nullptr ? imageHelper->load(rw, *d) - : imageHelper->load(rw); - delete d; - if (res == nullptr) - reportAlways("Image loading error: %s", path1.c_str()); - BLOCK_END("DyedImageLoader::load") - return res; - } - }; -} // namespace - -Image *Loader::getImage(const std::string &idPath) -{ - DyedImageLoader rl = { idPath }; - return static_cast<Image*>(ResourceManager::get(idPath, - DyedImageLoader::load, &rl)); -} diff --git a/src/resources/loaders/imageloader.h b/src/resources/loaders/imageloader.h deleted file mode 100644 index 0cac7d431..000000000 --- a/src/resources/loaders/imageloader.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef RESOURCES_LOADERS_IMAGELOADER_H -#define RESOURCES_LOADERS_IMAGELOADER_H - -#include "localconsts.h" - -#include <string> - -class Image; - -namespace Loader -{ - /** - * Convenience wrapper around ResourceManager::get for loading - * images. - */ - Image *getImage(const std::string &idPath) A_WARN_UNUSED; -} // namespace Loader - -#endif // RESOURCES_LOADERS_IMAGELOADER_H diff --git a/src/resources/loaders/imagesetloader.cpp b/src/resources/loaders/imagesetloader.cpp deleted file mode 100644 index 63b56d1fe..000000000 --- a/src/resources/loaders/imagesetloader.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "resources/imageset.h" - -#include "resources/image/image.h" - -#include "resources/loaders/imageloader.h" -#include "resources/loaders/imagesetloader.h" - -#include "resources/resourcemanager/resourcemanager.h" - -#include "utils/checkutils.h" -#include "utils/stringutils.h" - -#include "debug.h" - -struct ImageSetLoader final -{ - const std::string path; - const int w; - const int h; - - A_DEFAULT_COPY(ImageSetLoader) - - static Resource *load(const void *const v) - { - if (v == nullptr) - return nullptr; - - const ImageSetLoader *const - rl = static_cast<const ImageSetLoader *>(v); - - Image *const img = Loader::getImage(rl->path); - if (img == nullptr) - { - reportAlways("Image loading error: %s", rl->path.c_str()); - return nullptr; - } - ImageSet *const res = new ImageSet(img, rl->w, rl->h); - img->decRef(); - return res; - } -}; - -ImageSet *Loader::getImageSet(const std::string &imagePath, - const int w, - const int h) -{ - ImageSetLoader rl = { imagePath, w, h }; - const std::string str = std::string( - imagePath).append( - "[").append(toString( - w)).append( - "x").append(toString( - h)).append( - "]"); - return static_cast<ImageSet*>(ResourceManager::get(str, - ImageSetLoader::load, &rl)); -} diff --git a/src/resources/loaders/imagesetloader.h b/src/resources/loaders/imagesetloader.h deleted file mode 100644 index 87e8215f8..000000000 --- a/src/resources/loaders/imagesetloader.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef RESOURCES_LOADERS_IMAGESETLOADER_H -#define RESOURCES_LOADERS_IMAGESETLOADER_H - -#include <string> - -#include "localconsts.h" - -class ImageSet; - -namespace Loader -{ - /** - * Creates a image set based on the image referenced by the given - * path and the supplied sprite sizes - */ - ImageSet *getImageSet(const std::string &imagePath, - const int w, - const int h) A_WARN_UNUSED; -} // namespace Loader - -#endif // RESOURCES_LOADERS_IMAGESETLOADER_H diff --git a/src/resources/loaders/musicloader.cpp b/src/resources/loaders/musicloader.cpp deleted file mode 100644 index 7ac151c12..000000000 --- a/src/resources/loaders/musicloader.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "resources/sdlmusic.h" - -#include "fs/virtfs/rwops.h" - -#include "resources/loaders/musicloader.h" - -#include "resources/resourcemanager/resourcemanager.h" - -#include "utils/checkutils.h" - -#include "debug.h" - -namespace -{ - struct ResourceLoader final - { - A_DEFAULT_COPY(ResourceLoader) - - const std::string path; - - static Resource *load(const void *const v) - { - if (v == nullptr) - return nullptr; - const ResourceLoader *const - rl = static_cast<const ResourceLoader *>(v); - SDL_RWops *const rw = VirtFs::rwopsOpenRead(rl->path); - if (rw == nullptr) - { - reportAlways("Error loading resource: %s", - rl->path.c_str()); - return nullptr; - } -#ifdef USE_SDL2 - if (Mix_Music *const music = Mix_LoadMUSType_RW(rw, MUS_OGG, 1)) - { - return new SDLMusic(music, nullptr, rl->path); - } -#else // USE_SDL2 - - // Mix_LoadMUSType_RW was added without version changed in SDL1.2 :( - if (Mix_Music *const music = Mix_LoadMUS_RW(rw)) - { - return new SDLMusic(music, rw, rl->path); - } -#endif // USE_SDL2 - - logger->log("Error, failed to load music: %s", SDL_GetError()); - return nullptr; - } - }; -} // namespace - -SDLMusic *Loader::getMusic(const std::string &idPath) -{ - ResourceLoader rl = { idPath }; - return static_cast<SDLMusic*>(ResourceManager::get( - "music_" + idPath, ResourceLoader::load, &rl)); -} diff --git a/src/resources/loaders/musicloader.h b/src/resources/loaders/musicloader.h deleted file mode 100644 index aab14e3da..000000000 --- a/src/resources/loaders/musicloader.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef RESOURCES_RESOURCEMANAGER_MUSICLOADER_H -#define RESOURCES_RESOURCEMANAGER_MUSICLOADER_H - -#include "localconsts.h" - -#include <string> - -class SDLMusic; - -namespace Loader -{ - /** - * Convenience wrapper around ResourceManager::get for loading - * songs. - */ - SDLMusic *getMusic(const std::string &idPath) A_WARN_UNUSED; -} // namespace Loader - -#endif // RESOURCES_RESOURCEMANAGER_MUSICLOADER_H diff --git a/src/resources/loaders/rescaledloader.cpp b/src/resources/loaders/rescaledloader.cpp deleted file mode 100644 index e69814d27..000000000 --- a/src/resources/loaders/rescaledloader.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "resources/image/image.h" - -#include "resources/loaders/rescaledloader.h" - -#include "resources/resourcemanager/resourcemanager.h" - -#include "utils/checkutils.h" -#include "utils/stringutils.h" - -#include "debug.h" - -namespace -{ - struct RescaledLoader final - { - A_DEFAULT_COPY(RescaledLoader) - - const Image *const image; - const int width; - const int height; - static Resource *load(const void *const v) - { - if (v == nullptr) - return nullptr; - const RescaledLoader *const rl - = static_cast<const RescaledLoader *>(v); - if (rl->image == nullptr) - return nullptr; - Image *const rescaled = rl->image->SDLgetScaledImage( - rl->width, rl->height); - if (rescaled == nullptr) - { - reportAlways("Rescale image failed: %s", - rl->image->mIdPath.c_str()); - return nullptr; - } - return rescaled; - } - }; -} // namespace - -Image *Loader::getRescaled(const Image *const image, - const int width, - const int height) -{ - if (image == nullptr) - return nullptr; - - const std::string idPath = image->mIdPath + strprintf( - "_rescaled%dx%d", width, height); - const RescaledLoader rl = { image, width, height }; - return static_cast<Image *>( - ResourceManager::get(idPath, RescaledLoader::load, &rl)); -} diff --git a/src/resources/loaders/rescaledloader.h b/src/resources/loaders/rescaledloader.h deleted file mode 100644 index 08960f530..000000000 --- a/src/resources/loaders/rescaledloader.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef RESOURCES_LOADERS_RESCALEDLOADER_H -#define RESOURCES_LOADERS_RESCALEDLOADER_H - -#include "localconsts.h" - -class Image; - -namespace Loader -{ - Image *getRescaled(const Image *const image, - const int width, - const int height) A_WARN_UNUSED; -} // namespace Loader - -#endif // RESOURCES_LOADERS_RESCALEDLOADER_H diff --git a/src/resources/loaders/shaderloader.cpp b/src/resources/loaders/shaderloader.cpp deleted file mode 100644 index 550be0a75..000000000 --- a/src/resources/loaders/shaderloader.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifdef USE_OPENGL - -#include "utils/checkutils.h" - -#include "render/shaders/shader.h" -#include "render/shaders/shadersmanager.h" - -#include "resources/loaders/shaderloader.h" - -#include "resources/resourcemanager/resourcemanager.h" - -#include "debug.h" - -namespace -{ - struct ShaderLoader final - { - A_DEFAULT_COPY(ShaderLoader) - - const std::string name; - const unsigned int type; - - static Resource *load(const void *const v) - { - if (v == nullptr) - return nullptr; - - const ShaderLoader *const rl - = static_cast<const ShaderLoader *>(v); - Shader *const resource = shaders.createShader(rl->type, rl->name); - if (resource == nullptr) - reportAlways("Shader creation error: %s", rl->name.c_str()); - return resource; - } - }; -} // namespace - -Resource *Loader::getShader(const unsigned int type, - const std::string &name) -{ - ShaderLoader rl = { name, type }; - return ResourceManager::get("shader_" + name, ShaderLoader::load, &rl); -} - -#endif // USE_OPENGL diff --git a/src/resources/loaders/shaderloader.h b/src/resources/loaders/shaderloader.h deleted file mode 100644 index 6331f2aef..000000000 --- a/src/resources/loaders/shaderloader.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef RESOURCES_LOADERS_SHADERLOADER_H -#define RESOURCES_LOADERS_SHADERLOADER_H - -#ifdef USE_OPENGL - -#include <string> - -#include "localconsts.h" - -class Resource; - -namespace Loader -{ - Resource *getShader(const unsigned int type, - const std::string &name) A_WARN_UNUSED; -} // namespace Loader - -#endif // USE_OPENGL -#endif // RESOURCES_LOADERS_SHADERLOADER_H diff --git a/src/resources/loaders/shaderprogramloader.cpp b/src/resources/loaders/shaderprogramloader.cpp deleted file mode 100644 index fe4a5cf50..000000000 --- a/src/resources/loaders/shaderprogramloader.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifdef USE_OPENGL - -#include "utils/checkutils.h" - -#include "render/shaders/shaderprogram.h" -#include "render/shaders/shadersmanager.h" - -#include "resources/loaders/shaderprogramloader.h" - -#include "resources/resourcemanager/resourcemanager.h" - -#include "debug.h" - -namespace -{ - struct ShaderProgramLoader final - { - A_DEFAULT_COPY(ShaderProgramLoader) - - const std::string vertex; - const std::string fragment; - const bool isNewShader; - - static Resource *load(const void *const v) - { - if (v == nullptr) - return nullptr; - - const ShaderProgramLoader *const rl - = static_cast<const ShaderProgramLoader *>(v); - ShaderProgram *const resource = shaders.createProgram( - rl->vertex, - rl->fragment, - rl->isNewShader); - if (resource == nullptr) - reportAlways("Shader program creation error"); - return resource; - } - }; -} // namespace - -Resource *Loader::getShaderProgram(const std::string &vertex, - const std::string &fragment, - const bool isNewShader) -{ - ShaderProgramLoader rl = { vertex, fragment, isNewShader }; - return ResourceManager::get("program_" + vertex + " + " + fragment, - ShaderProgramLoader::load, &rl); -} - -#endif // USE_OPENGL diff --git a/src/resources/loaders/shaderprogramloader.h b/src/resources/loaders/shaderprogramloader.h deleted file mode 100644 index 3554456c8..000000000 --- a/src/resources/loaders/shaderprogramloader.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef RESOURCES_LOADERS_SHADERPROGRAMLOADER_H -#define RESOURCES_LOADERS_SHADERPROGRAMLOADER_H - -#ifdef USE_OPENGL - -#include <string> - -#include "localconsts.h" - -class Resource; - -namespace Loader -{ - Resource *getShaderProgram(const std::string &vertex, - const std::string &fragment, - const bool isNewShader) A_WARN_UNUSED; -} // namespace Loader - -#endif // USE_OPENGL -#endif // RESOURCES_LOADERS_SHADERPROGRAMLOADER_H diff --git a/src/resources/loaders/soundloader.cpp b/src/resources/loaders/soundloader.cpp deleted file mode 100644 index 879bc0cb1..000000000 --- a/src/resources/loaders/soundloader.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "resources/soundeffect.h" - -#include "fs/virtfs/rwops.h" - -#include "resources/loaders/soundloader.h" - -#include "resources/resourcemanager/resourcemanager.h" - -#include "utils/checkutils.h" - -#include "debug.h" - -namespace -{ - struct ResourceLoader final - { - A_DEFAULT_COPY(ResourceLoader) - - const std::string path; - - static Resource *load(const void *const v) - { - if (v == nullptr) - return nullptr; - const ResourceLoader *const - rl = static_cast<const ResourceLoader *>(v); - SDL_RWops *const rw = VirtFs::rwopsOpenRead(rl->path); - if (rw == nullptr) - { - reportAlways("Error loading resource: %s", - rl->path.c_str()); - return nullptr; - } - // Load the music data and free the RWops structure - Mix_Chunk *const tmpSoundEffect = Mix_LoadWAV_RW(rw, 1); - - if (tmpSoundEffect != nullptr) - { - return new SoundEffect(tmpSoundEffect, rl->path); - } - reportAlways("Error, failed to load sound effect: %s", - SDL_GetError()); - return nullptr; - } - }; -} // namespace - -SoundEffect *Loader::getSoundEffect(const std::string &idPath) -{ - ResourceLoader rl = { idPath }; - return static_cast<SoundEffect*>(ResourceManager::get( - "sound_" + idPath, ResourceLoader::load, &rl)); -} diff --git a/src/resources/loaders/soundloader.h b/src/resources/loaders/soundloader.h deleted file mode 100644 index cd05d46c1..000000000 --- a/src/resources/loaders/soundloader.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef RESOURCES_RESOURCEMANAGER_SOUNDLOADER_H -#define RESOURCES_RESOURCEMANAGER_SOUNDLOADER_H - -#include "localconsts.h" - -#include <string> - -class SoundEffect; - -namespace Loader -{ - /** - * Convenience wrapper around ResourceManager::get for loading - * samples. - */ - SoundEffect *getSoundEffect(const std::string &idPath) A_WARN_UNUSED; -} // namespace Loader - -#endif // RESOURCES_RESOURCEMANAGER_SOUNDLOADER_H diff --git a/src/resources/loaders/spritedefloader.cpp b/src/resources/loaders/spritedefloader.cpp deleted file mode 100644 index 2e91d759b..000000000 --- a/src/resources/loaders/spritedefloader.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "settings.h" - -#include "resources/loaders/spritedefloader.h" - -#include "resources/resourcemanager/resourcemanager.h" - -#include "resources/sprite/spritedef.h" - -#include "utils/stringutils.h" - -#include "debug.h" - -namespace -{ - struct SpriteDefLoader final - { - A_DEFAULT_COPY(SpriteDefLoader) - - const std::string path; - const int variant; - static Resource *load(const void *const v) - { - if (v == nullptr) - return nullptr; - - const SpriteDefLoader *const - rl = static_cast<const SpriteDefLoader *>(v); - return SpriteDef::load(rl->path, - rl->variant, - settings.uselonglivesprites); - } - }; -} // namespace - -SpriteDef *Loader::getSprite(const std::string &path, - const int variant) -{ - SpriteDefLoader rl = { path, variant}; - const std::string str = std::string( - "sprite_").append( - path).append( - "[").append(toString( - variant).append( - "]")); - return static_cast<SpriteDef*>(ResourceManager::get(str, - SpriteDefLoader::load, &rl)); -} diff --git a/src/resources/loaders/spritedefloader.h b/src/resources/loaders/spritedefloader.h deleted file mode 100644 index aec0db818..000000000 --- a/src/resources/loaders/spritedefloader.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef RESOURCES_LOADERS_SPRITEDEFLOADER_H -#define RESOURCES_LOADERS_SPRITEDEFLOADER_H - -#include <string> - -#include "localconsts.h" - -class SpriteDef; - -namespace Loader -{ - /** - * Creates a sprite definition based on a given path and the supplied - * variant. - */ - SpriteDef *getSprite(const std::string &path, - const int variant = 0) A_WARN_UNUSED; - -} // namespace Loader - -#endif // RESOURCES_LOADERS_SPRITEDEFLOADER_H diff --git a/src/resources/loaders/subimageloader.cpp b/src/resources/loaders/subimageloader.cpp deleted file mode 100644 index a4ccc2346..000000000 --- a/src/resources/loaders/subimageloader.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "resources/image/image.h" - -#include "resources/loaders/subimageloader.h" - -#include "resources/resourcemanager/resourcemanager.h" - -#include "utils/checkutils.h" -#include "utils/stringutils.h" - -#include "debug.h" - -namespace -{ - struct SubImageLoader final - { - A_DEFAULT_COPY(SubImageLoader) - - Image *const parent; - const int x; - const int y; - const int width; - const int height; - static Resource *load(const void *const v) - { - if (v == nullptr) - return nullptr; - - const SubImageLoader *const - rl = static_cast<const SubImageLoader *>(v); - if (rl->parent == nullptr) - return nullptr; - - Image *const res = rl->parent->getSubImage(rl->x, rl->y, - rl->width, rl->height); - if (res == nullptr) - { - reportAlways("SubImage loading error: %s", - rl->parent->mSource.c_str()); - } - return res; - } - }; -} // namespace - -Image *Loader::getSubImage(Image *const parent, - const int x, - const int y, - const int width, - const int height) -{ - if (parent == nullptr) - return nullptr; - - const SubImageLoader rl = { parent, x, y, width, height}; - - const std::string str = std::string(parent->mIdPath).append( - ",[").append( - toString(x)).append( - ",").append( - toString(y)).append( - ",").append( - toString(width)).append( - "x").append( - toString(height)).append( - "]"); - return static_cast<Image*>(ResourceManager::get(str, - SubImageLoader::load, &rl)); -} diff --git a/src/resources/loaders/subimageloader.h b/src/resources/loaders/subimageloader.h deleted file mode 100644 index ba0d3fde2..000000000 --- a/src/resources/loaders/subimageloader.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef RESOURCES_RESOURCEMANAGER_SUBIMAGELOADER_H -#define RESOURCES_RESOURCEMANAGER_SUBIMAGELOADER_H - -#include "localconsts.h" - -class Image; - -namespace Loader -{ - Image *getSubImage(Image *const parent, - const int x, - const int y, - const int width, - const int height) A_WARN_UNUSED; -} // namespace Loader - -#endif // RESOURCES_RESOURCEMANAGER_SUBIMAGELOADER_H diff --git a/src/resources/loaders/subimagesetloader.cpp b/src/resources/loaders/subimagesetloader.cpp deleted file mode 100644 index ef47b164d..000000000 --- a/src/resources/loaders/subimagesetloader.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "resources/imageset.h" - -#include "resources/image/image.h" - -#include "resources/loaders/subimagesetloader.h" - -#include "resources/resourcemanager/resourcemanager.h" - -#include "utils/stringutils.h" - -#include "debug.h" - -namespace -{ - struct SubImageSetLoader final - { - A_DEFAULT_COPY(SubImageSetLoader) - - Image *const parent; - int width; - int height; - static Resource *load(const void *const v) - { - if (v == nullptr) - return nullptr; - - const SubImageSetLoader *const - rl = static_cast<const SubImageSetLoader *>(v); - - if (rl->parent == nullptr) - return nullptr; - ImageSet *const res = new ImageSet(rl->parent, - rl->width, rl->height); - return res; - } - }; -} // namespace - -ImageSet *Loader::getSubImageSet(Image *const parent, - const int width, - const int height) -{ - if (parent == nullptr) - return nullptr; - - const SubImageSetLoader rl = { parent, width, height }; - std::string str = std::string( - parent->mIdPath).append( - ", set[").append(toString( - width)).append( - "x").append(toString( - height)).append( - "]"); - return static_cast<ImageSet*>(ResourceManager::get(str, - SubImageSetLoader::load, &rl)); -} diff --git a/src/resources/loaders/subimagesetloader.h b/src/resources/loaders/subimagesetloader.h deleted file mode 100644 index 4c441e1cf..000000000 --- a/src/resources/loaders/subimagesetloader.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef RESOURCES_LOADERS_SUBIMAGESETLOADER_H -#define RESOURCES_LOADERS_SUBIMAGESETLOADER_H - -#include "localconsts.h" - -class Image; -class ImageSet; - -namespace Loader -{ - ImageSet *getSubImageSet(Image *const parent, - const int width, - const int height) A_WARN_UNUSED; -} // namespace Loader - -#endif // RESOURCES_LOADERS_SUBIMAGESETLOADER_H diff --git a/src/resources/loaders/walklayerloader.cpp b/src/resources/loaders/walklayerloader.cpp deleted file mode 100644 index 16be1e2ce..000000000 --- a/src/resources/loaders/walklayerloader.cpp +++ /dev/null @@ -1,71 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "resources/resourcemanager/resourcemanager.h" - -#include "navigationmanager.h" - -#include "resources/map/walklayer.h" - -#include "resources/loaders/walklayerloader.h" - -#include "utils/checkutils.h" - -#include "debug.h" - -#ifndef DYECMD -struct WalkLayerLoader final -{ - A_DEFAULT_COPY(WalkLayerLoader) - - const std::string name; - const Map *const map; - - static Resource *load(const void *const v) - { - if (v == nullptr) - return nullptr; - - const WalkLayerLoader *const rl = static_cast<const - WalkLayerLoader *>(v); - Resource *const resource = NavigationManager::loadWalkLayer(rl->map); - if (resource == nullptr) - reportAlways("WalkLayer creation error"); - return resource; - } -}; - -WalkLayer *Loader::getWalkLayer(const std::string &name, - Map *const map) -{ - WalkLayerLoader rl = {name, map}; - return static_cast<WalkLayer*>(ResourceManager::get("walklayer_" + name, - WalkLayerLoader::load, &rl)); -} -#else // DYECMD - -WalkLayer *Loader::getWalkLayer(const std::string &name A_UNUSED, - Map *const map A_UNUSED) -{ - return nullptr; -} -#endif // DYECMD diff --git a/src/resources/loaders/walklayerloader.h b/src/resources/loaders/walklayerloader.h deleted file mode 100644 index ef1dcbff7..000000000 --- a/src/resources/loaders/walklayerloader.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef RESOURCES_LOADERS_WALKLAYERLOADER_H -#define RESOURCES_LOADERS_WALKLAYERLOADER_H - -#include <string> - -#include "localconsts.h" - -class Map; -class WalkLayer; - -namespace Loader -{ - WalkLayer *getWalkLayer(const std::string &name, - Map *const map) A_WARN_UNUSED; -} // namespace Loader - -#endif // RESOURCES_LOADERS_WALKLAYERLOADER_H diff --git a/src/resources/loaders/xmlloader.cpp b/src/resources/loaders/xmlloader.cpp deleted file mode 100644 index 2d06d8128..000000000 --- a/src/resources/loaders/xmlloader.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#include "resources/resourcemanager/resourcemanager.h" - -#include "utils/checkutils.h" - -#include "resources/loaders/xmlloader.h" - -#include "debug.h" - -namespace -{ - struct ResourceLoader final - { - A_DEFAULT_COPY(ResourceLoader) - - const std::string path; - const UseVirtFs useResman; - const SkipError skipError; - - static Resource *load(const void *const v) - { - if (v == nullptr) - return nullptr; - const ResourceLoader *const - rl = static_cast<const ResourceLoader *>(v); - return new XML::Document(rl->path, - rl->useResman, - rl->skipError); - } - }; - -} // namespace - -XML::Document *Loader::getXml(const std::string &idPath, - const UseVirtFs useResman, - const SkipError skipError) -{ - ResourceLoader rl = { idPath, useResman, skipError }; - return static_cast<XML::Document*>(ResourceManager::get( - "xml_" + idPath, ResourceLoader::load, &rl)); -} diff --git a/src/resources/loaders/xmlloader.h b/src/resources/loaders/xmlloader.h deleted file mode 100644 index a52186daa..000000000 --- a/src/resources/loaders/xmlloader.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011-2017 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -#ifndef RESOURCES_RESOURCEMANAGER_XMLLOADER_H -#define RESOURCES_RESOURCEMANAGER_XMLLOADER_H - -#include "utils/xml.h" - -#include "localconsts.h" - -namespace Loader -{ - XML::Document *getXml(const std::string &idPath, - const UseVirtFs useResman, - const SkipError skipError) A_WARN_UNUSED; - -} // namespace Loader - -#endif // RESOURCES_RESOURCEMANAGER_XMLLOADER_H |