diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-05-25 14:13:51 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-05-25 14:13:51 +0300 |
commit | e2f03241a1ba9d6b536b0b7a6f995e4e8d894408 (patch) | |
tree | 2bfd5cda7899a5793de62b5f47925a09eac320f5 /src | |
parent | 59271755dc75f5de6c288308df92f687deaa32b4 (diff) | |
download | manaplus-e2f03241a1ba9d6b536b0b7a6f995e4e8d894408.tar.gz manaplus-e2f03241a1ba9d6b536b0b7a6f995e4e8d894408.tar.bz2 manaplus-e2f03241a1ba9d6b536b0b7a6f995e4e8d894408.tar.xz manaplus-e2f03241a1ba9d6b536b0b7a6f995e4e8d894408.zip |
Move images load function from resourcemanager into separate file.
Diffstat (limited to 'src')
25 files changed, 187 insertions, 102 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c9ee566af..5e19cf6af 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -719,6 +719,8 @@ SET(SRCS resources/db/skillunitdb.h resources/resource.cpp resources/resource.h + resources/loaders/imageloader.cpp + resources/loaders/imageloader.h resources/loaders/musicloader.cpp resources/loaders/musicloader.h resources/resourcemanager/resourcemanager.cpp @@ -1411,6 +1413,8 @@ SET(DYE_CMD_SRCS resources/imagewriter.h resources/resource.cpp resources/resource.h + resources/loaders/imageloader.cpp + resources/loaders/imageloader.h resources/loaders/musicloader.cpp resources/loaders/musicloader.h resources/resourcemanager/resourcemanager.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 1ebcef7fd..72c492c75 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -390,6 +390,8 @@ SRC += events/actionevent.h \ enums/resources/questtype.h \ resources/resource.cpp \ resources/resource.h \ + resources/loaders/imageloader.cpp \ + resources/loaders/imageloader.h \ resources/loaders/musicloader.cpp \ resources/loaders/musicloader.h \ resources/resourcemanager/resourcemanager.cpp \ diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp index adcae1cb6..9b9361fb8 100644 --- a/src/being/actorsprite.cpp +++ b/src/being/actorsprite.cpp @@ -37,7 +37,7 @@ #include "resources/db/statuseffectdb.h" -#include "resources/resourcemanager/resourcemanager.h" +#include "resources/loaders/imageloader.h" #include "resources/sprite/animatedsprite.h" #include "resources/sprite/imagesprite.h" @@ -416,7 +416,7 @@ void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display, break; } imagePath = combineDye2(imagePath, color); - Image *img = resourceManager->getImage(imagePath); + Image *img = ImageLoader::getImage(imagePath); if (!img) img = Theme::getImageFromTheme("unknown-item.png"); diff --git a/src/dyetool/dyemain.cpp b/src/dyetool/dyemain.cpp index 3c97585c2..4a94e76ed 100644 --- a/src/dyetool/dyemain.cpp +++ b/src/dyetool/dyemain.cpp @@ -32,6 +32,8 @@ #include "resources/surfaceimagehelper.h" #endif +#include "resources/loaders/imageloader.h" + #include "resources/resourcemanager/resourcemanager.h" #include "utils/gettext.h" @@ -95,7 +97,7 @@ int main(int argc, char **argv) dst = argv[2]; } - Image *image = resourceManager->getImage(src); + Image *image = ImageLoader::getImage(src); if (!image) { printf("Error loading image\n"); diff --git a/src/gui/models/langlistmodel.h b/src/gui/models/langlistmodel.h index adbb7fe98..e38c84a74 100644 --- a/src/gui/models/langlistmodel.h +++ b/src/gui/models/langlistmodel.h @@ -24,7 +24,7 @@ #include "gui/models/extendedlistmodel.h" -#include "resources/resourcemanager/resourcemanager.h" +#include "resources/loaders/imageloader.h" #include "utils/gettext.h" @@ -95,7 +95,7 @@ class LangListModel final : public ExtendedListModel const std::string icon = LANG_NAME[f].icon; if (!icon.empty()) { - mIcons[f] = resourceManager->getImage("graphics/flags/" + mIcons[f] = ImageLoader::getImage("graphics/flags/" + icon); } else diff --git a/src/gui/popups/itempopup.cpp b/src/gui/popups/itempopup.cpp index 619bd38db..9ea7b2d9a 100644 --- a/src/gui/popups/itempopup.cpp +++ b/src/gui/popups/itempopup.cpp @@ -42,7 +42,7 @@ #include "resources/item/item.h" -#include "resources/resourcemanager/resourcemanager.h" +#include "resources/loaders/imageloader.h" #include "net/beinghandler.h" #include "net/serverfeatures.h" @@ -179,7 +179,7 @@ void ItemPopup::setItem(const ItemInfo &item, if (showImage) { - Image *const image = resourceManager->getImage(combineDye2( + Image *const image = ImageLoader::getImage(combineDye2( paths.getStringValue("itemIcons").append(item.getDisplay().image), item.getDyeIconColorsString(color))); diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp index c8468a26d..58840f9a8 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -37,6 +37,8 @@ #include "resources/dye/dyepalette.h" +#include "resources/loaders/imageloader.h" + #include "resources/resourcemanager/resourcemanager.h" #include "utils/dtor.h" @@ -639,7 +641,7 @@ std::string Theme::resolveThemePath(const std::string &path) Image *Theme::getImageFromTheme(const std::string &path) { - return resourceManager->getImage(resolveThemePath(path)); + return ImageLoader::getImage(resolveThemePath(path)); } ImageSet *Theme::getImageSetFromTheme(const std::string &path, diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 91727babe..bb79ccb38 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -45,6 +45,8 @@ #include "resources/db/itemdb.h" +#include "resources/loaders/imageloader.h" + #include "resources/resourcemanager/resourcemanager.h" #include "utils/stringutils.h" @@ -628,7 +630,7 @@ int BrowserBox::calcHeight() const size_t sz = str.size(); if (sz > 2 && str.substr(sz - 1) == "~") str = str.substr(0, sz - 1); - Image *const img = resourceManager->getImage(str); + Image *const img = ImageLoader::getImage(str); if (img) { img->incRef(); diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp index dee4ebebd..304533c3a 100644 --- a/src/gui/widgets/icon.cpp +++ b/src/gui/widgets/icon.cpp @@ -28,6 +28,8 @@ #include "resources/image.h" +#include "resources/loaders/imageloader.h" + #include "resources/resourcemanager/resourcemanager.h" #include "debug.h" @@ -36,7 +38,7 @@ Icon::Icon(const Widget2 *const widget, const std::string &file, const AutoRelease autoRelease) : Widget(widget), - mImage(resourceManager->getImage(file)), + mImage(ImageLoader::getImage(file)), mAutoRelease(autoRelease) { if (mImage) diff --git a/src/gui/widgets/skilldata.cpp b/src/gui/widgets/skilldata.cpp index 0360cd4bb..f412cb7a0 100644 --- a/src/gui/widgets/skilldata.cpp +++ b/src/gui/widgets/skilldata.cpp @@ -28,7 +28,7 @@ #include "resources/image.h" -#include "resources/resourcemanager/resourcemanager.h" +#include "resources/loaders/imageloader.h" #include "debug.h" @@ -61,7 +61,7 @@ SkillData::~SkillData() void SkillData::setIcon(const std::string &iconPath) { if (!iconPath.empty()) - icon = resourceManager->getImage(iconPath); + icon = ImageLoader::getImage(iconPath); if (!icon) { diff --git a/src/gui/windows/mailviewwindow.cpp b/src/gui/windows/mailviewwindow.cpp index 78184c671..586703937 100644 --- a/src/gui/windows/mailviewwindow.cpp +++ b/src/gui/windows/mailviewwindow.cpp @@ -41,7 +41,7 @@ #include "resources/image.h" #include "resources/iteminfo.h" -#include "resources/resourcemanager/resourcemanager.h" +#include "resources/loaders/imageloader.h" #include "resources/db/itemdb.h" @@ -110,7 +110,7 @@ MailViewWindow::MailViewWindow(const MailMessage *const message) : { const ItemInfo &item = ItemDB::get(message->itemId); // +++ need use message->cards and ItemColorManager for colors - Image *const image = resourceManager->getImage(combineDye2( + Image *const image = ImageLoader::getImage(combineDye2( paths.getStringValue("itemIcons").append( item.getDisplay().image), item.getDyeIconColorsString(ItemColor_one))); diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp index e21f51742..746b452fe 100644 --- a/src/gui/windows/minimap.cpp +++ b/src/gui/windows/minimap.cpp @@ -44,7 +44,7 @@ #include "resources/map/map.h" #include "resources/map/metatile.h" -#include "resources/resourcemanager/resourcemanager.h" +#include "resources/loaders/imageloader.h" #include "utils/gettext.h" #include "utils/physfstools.h" @@ -187,7 +187,7 @@ void Minimap::setMap(const Map *const map) } if (!minimapName.empty()) - mMapImage = resourceManager->getImage(minimapName); + mMapImage = ImageLoader::getImage(minimapName); else mMapImage = nullptr; mCustomMapImage = false; diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index 5b573d693..92a57da43 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -67,7 +67,7 @@ #include "resources/item/complexitem.h" -#include "resources/resourcemanager/resourcemanager.h" +#include "resources/loaders/imageloader.h" #include "net/npchandler.h" #include "net/packetlimiter.h" @@ -730,7 +730,7 @@ void NpcDialog::parseListItems(const std::string &itemString) else { mItems.push_back(tmp.substr(pos + 1)); - Image *const img = resourceManager->getImage(std::string( + Image *const img = ImageLoader::getImage(std::string( path).append(tmp.substr(0, pos)).append(".png")); mImages.push_back(img); } diff --git a/src/particle/particle.cpp b/src/particle/particle.cpp index 422dbe561..3c3a0b836 100644 --- a/src/particle/particle.cpp +++ b/src/particle/particle.cpp @@ -34,7 +34,7 @@ #include "resources/dye/dye.h" -#include "resources/resourcemanager/resourcemanager.h" +#include "resources/loaders/imageloader.h" #include "utils/delete2.h" #include "utils/dtor.h" @@ -440,7 +440,7 @@ Particle *Particle::addEffect(const std::string &restrict particleEffectFile, imageSrc = XmlChildContent(node); if (!imageSrc.empty() && !dyePalettes.empty()) Dye::instantiate(imageSrc, dyePalettes); - Image *const img = resourceManager->getImage(imageSrc); + Image *const img = ImageLoader::getImage(imageSrc); newParticle = new ImageParticle(img); newParticle->setMap(mMap); diff --git a/src/particle/particleemitter.cpp b/src/particle/particleemitter.cpp index 35a1a8ddb..fa0f45fc7 100644 --- a/src/particle/particleemitter.cpp +++ b/src/particle/particleemitter.cpp @@ -34,6 +34,8 @@ #include "resources/dye/dye.h" +#include "resources/loaders/imageloader.h" + #include "resources/resourcemanager/resourcemanager.h" #include "debug.h" @@ -119,7 +121,7 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtrConst emitterNode, { if (!dyePalettes.empty()) Dye::instantiate(image, dyePalettes); - mParticleImage = resourceManager->getImage(image); + mParticleImage = ImageLoader::getImage(image); } } else if (name == "subimage") @@ -131,7 +133,7 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtrConst emitterNode, { if (!dyePalettes.empty()) Dye::instantiate(image, dyePalettes); - Image *img = resourceManager->getImage(image); + Image *img = ImageLoader::getImage(image); if (img) { mParticleImage = resourceManager->getSubImage(img, @@ -370,7 +372,7 @@ ImageSet *ParticleEmitter::getImageSet(XmlNodePtrConst node) const int subX = XML::getProperty(node, "subX", -1); if (subX != -1) { - Image *const img = resourceManager->getImage(XML::getProperty( + Image *const img = ImageLoader::getImage(XML::getProperty( node, "imageset", "")); if (!img) return nullptr; diff --git a/src/particle/particleengine.cpp b/src/particle/particleengine.cpp index 81387a38b..bd05e967b 100644 --- a/src/particle/particleengine.cpp +++ b/src/particle/particleengine.cpp @@ -31,7 +31,7 @@ #include "resources/dye/dye.h" -#include "resources/resourcemanager/resourcemanager.h" +#include "resources/loaders/imageloader.h" #include "utils/dtor.h" @@ -176,7 +176,7 @@ Particle *ParticleEngine::addEffect(const std::string &restrict imageSrc = XmlChildContent(node); if (!imageSrc.empty() && !dyePalettes.empty()) Dye::instantiate(imageSrc, dyePalettes); - Image *const img = resourceManager->getImage(imageSrc); + Image *const img = ImageLoader::getImage(imageSrc); newParticle = new ImageParticle(img); newParticle->setMap(mMap); diff --git a/src/resources/item/item.cpp b/src/resources/item/item.cpp index d62d9aaf1..8400e2675 100644 --- a/src/resources/item/item.cpp +++ b/src/resources/item/item.cpp @@ -30,7 +30,7 @@ #include "resources/iteminfo.h" -#include "resources/resourcemanager/resourcemanager.h" +#include "resources/loaders/imageloader.h" #include "net/serverfeatures.h" @@ -100,7 +100,7 @@ void Item::setId(const int id, const std::string dye = combineDye2(paths.getStringValue( "itemIcons").append(info.getDisplay().image), info.getDyeIconColorsString(color)); - mImage = resourceManager->getImage(dye); + mImage = ImageLoader::getImage(dye); if (!mImage) { @@ -121,7 +121,7 @@ Image *Item::getImage(const int id, const ItemColor color) { const ItemInfo &info = ItemDB::get(id); - Image *image = resourceManager->getImage(combineDye2(paths.getStringValue( + Image *image = ImageLoader::getImage(combineDye2(paths.getStringValue( "itemIcons").append(info.getDisplay().image), info.getDyeIconColorsString(color))); diff --git a/src/resources/loaders/imageloader.cpp b/src/resources/loaders/imageloader.cpp new file mode 100644 index 000000000..936d9b090 --- /dev/null +++ b/src/resources/loaders/imageloader.cpp @@ -0,0 +1,88 @@ +/* + * The ManaPlus Client + * Copyright (C) 2004-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011-2016 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 "logger.h" + +#include "resources/image.h" +#include "resources/imagehelper.h" + +#include "resources/loaders/imageloader.h" + +#include "resources/resourcemanager/resourcemanager.h" + +#include "resources/dye/dye.h" + +#include "utils/checkutils.h" +#include "utils/physfsrwops.h" + +#include "debug.h" + +namespace +{ + struct DyedImageLoader final + { + std::string path; + static Resource *load(const void *const v) + { + BLOCK_START("DyedImageLoader::load") + if (!v) + { + BLOCK_END("DyedImageLoader::load") + return nullptr; + } + + const DyedImageLoader *const rl + = static_cast<const DyedImageLoader *const>(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 = MPHYSFSRWOPS_openRead(path1.c_str()); + if (!rw) + { + delete d; + reportAlways("Image loading error: %s", path1.c_str()); + BLOCK_END("DyedImageLoader::load") + return nullptr; + } + Resource *const res = d ? imageHelper->load(rw, *d) + : imageHelper->load(rw); + delete d; + if (!res) + reportAlways("Image loading error: %s", path1.c_str()); + BLOCK_END("DyedImageLoader::load") + return res; + } + }; +} // namespace + +Image *ImageLoader::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 new file mode 100644 index 000000000..6d60782a5 --- /dev/null +++ b/src/resources/loaders/imageloader.h @@ -0,0 +1,41 @@ +/* + * The ManaPlus Client + * Copyright (C) 2004-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011-2016 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 ImageLoader +{ + /** + * Convenience wrapper around ResourceManager::get for loading + * images. + */ + Image *getImage(const std::string &idPath) A_WARN_UNUSED; +} // namespace ImageLoader + +#endif // RESOURCES_LOADERS_IMAGELOADER_H diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp index 7fde6a005..a5e14fc10 100644 --- a/src/resources/map/map.cpp +++ b/src/resources/map/map.cpp @@ -52,7 +52,7 @@ #include "resources/map/mapobjectlist.h" #include "resources/map/tileanimation.h" -#include "resources/resourcemanager/resourcemanager.h" +#include "resources/loaders/imageloader.h" #ifdef USE_OPENGL #include "render/renderers.h" @@ -236,7 +236,7 @@ void Map::initializeAmbientLayers() restrict2 break; // the FOR loop } - Image *restrict const img = resourceManager->getImage( + Image *restrict const img = ImageLoader::getImage( getProperty(name + "image")); if (img) { @@ -266,7 +266,7 @@ void Map::initializeAmbientLayers() restrict2 toString(i)).append("image")); i ++) { const std::string name("background" + toString(i)); - Image *restrict const img = resourceManager->getImage( + Image *restrict const img = ImageLoader::getImage( getProperty(name + "image")); if (img) diff --git a/src/resources/map/mapitem.cpp b/src/resources/map/mapitem.cpp index 58a105ab9..6443bb196 100644 --- a/src/resources/map/mapitem.cpp +++ b/src/resources/map/mapitem.cpp @@ -29,7 +29,7 @@ #include "resources/image.h" -#include "resources/resourcemanager/resourcemanager.h" +#include "resources/loaders/imageloader.h" #include "render/graphics.h" @@ -115,7 +115,7 @@ void MapItem::setType(const int type) } if (!name.empty()) - mImage = resourceManager->getImage(name); + mImage = ImageLoader::getImage(name); else mImage = nullptr; } diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 979153c87..036918f66 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -46,6 +46,8 @@ #include "resources/map/tileanimation.h" +#include "resources/loaders/imageloader.h" + #include "resources/resourcemanager/resourcemanager.h" #include "utils/base64.h" @@ -1048,7 +1050,7 @@ Tileset *MapReader::readTileset(XmlNodePtr node, if (!source.empty()) { - Image *const tilebmp = resourceManager->getImage( + Image *const tilebmp = ImageLoader::getImage( resolveRelativePath(pathDir, source)); if (tilebmp) diff --git a/src/resources/resourcemanager/resourcemanager.cpp b/src/resources/resourcemanager/resourcemanager.cpp index abec23475..0cff0fb2c 100644 --- a/src/resources/resourcemanager/resourcemanager.cpp +++ b/src/resources/resourcemanager/resourcemanager.cpp @@ -37,11 +37,11 @@ #include "resources/imagehelper.h" #include "resources/imageset.h" #include "resources/memorymanager.h" -#include "resources/sdlmusic.h" -#include "resources/soundeffect.h" #include "resources/dye/dye.h" +#include "resources/loaders/imageloader.h" + #include "resources/sprite/spritedef.h" #include "utils/checkutils.h" @@ -527,62 +527,8 @@ Resource *ResourceManager::get(const std::string &idPath, return resource; } -struct DyedImageLoader final -{ - ResourceManager *manager; - std::string path; - static Resource *load(const void *const v) - { - BLOCK_START("DyedImageLoader::load") - if (!v) - { - BLOCK_END("DyedImageLoader::load") - return nullptr; - } - - const DyedImageLoader *const rl - = static_cast<const DyedImageLoader *const>(v); - if (!rl->manager) - { - BLOCK_END("DyedImageLoader::load") - return nullptr; - } - - 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 = MPHYSFSRWOPS_openRead(path1.c_str()); - if (!rw) - { - delete d; - reportAlways("Image loading error: %s", path1.c_str()); - BLOCK_END("DyedImageLoader::load") - return nullptr; - } - Resource *const res = d ? imageHelper->load(rw, *d) - : imageHelper->load(rw); - delete d; - if (!res) - reportAlways("Image loading error: %s", path1.c_str()); - BLOCK_END("DyedImageLoader::load") - return res; - } -}; - -Image *ResourceManager::getImage(const std::string &idPath) -{ - DyedImageLoader rl = { this, idPath }; - return static_cast<Image*>(get(idPath, DyedImageLoader::load, &rl)); -} - struct ImageSetLoader final { - ResourceManager *manager; std::string path; int w, h; static Resource *load(const void *const v) @@ -592,10 +538,8 @@ struct ImageSetLoader final const ImageSetLoader *const rl = static_cast<const ImageSetLoader *const>(v); - if (!rl->manager) - return nullptr; - Image *const img = rl->manager->getImage(rl->path); + Image *const img = ImageLoader::getImage(rl->path); if (!img) { reportAlways("Image loading error: %s", rl->path.c_str()); @@ -610,7 +554,7 @@ struct ImageSetLoader final ImageSet *ResourceManager::getImageSet(const std::string &imagePath, const int w, const int h) { - ImageSetLoader rl = { this, imagePath, w, h }; + ImageSetLoader rl = { imagePath, w, h }; std::stringstream ss; ss << imagePath << "[" << w << "x" << h << "]"; return static_cast<ImageSet*>(get(ss.str(), ImageSetLoader::load, &rl)); diff --git a/src/resources/resourcemanager/resourcemanager.h b/src/resources/resourcemanager/resourcemanager.h index 613934f91..1cc4fab68 100644 --- a/src/resources/resourcemanager/resourcemanager.h +++ b/src/resources/resourcemanager/resourcemanager.h @@ -134,12 +134,6 @@ class ResourceManager final : public MemoryCounter bool addResource(const std::string &idPath, Resource *const resource); /** - * Convenience wrapper around ResourceManager::get for loading - * images. - */ - Image *getImage(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 */ diff --git a/src/textcommand.cpp b/src/textcommand.cpp index 9fabb4572..e83e1f08a 100644 --- a/src/textcommand.cpp +++ b/src/textcommand.cpp @@ -31,7 +31,7 @@ #include "resources/db/itemdb.h" -#include "resources/resourcemanager/resourcemanager.h" +#include "resources/loaders/imageloader.h" #include "debug.h" @@ -128,7 +128,7 @@ void TextCommand::loadImage() return; const SpriteDisplay display = ItemDB::get(getIcon()).getDisplay(); - mImage = resourceManager->getImage(paths.getStringValue("itemIcons") + mImage = ImageLoader::getImage(paths.getStringValue("itemIcons") .append(display.image)); if (!mImage) |