From a3360d4c38e8dd43d6e71cc4bd38f8dc96040b2e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 24 May 2012 01:20:43 +0300 Subject: Dehardcode some old paths. --- src/actorsprite.cpp | 12 ++++++++---- src/gui/minimap.cpp | 4 ++-- src/item.cpp | 2 +- src/textcommand.cpp | 5 ++++- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp index 267392a6c..4611ddbd2 100644 --- a/src/actorsprite.cpp +++ b/src/actorsprite.cpp @@ -23,6 +23,7 @@ #include "actorspritelistener.h" #include "client.h" +#include "configuration.h" #include "effectmanager.h" #include "imagesprite.h" #include "localplayer.h" @@ -328,7 +329,7 @@ void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display, { if (!*it) continue; - std::string file = "graphics/sprites/" + std::string file = paths.getStringValue("sprites") + combineDye2((*it)->sprite, color); int variant = (*it)->variant; @@ -340,7 +341,8 @@ void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display, { if (display.image.empty()) { - addSprite(AnimatedSprite::load("graphics/sprites/error.xml")); + addSprite(AnimatedSprite::load(paths.getStringValue("sprites") + + paths.getStringValue("spriteErrorFile"))); } else { @@ -350,10 +352,12 @@ void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display, { case 0: default: - imagePath = "graphics/items/" + display.image; + imagePath = paths.getStringValue("itemIcons") + + display.image; break; case 1: - imagePath = "graphics/items/" + display.floor; + imagePath = paths.getStringValue("itemIcons") + + display.floor; break; } imagePath = combineDye2(imagePath, color); diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 9c7ab76cb..e4bf62ec6 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -149,8 +149,8 @@ void Minimap::setMap(Map *map) } else { - std::string tempname = - "graphics/minimaps/" + map->getFilename() + ".png"; + std::string tempname = paths.getStringValue("minimaps") + + "graphics/minimaps/" + map->getFilename() + ".png"; ResourceManager *resman = ResourceManager::getInstance(); minimapName = map->getProperty("minimap"); diff --git a/src/item.cpp b/src/item.cpp index fda05aa30..d484f64cb 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -106,7 +106,7 @@ Image *Item::getImage(int id, unsigned char color) ResourceManager *resman = ResourceManager::getInstance(); const ItemInfo &info = ItemDB::get(id); SpriteDisplay display = info.getDisplay(); - std::string imagePath = "graphics/items/" + display.image; + std::string imagePath = paths.getStringValue("itemIcons") + display.image; Image *image; image = resman->getImage(combineDye2(imagePath, info.getDyeColorsString(color))); diff --git a/src/textcommand.cpp b/src/textcommand.cpp index ec9e97f61..2ca1e3996 100644 --- a/src/textcommand.cpp +++ b/src/textcommand.cpp @@ -22,6 +22,8 @@ #include "textcommand.h" +#include "configuration.h" + #include "gui/theme.h" #include "resources/image.h" @@ -111,7 +113,8 @@ void TextCommand::loadImage() ResourceManager *resman = ResourceManager::getInstance(); SpriteDisplay display = ItemDB::get(getIcon()).getDisplay(); - mImage = resman->getImage("graphics/items/" + display.image); + mImage = resman->getImage(paths.getStringValue("itemIcons") + + display.image); if (!mImage) mImage = Theme::getImageFromTheme("unknown-item.png"); -- cgit v1.2.3-70-g09d2