From 1b1a7cea1c6b81438bacc86b93cb80a78430790f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 25 May 2016 19:32:59 +0300 Subject: Change namespace in resources loaders from other to Loader. --- src/being/actorsprite.cpp | 2 +- src/dyetool/dyemain.cpp | 2 +- src/gui/models/langlistmodel.h | 2 +- src/gui/popups/itempopup.cpp | 2 +- src/gui/theme.cpp | 2 +- src/gui/widgets/browserbox.cpp | 2 +- src/gui/widgets/icon.cpp | 2 +- src/gui/widgets/skilldata.cpp | 2 +- src/gui/windows/mailviewwindow.cpp | 2 +- src/gui/windows/minimap.cpp | 2 +- src/gui/windows/npcdialog.cpp | 2 +- src/particle/particle.cpp | 2 +- src/particle/particleemitter.cpp | 6 +++--- src/particle/particleengine.cpp | 2 +- src/resources/item/item.cpp | 4 ++-- src/resources/loaders/imageloader.cpp | 2 +- src/resources/loaders/imageloader.h | 4 ++-- src/resources/loaders/musicloader.cpp | 4 ++-- src/resources/loaders/musicloader.h | 4 ++-- src/resources/map/map.cpp | 4 ++-- src/resources/map/mapitem.cpp | 2 +- src/resources/mapreader.cpp | 2 +- src/resources/resourcemanager/resourcemanager.cpp | 2 +- src/soundmanager.cpp | 6 +++--- src/textcommand.cpp | 4 ++-- 25 files changed, 35 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp index 9b9361fb8..6d072adc7 100644 --- a/src/being/actorsprite.cpp +++ b/src/being/actorsprite.cpp @@ -416,7 +416,7 @@ void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display, break; } imagePath = combineDye2(imagePath, color); - Image *img = ImageLoader::getImage(imagePath); + Image *img = Loader::getImage(imagePath); if (!img) img = Theme::getImageFromTheme("unknown-item.png"); diff --git a/src/dyetool/dyemain.cpp b/src/dyetool/dyemain.cpp index 4a94e76ed..4625e95fc 100644 --- a/src/dyetool/dyemain.cpp +++ b/src/dyetool/dyemain.cpp @@ -97,7 +97,7 @@ int main(int argc, char **argv) dst = argv[2]; } - Image *image = ImageLoader::getImage(src); + Image *image = Loader::getImage(src); if (!image) { printf("Error loading image\n"); diff --git a/src/gui/models/langlistmodel.h b/src/gui/models/langlistmodel.h index e38c84a74..1c7ee99dd 100644 --- a/src/gui/models/langlistmodel.h +++ b/src/gui/models/langlistmodel.h @@ -95,7 +95,7 @@ class LangListModel final : public ExtendedListModel const std::string icon = LANG_NAME[f].icon; if (!icon.empty()) { - mIcons[f] = ImageLoader::getImage("graphics/flags/" + mIcons[f] = Loader::getImage("graphics/flags/" + icon); } else diff --git a/src/gui/popups/itempopup.cpp b/src/gui/popups/itempopup.cpp index 9ea7b2d9a..25ba7dafe 100644 --- a/src/gui/popups/itempopup.cpp +++ b/src/gui/popups/itempopup.cpp @@ -179,7 +179,7 @@ void ItemPopup::setItem(const ItemInfo &item, if (showImage) { - Image *const image = ImageLoader::getImage(combineDye2( + Image *const image = Loader::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 796c27216..638b57c28 100644 --- a/src/gui/theme.cpp +++ b/src/gui/theme.cpp @@ -644,7 +644,7 @@ std::string Theme::resolveThemePath(const std::string &path) Image *Theme::getImageFromTheme(const std::string &path) { - return ImageLoader::getImage(resolveThemePath(path)); + return Loader::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 bb79ccb38..ba0698b5f 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -630,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 = ImageLoader::getImage(str); + Image *const img = Loader::getImage(str); if (img) { img->incRef(); diff --git a/src/gui/widgets/icon.cpp b/src/gui/widgets/icon.cpp index 304533c3a..76d5d90b0 100644 --- a/src/gui/widgets/icon.cpp +++ b/src/gui/widgets/icon.cpp @@ -38,7 +38,7 @@ Icon::Icon(const Widget2 *const widget, const std::string &file, const AutoRelease autoRelease) : Widget(widget), - mImage(ImageLoader::getImage(file)), + mImage(Loader::getImage(file)), mAutoRelease(autoRelease) { if (mImage) diff --git a/src/gui/widgets/skilldata.cpp b/src/gui/widgets/skilldata.cpp index f412cb7a0..507942e1b 100644 --- a/src/gui/widgets/skilldata.cpp +++ b/src/gui/widgets/skilldata.cpp @@ -61,7 +61,7 @@ SkillData::~SkillData() void SkillData::setIcon(const std::string &iconPath) { if (!iconPath.empty()) - icon = ImageLoader::getImage(iconPath); + icon = Loader::getImage(iconPath); if (!icon) { diff --git a/src/gui/windows/mailviewwindow.cpp b/src/gui/windows/mailviewwindow.cpp index 586703937..eb075a624 100644 --- a/src/gui/windows/mailviewwindow.cpp +++ b/src/gui/windows/mailviewwindow.cpp @@ -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 = ImageLoader::getImage(combineDye2( + Image *const image = Loader::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 746b452fe..1677169e0 100644 --- a/src/gui/windows/minimap.cpp +++ b/src/gui/windows/minimap.cpp @@ -187,7 +187,7 @@ void Minimap::setMap(const Map *const map) } if (!minimapName.empty()) - mMapImage = ImageLoader::getImage(minimapName); + mMapImage = Loader::getImage(minimapName); else mMapImage = nullptr; mCustomMapImage = false; diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index 92a57da43..b4323feb6 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -730,7 +730,7 @@ void NpcDialog::parseListItems(const std::string &itemString) else { mItems.push_back(tmp.substr(pos + 1)); - Image *const img = ImageLoader::getImage(std::string( + Image *const img = Loader::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 3c3a0b836..f7ecccd93 100644 --- a/src/particle/particle.cpp +++ b/src/particle/particle.cpp @@ -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 = ImageLoader::getImage(imageSrc); + Image *const img = Loader::getImage(imageSrc); newParticle = new ImageParticle(img); newParticle->setMap(mMap); diff --git a/src/particle/particleemitter.cpp b/src/particle/particleemitter.cpp index eaebc16fd..1cfe93f6e 100644 --- a/src/particle/particleemitter.cpp +++ b/src/particle/particleemitter.cpp @@ -122,7 +122,7 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtrConst emitterNode, { if (!dyePalettes.empty()) Dye::instantiate(image, dyePalettes); - mParticleImage = ImageLoader::getImage(image); + mParticleImage = Loader::getImage(image); } } else if (name == "subimage") @@ -134,7 +134,7 @@ ParticleEmitter::ParticleEmitter(const XmlNodePtrConst emitterNode, { if (!dyePalettes.empty()) Dye::instantiate(image, dyePalettes); - Image *img = ImageLoader::getImage(image); + Image *img = Loader::getImage(image); if (img) { mParticleImage = Loader::getSubImage(img, @@ -373,7 +373,7 @@ ImageSet *ParticleEmitter::getImageSet(XmlNodePtrConst node) const int subX = XML::getProperty(node, "subX", -1); if (subX != -1) { - Image *const img = ImageLoader::getImage(XML::getProperty( + Image *const img = Loader::getImage(XML::getProperty( node, "imageset", "")); if (!img) return nullptr; diff --git a/src/particle/particleengine.cpp b/src/particle/particleengine.cpp index bd05e967b..6fd9a79f9 100644 --- a/src/particle/particleengine.cpp +++ b/src/particle/particleengine.cpp @@ -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 = ImageLoader::getImage(imageSrc); + Image *const img = Loader::getImage(imageSrc); newParticle = new ImageParticle(img); newParticle->setMap(mMap); diff --git a/src/resources/item/item.cpp b/src/resources/item/item.cpp index 8400e2675..9d3a1b3f8 100644 --- a/src/resources/item/item.cpp +++ b/src/resources/item/item.cpp @@ -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 = ImageLoader::getImage(dye); + mImage = Loader::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 = ImageLoader::getImage(combineDye2(paths.getStringValue( + Image *image = Loader::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 index 936d9b090..d3ab9facc 100644 --- a/src/resources/loaders/imageloader.cpp +++ b/src/resources/loaders/imageloader.cpp @@ -80,7 +80,7 @@ namespace }; } // namespace -Image *ImageLoader::getImage(const std::string &idPath) +Image *Loader::getImage(const std::string &idPath) { DyedImageLoader rl = { idPath }; return static_cast(resourceManager->get(idPath, diff --git a/src/resources/loaders/imageloader.h b/src/resources/loaders/imageloader.h index 6d60782a5..725511ede 100644 --- a/src/resources/loaders/imageloader.h +++ b/src/resources/loaders/imageloader.h @@ -29,13 +29,13 @@ class Image; -namespace ImageLoader +namespace Loader { /** * Convenience wrapper around ResourceManager::get for loading * images. */ Image *getImage(const std::string &idPath) A_WARN_UNUSED; -} // namespace ImageLoader +} // namespace Loader #endif // RESOURCES_LOADERS_IMAGELOADER_H diff --git a/src/resources/loaders/musicloader.cpp b/src/resources/loaders/musicloader.cpp index 0b47cc269..2751dbfae 100644 --- a/src/resources/loaders/musicloader.cpp +++ b/src/resources/loaders/musicloader.cpp @@ -60,14 +60,14 @@ namespace }; } // namespace -SDLMusic *MusicLoader::getMusic(const std::string &idPath) +SDLMusic *Loader::getMusic(const std::string &idPath) { ResourceLoader rl = { idPath, &SDLMusic::load }; return static_cast(resourceManager->get( idPath, ResourceLoader::load, &rl)); } -SoundEffect *MusicLoader::getSoundEffect(const std::string &idPath) +SoundEffect *Loader::getSoundEffect(const std::string &idPath) { ResourceLoader rl = { idPath, &SoundEffect::load }; return static_cast(resourceManager->get( diff --git a/src/resources/loaders/musicloader.h b/src/resources/loaders/musicloader.h index 0d005414f..233fe9a03 100644 --- a/src/resources/loaders/musicloader.h +++ b/src/resources/loaders/musicloader.h @@ -31,7 +31,7 @@ class SDLMusic; class Resource; class SoundEffect; -namespace MusicLoader +namespace Loader { /** * Convenience wrapper around ResourceManager::get for loading @@ -44,6 +44,6 @@ namespace MusicLoader * samples. */ SoundEffect *getSoundEffect(const std::string &idPath) A_WARN_UNUSED; -} +} // namespace Loader #endif // RESOURCES_RESOURCEMANAGER_MUSICLOADER_H diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp index a5e14fc10..98a29a8e8 100644 --- a/src/resources/map/map.cpp +++ b/src/resources/map/map.cpp @@ -236,7 +236,7 @@ void Map::initializeAmbientLayers() restrict2 break; // the FOR loop } - Image *restrict const img = ImageLoader::getImage( + Image *restrict const img = Loader::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 = ImageLoader::getImage( + Image *restrict const img = Loader::getImage( getProperty(name + "image")); if (img) diff --git a/src/resources/map/mapitem.cpp b/src/resources/map/mapitem.cpp index 6443bb196..eb7676342 100644 --- a/src/resources/map/mapitem.cpp +++ b/src/resources/map/mapitem.cpp @@ -115,7 +115,7 @@ void MapItem::setType(const int type) } if (!name.empty()) - mImage = ImageLoader::getImage(name); + mImage = Loader::getImage(name); else mImage = nullptr; } diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 036918f66..161144a7d 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -1050,7 +1050,7 @@ Tileset *MapReader::readTileset(XmlNodePtr node, if (!source.empty()) { - Image *const tilebmp = ImageLoader::getImage( + Image *const tilebmp = Loader::getImage( resolveRelativePath(pathDir, source)); if (tilebmp) diff --git a/src/resources/resourcemanager/resourcemanager.cpp b/src/resources/resourcemanager/resourcemanager.cpp index e9b8c687b..aca30726b 100644 --- a/src/resources/resourcemanager/resourcemanager.cpp +++ b/src/resources/resourcemanager/resourcemanager.cpp @@ -539,7 +539,7 @@ struct ImageSetLoader final const ImageSetLoader *const rl = static_cast(v); - Image *const img = ImageLoader::getImage(rl->path); + Image *const img = Loader::getImage(rl->path); if (!img) { reportAlways("Image loading error: %s", rl->path.c_str()); diff --git a/src/soundmanager.cpp b/src/soundmanager.cpp index 1ae9cb0a6..004cfacdf 100644 --- a/src/soundmanager.cpp +++ b/src/soundmanager.cpp @@ -330,7 +330,7 @@ static SDLMusic *loadMusic(const std::string &fileName, reportAlways("Music file not found: %s", fileName.c_str()); return nullptr; } - return MusicLoader::getMusic(path); + return Loader::getMusic(path); } void SoundManager::playMusic(const std::string &fileName, @@ -455,7 +455,7 @@ void SoundManager::playSfx(const std::string &path, tmpPath = path; else tmpPath = paths.getValue("sfx", "sfx/").append(path); - SoundEffect *const sample = MusicLoader::getSoundEffect(tmpPath); + SoundEffect *const sample = Loader::getSoundEffect(tmpPath); if (sample) { logger->log("SoundManager::playSfx() Playing: %s", path.c_str()); @@ -497,7 +497,7 @@ void SoundManager::playGuiSfx(const std::string &path) tmpPath = path; else tmpPath = paths.getValue("sfx", "sfx/").append(path); - SoundEffect *const sample = MusicLoader::getSoundEffect(tmpPath); + SoundEffect *const sample = Loader::getSoundEffect(tmpPath); if (sample) { logger->log("SoundManager::playGuiSfx() Playing: %s", path.c_str()); diff --git a/src/textcommand.cpp b/src/textcommand.cpp index e83e1f08a..a89b916fe 100644 --- a/src/textcommand.cpp +++ b/src/textcommand.cpp @@ -128,8 +128,8 @@ void TextCommand::loadImage() return; const SpriteDisplay display = ItemDB::get(getIcon()).getDisplay(); - mImage = ImageLoader::getImage(paths.getStringValue("itemIcons") - .append(display.image)); + mImage = Loader::getImage(paths.getStringValue("itemIcons").append( + display.image)); if (!mImage) mImage = Theme::getImageFromTheme("unknown-item.png"); -- cgit v1.2.3-60-g2f50