summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/action.cpp7
-rw-r--r--src/resources/ambientoverlay.cpp1
-rw-r--r--src/resources/animation.cpp4
-rw-r--r--src/resources/buddylist.cpp4
-rw-r--r--src/resources/colordb.cpp126
-rw-r--r--src/resources/colordb.h52
-rw-r--r--src/resources/dye.h5
-rw-r--r--src/resources/image.cpp3
-rw-r--r--src/resources/image.h3
-rw-r--r--src/resources/imageloader.cpp4
-rw-r--r--src/resources/imageset.cpp10
-rw-r--r--src/resources/imageset.h1
-rw-r--r--src/resources/imagewriter.cpp6
-rw-r--r--src/resources/itemdb.cpp12
-rw-r--r--src/resources/itemdb.h4
-rw-r--r--src/resources/iteminfo.cpp3
-rw-r--r--src/resources/mapreader.cpp65
-rw-r--r--src/resources/mapreader.h2
-rw-r--r--src/resources/monsterdb.cpp12
-rw-r--r--src/resources/monsterinfo.cpp5
-rw-r--r--src/resources/monsterinfo.h11
-rw-r--r--src/resources/npcdb.cpp1
-rw-r--r--src/resources/npcdb.h2
-rw-r--r--src/resources/resource.cpp1
-rw-r--r--src/resources/resourcemanager.cpp16
-rw-r--r--src/resources/resourcemanager.h4
-rw-r--r--src/resources/spritedef.cpp3
-rw-r--r--src/resources/spritedef.h4
28 files changed, 269 insertions, 102 deletions
diff --git a/src/resources/action.cpp b/src/resources/action.cpp
index ffbbffb2..f40d3109 100644
--- a/src/resources/action.cpp
+++ b/src/resources/action.cpp
@@ -20,22 +20,17 @@
*/
#include "action.h"
-
-#include <algorithm>
-
#include "animation.h"
#include "../utils/dtor.h"
-
Action::Action()
{
}
Action::~Action()
{
- std::for_each(mAnimations.begin(), mAnimations.end(),
- make_dtor(mAnimations));
+ delete_all(mAnimations);
}
Animation*
diff --git a/src/resources/ambientoverlay.cpp b/src/resources/ambientoverlay.cpp
index 9eee57f0..38d8fc46 100644
--- a/src/resources/ambientoverlay.cpp
+++ b/src/resources/ambientoverlay.cpp
@@ -20,7 +20,6 @@
*/
#include "ambientoverlay.h"
-
#include "image.h"
#include "../graphics.h"
diff --git a/src/resources/animation.cpp b/src/resources/animation.cpp
index d2794e61..596c5fac 100644
--- a/src/resources/animation.cpp
+++ b/src/resources/animation.cpp
@@ -19,10 +19,10 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "animation.h"
-
#include <algorithm>
+#include "animation.h"
+
#include "../utils/dtor.h"
Animation::Animation():
diff --git a/src/resources/buddylist.cpp b/src/resources/buddylist.cpp
index c85105c5..1bd98680 100644
--- a/src/resources/buddylist.cpp
+++ b/src/resources/buddylist.cpp
@@ -21,13 +21,13 @@
#include <algorithm>
#include <cstring>
-#include <iostream>
#include <fstream>
+#include <iostream>
#include "buddylist.h"
-#include "../main.h"
#include "../configuration.h"
+#include "../main.h"
BuddyList::BuddyList()
{
diff --git a/src/resources/colordb.cpp b/src/resources/colordb.cpp
new file mode 100644
index 00000000..3d2e15e0
--- /dev/null
+++ b/src/resources/colordb.cpp
@@ -0,0 +1,126 @@
+/*
+ * Aethyra
+ * Copyright 2008 Aethyra Development Team
+ *
+ * This file is part of Aethyra.
+ *
+ * Aethyra 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.
+ *
+ * Aethyra 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 Aethyra; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <cassert>
+#include <libxml/tree.h>
+
+#include "colordb.h"
+
+#include "../log.h"
+
+#include "../utils/dtor.h"
+#include "../utils/xml.h"
+
+#define HAIR_COLOR_FILE "colors.xml"
+#define TMW_COLOR_FILE "hair.xml"
+
+namespace
+{
+ ColorDB::Colors mColors;
+ bool mLoaded = false;
+ std::string mFail = "#ffffff";
+}
+
+void ColorDB::load()
+{
+ if (mLoaded)
+ {
+ return;
+ }
+
+ XML::Document *doc = new XML::Document(HAIR_COLOR_FILE);
+ xmlNodePtr root = doc->rootNode();
+ bool TMWHair = false;
+
+ if (!root || !xmlStrEqual(root->name, BAD_CAST "colors"))
+ {
+ logger->log("Trying TMW's color file, %s.", TMW_COLOR_FILE);
+
+ TMWHair = true;
+
+ delete doc;
+
+ doc = new XML::Document(TMW_COLOR_FILE);
+ root = doc->rootNode();
+ if (!root || !xmlStrEqual(root->name, BAD_CAST "colors"))
+ {
+ logger->log("ColorDB: Failed");
+ mColors[0] = mFail;
+ mLoaded = true;
+
+ delete doc;
+
+ return;
+ }
+ }
+ for_each_xml_child_node(node, root)
+ {
+ if (xmlStrEqual(node->name, BAD_CAST "color"))
+ {
+ int id = XML::getProperty(node, "id", 0);
+
+ if (mColors.find(id) != mColors.end())
+ {
+ logger->log("ColorDB: Redefinition of dye ID %d", id);
+ }
+
+ TMWHair ? mColors[id] = XML::getProperty(node, "value", "#FFFFFF") :
+ mColors[id] = XML::getProperty(node, "dye", "#FFFFFF");
+
+ logger->log("%d %s", id, mColors[id].c_str());
+ }
+ }
+
+ delete doc;
+
+ mLoaded = true;
+}
+
+void ColorDB::unload()
+{
+ logger->log("Unloading color database...");
+
+ mColors.clear();
+ mLoaded = false;
+}
+
+std::string& ColorDB::get(int id)
+{
+ if(!mLoaded)
+ load();
+
+ ColorIterator i = mColors.find(id);
+
+ if (i == mColors.end())
+ {
+ logger->log("ColorDB: Error, unknown dye ID# %d", id);
+ return mFail;
+ }
+ else
+ {
+ return i->second;
+ }
+}
+
+int ColorDB::size()
+{
+ return mColors.size();
+}
diff --git a/src/resources/colordb.h b/src/resources/colordb.h
new file mode 100644
index 00000000..2b750fa3
--- /dev/null
+++ b/src/resources/colordb.h
@@ -0,0 +1,52 @@
+/*
+ * Aethyra
+ * Copyright 2008 Aethyra Development Team
+ *
+ * This file is part of Aethyra.
+ *
+ * Aethyra 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.
+ *
+ * Aethyra 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 Aethyra; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef _AETHYRA_COLOR_MANAGER_H
+#define _AETHYRA_COLOR_MANAGER_H
+
+#include <map>
+#include <string>
+
+/**
+ * The class that holds the color information.
+ */
+namespace ColorDB
+{
+ /**
+ * Loads the color data from <code>colors.xml</code>.
+ */
+ void load();
+
+ /**
+ * Clear the color data
+ */
+ void unload();
+
+ std::string& get(int id);
+
+ int size();
+
+ // Color DB
+ typedef std::map<int, std::string> Colors;
+ typedef Colors::iterator ColorIterator;
+};
+
+#endif
diff --git a/src/resources/dye.h b/src/resources/dye.h
index 528a1d91..4fb8fd40 100644
--- a/src/resources/dye.h
+++ b/src/resources/dye.h
@@ -22,6 +22,7 @@
#ifndef _TMW_DYE_H
#define _TMW_DYE_H
+#include <string>
#include <vector>
/**
@@ -36,7 +37,7 @@ class Palette
* The string is either a file name or a sequence of hexadecimal RGB
* values separated by ',' and starting with '#'.
*/
- Palette(std::string const &);
+ Palette(std::string const &pallete);
/**
* Gets a pixel color depending on its intensity.
@@ -63,7 +64,7 @@ class Dye
* The parts of string are separated by semi-colons. Each part starts
* by an uppercase letter, followed by a colon and then a palette name.
*/
- Dye(std::string const &);
+ Dye(std::string const &dye);
/**
* Destroys the associated palettes.
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index 77d77f96..35b9c254 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -21,9 +21,8 @@
#include <SDL_image.h>
-#include "image.h"
-
#include "dye.h"
+#include "image.h"
#include "../log.h"
diff --git a/src/resources/image.h b/src/resources/image.h
index 3677696f..6eb33ed9 100644
--- a/src/resources/image.h
+++ b/src/resources/image.h
@@ -22,9 +22,10 @@
#ifndef _TMW_IMAGE_H
#define _TMW_IMAGE_H
+#include <SDL.h>
+
#include "../main.h"
-#include <SDL.h>
#ifdef USE_OPENGL
/* The definition of OpenGL extensions by SDL is giving problems with recent
diff --git a/src/resources/imageloader.cpp b/src/resources/imageloader.cpp
index 29458ba3..a7e813d7 100644
--- a/src/resources/imageloader.cpp
+++ b/src/resources/imageloader.cpp
@@ -21,12 +21,12 @@
#include <cassert>
#include <string>
+
#include <guichan/color.hpp>
#include <guichan/sdl/sdlpixel.hpp>
-#include "imageloader.h"
-
#include "image.h"
+#include "imageloader.h"
#include "resourcemanager.h"
ProxyImage::ProxyImage(SDL_Surface *s):
diff --git a/src/resources/imageset.cpp b/src/resources/imageset.cpp
index d7398c17..b321439a 100644
--- a/src/resources/imageset.cpp
+++ b/src/resources/imageset.cpp
@@ -19,14 +19,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <algorithm>
-
+#include "image.h"
#include "imageset.h"
#include "../log.h"
-#include "image.h"
-
#include "../utils/dtor.h"
ImageSet::ImageSet(Image *img, int width, int height)
@@ -44,11 +41,10 @@ ImageSet::ImageSet(Image *img, int width, int height)
ImageSet::~ImageSet()
{
- for_each(mImages.begin(), mImages.end(), make_dtor(mImages));
+ delete_all(mImages);
}
-Image*
-ImageSet::get(size_type i) const
+Image* ImageSet::get(size_type i) const
{
if (i >= mImages.size())
{
diff --git a/src/resources/imageset.h b/src/resources/imageset.h
index 58b7a8ea..26ce99ea 100644
--- a/src/resources/imageset.h
+++ b/src/resources/imageset.h
@@ -28,7 +28,6 @@
class Image;
-
/**
* Stores a set of subimages originating from a single image.
*/
diff --git a/src/resources/imagewriter.cpp b/src/resources/imagewriter.cpp
index d6d8a6c2..36805646 100644
--- a/src/resources/imagewriter.cpp
+++ b/src/resources/imagewriter.cpp
@@ -19,11 +19,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "imagewriter.h"
-
#include <png.h>
-#include <string>
#include <SDL.h>
+#include <string>
+
+#include "imagewriter.h"
#include "../log.h"
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index e6f2fd1f..f4ccc511 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -19,12 +19,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <algorithm>
#include <cassert>
+
#include <libxml/tree.h>
#include "itemdb.h"
-
#include "iteminfo.h"
#include "resourcemanager.h"
@@ -83,7 +82,7 @@ void ItemDB::load()
}
int type = XML::getProperty(node, "type", 0);
- int weight = XML::getProperty(node, "weight", 0);
+ //int weight = XML::getProperty(node, "weight", 0);
int view = XML::getProperty(node, "view", 0);
std::string name = XML::getProperty(node, "name", "");
@@ -101,7 +100,7 @@ void ItemDB::load()
itemInfo->setEffect(effect);
itemInfo->setType(type);
itemInfo->setView(view);
- itemInfo->setWeight(weight);
+ //itemInfo->setWeight(weight);
itemInfo->setWeaponType(weaponType);
for_each_xml_child_node(itemChild, node)
@@ -126,7 +125,7 @@ void ItemDB::load()
CHECK_PARAM(name, "");
CHECK_PARAM(image, "");
CHECK_PARAM(description, "");
- CHECK_PARAM(effect, "");
+ // CHECK_PARAM(effect, "");
// CHECK_PARAM(type, 0);
// CHECK_PARAM(weight, 0);
// CHECK_PARAM(slot, 0);
@@ -144,7 +143,7 @@ void ItemDB::unload()
delete mUnknown;
mUnknown = NULL;
- for_each(mItemInfos.begin(), mItemInfos.end(), make_dtor(mItemInfos));
+ delete_all(mItemInfos);
mItemInfos.clear();
mLoaded = false;
}
@@ -175,7 +174,6 @@ void loadSpriteRef(ItemInfo *itemInfo, xmlNodePtr node)
{
itemInfo->setSprite(filename, 0);
}
-
if (gender == "female" || gender == "unisex")
{
itemInfo->setSprite(filename, 1);
diff --git a/src/resources/itemdb.h b/src/resources/itemdb.h
index 62a1e94c..9b661a60 100644
--- a/src/resources/itemdb.h
+++ b/src/resources/itemdb.h
@@ -22,10 +22,10 @@
#ifndef _TMW_ITEM_MANAGER_H
#define _TMW_ITEM_MANAGER_H
-#include "iteminfo.h"
-
#include <map>
+#include "iteminfo.h"
+
/**
* The namespace that holds the item information.
*/
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index fb2c8ffe..5daeafe6 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -19,9 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "iteminfo.h"
-
#include "itemdb.h"
+#include "iteminfo.h"
const std::string&
ItemInfo::getSprite(int gender) const
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 4c37c239..b4beb558 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -19,14 +19,13 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "mapreader.h"
-
#include <cassert>
#include <iostream>
#include <zlib.h>
-#include "resourcemanager.h"
#include "image.h"
+#include "mapreader.h"
+#include "resourcemanager.h"
#include "../log.h"
#include "../map.h"
@@ -143,8 +142,7 @@ inflateMemory(unsigned char *in, unsigned int inLength,
return outLength;
}
-Map*
-MapReader::readMap(const std::string &filename)
+Map* MapReader::readMap(const std::string &filename)
{
// Load the file through resource manager
ResourceManager *resman = ResourceManager::getInstance();
@@ -207,14 +205,11 @@ MapReader::readMap(xmlNodePtr node, const std::string &path)
// Take the filename off the path
const std::string pathDir = path.substr(0, path.rfind("/") + 1);
- //xmlChar *prop = xmlGetProp(node, BAD_CAST "version");
- //xmlFree(prop);
-
const int w = XML::getProperty(node, "width", 0);
const int h = XML::getProperty(node, "height", 0);
- const int tw = XML::getProperty(node, "tilewidth", DEFAULT_TILE_WIDTH);
- const int th = XML::getProperty(node, "tileheight", DEFAULT_TILE_HEIGHT);
- Map *map = new Map(w, h, tw, th);
+ const int tilew = XML::getProperty(node, "tilewidth", DEFAULT_TILE_WIDTH);
+ const int tileh = XML::getProperty(node, "tileheight", DEFAULT_TILE_HEIGHT);
+ Map *map = new Map(w, h, tilew, tileh);
for_each_xml_child_node(childNode, node)
{
@@ -238,8 +233,8 @@ MapReader::readMap(xmlNodePtr node, const std::string &path)
// The object group offset is applied to each object individually
const int tileOffsetX = XML::getProperty(childNode, "x", 0);
const int tileOffsetY = XML::getProperty(childNode, "y", 0);
- const int offsetX = tileOffsetX * tw;
- const int offsetY = tileOffsetY * th;
+ const int offsetX = tileOffsetX * tilew;
+ const int offsetY = tileOffsetY * tileh;
for_each_xml_child_node(objectNode, childNode)
{
@@ -289,8 +284,7 @@ MapReader::readMap(xmlNodePtr node, const std::string &path)
return map;
}
-void
-MapReader::readProperties(xmlNodePtr node, Properties* props)
+void MapReader::readProperties(xmlNodePtr node, Properties* props)
{
for_each_xml_child_node(childNode, node)
{
@@ -329,8 +323,8 @@ MapReader::readLayer(xmlNodePtr node, Map *map)
const int offsetY = XML::getProperty(node, "y", 0);
const std::string name = XML::getProperty(node, "name", "");
- const bool isFringeLayer = (name == "Fringe");
- const bool isCollisionLayer = (name == "Collision");
+ const bool isFringeLayer = (name.substr(0,6) == "Fringe");
+ const bool isCollisionLayer = (name.substr(0,9) == "Collision");
MapLayer *layer = 0;
@@ -365,15 +359,15 @@ MapReader::readLayer(xmlNodePtr node, Map *map)
xmlNodePtr dataChild = childNode->xmlChildrenNode;
if (!dataChild)
continue;
-
+
int len = strlen((const char*)dataChild->content) + 1;
unsigned char *charData = new unsigned char[len + 1];
const char *charStart = (const char*)dataChild->content;
unsigned char *charIndex = charData;
-
+
while (*charStart) {
if (*charStart != ' ' && *charStart != '\t' &&
- *charStart != '\n')
+ *charStart != '\n')
{
*charIndex = *charStart;
charIndex++;
@@ -426,10 +420,10 @@ MapReader::readLayer(xmlNodePtr node, Map *map)
}
}
else {
- // Read plain XML map file
- for_each_xml_child_node(childNode2, childNode)
- {
- if (!xmlStrEqual(childNode2->name, BAD_CAST "tile"))
+ // Read plain XML map file
+ for_each_xml_child_node(childNode2, childNode)
+ {
+ if (!xmlStrEqual(childNode2->name, BAD_CAST "tile"))
continue;
const int gid = XML::getProperty(childNode2, "gid", -1);
@@ -443,12 +437,12 @@ MapReader::readLayer(xmlNodePtr node, Map *map)
}
}
}
-
+
if (y < h)
std::cerr << "TOO SMALL!\n";
if (x)
std::cerr << "TOO SMALL!\n";
-
+
// There can be only one data element
break;
}
@@ -459,13 +453,17 @@ MapReader::readTileset(xmlNodePtr node,
const std::string &path,
Map *map)
{
+ int firstGid = XML::getProperty(node, "firstgid", 0);
+ XML::Document* doc = NULL;
+
if (xmlHasProp(node, BAD_CAST "source"))
{
- logger->log("Warning: External tilesets not supported yet.");
- return NULL;
+ std::string filename = XML::getProperty(node, "source", "");
+ doc = new XML::Document(filename);
+ node = doc->rootNode();
+ firstGid += XML::getProperty(node, "firstgid", 0);
}
- const int firstGid = XML::getProperty(node, "firstgid", 0);
const int tw = XML::getProperty(node, "tilewidth", map->getTileWidth());
const int th = XML::getProperty(node, "tileheight", map->getTileHeight());
@@ -479,7 +477,8 @@ MapReader::readTileset(xmlNodePtr node,
if (!source.empty())
{
std::string sourceStr = source;
- sourceStr.erase(0, 3); // Remove "../"
+ while (sourceStr.substr(0, 3) == "../")
+ sourceStr.erase(0, 3); // Remove "../"
ResourceManager *resman = ResourceManager::getInstance();
Image* tilebmp = resman->getImage(sourceStr);
@@ -488,11 +487,11 @@ MapReader::readTileset(xmlNodePtr node,
{
Tileset *set = new Tileset(tilebmp, tw, th, firstGid);
tilebmp->decRef();
+ delete doc;
return set;
}
else {
- logger->log("Warning: Failed to load tileset (%s)",
- source.c_str());
+ logger->log("Warning: Failed to load tileset (%s)", source.c_str());
}
}
@@ -500,5 +499,7 @@ MapReader::readTileset(xmlNodePtr node,
break;
}
+ delete doc;
+
return NULL;
}
diff --git a/src/resources/mapreader.h b/src/resources/mapreader.h
index 0142eb45..ef52564e 100644
--- a/src/resources/mapreader.h
+++ b/src/resources/mapreader.h
@@ -26,8 +26,8 @@
#include <libxml/tree.h>
-class Properties;
class Map;
+class Properties;
class Tileset;
/**
diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp
index 11b2baf7..4d52b8ad 100644
--- a/src/resources/monsterdb.cpp
+++ b/src/resources/monsterdb.cpp
@@ -19,10 +19,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <algorithm>
-
#include "monsterdb.h"
-
#include "resourcemanager.h"
#include "../log.h"
@@ -126,6 +123,12 @@ MonsterDB::load()
}
}
+ if (xmlStrEqual(spriteNode->name, BAD_CAST "attack"))
+ {
+ std::string event = XML::getProperty(spriteNode, "particle-effect", "");
+ currentInfo->addAttackParticleEffect(event);
+ }
+
if (xmlStrEqual(spriteNode->name, BAD_CAST "particlefx"))
{
currentInfo->addParticleEffect(
@@ -141,8 +144,7 @@ MonsterDB::load()
void
MonsterDB::unload()
{
- for_each(mMonsterInfos.begin(), mMonsterInfos.end(),
- make_dtor(mMonsterInfos));
+ delete_all(mMonsterInfos);
mMonsterInfos.clear();
mLoaded = false;
diff --git a/src/resources/monsterinfo.cpp b/src/resources/monsterinfo.cpp
index 7661c86b..4a71a122 100644
--- a/src/resources/monsterinfo.cpp
+++ b/src/resources/monsterinfo.cpp
@@ -19,8 +19,6 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include <algorithm>
-
#include "monsterinfo.h"
#include "../utils/dtor.h"
@@ -33,8 +31,7 @@ MonsterInfo::MonsterInfo()
MonsterInfo::~MonsterInfo()
{
// kill vectors in mSoundEffects
- for_each (mSounds.begin(), mSounds.end(),
- make_dtor(mSounds));
+ delete_all(mSounds);
mSounds.clear();
}
diff --git a/src/resources/monsterinfo.h b/src/resources/monsterinfo.h
index 84b131c6..05a78c5a 100644
--- a/src/resources/monsterinfo.h
+++ b/src/resources/monsterinfo.h
@@ -22,14 +22,13 @@
#ifndef _TMW_MONSTERINFO_H_
#define _TMW_MONSTERINFO_H_
+#include <list>
#include <map>
#include <string>
#include <vector>
-#include <list>
#include "../being.h"
-
enum MonsterSoundEvent
{
MONSTER_EVENT_HIT,
@@ -85,11 +84,19 @@ class MonsterInfo
std::string
getSound(MonsterSoundEvent event) const;
+ std::string
+ getAttackParticleEffect() const { return mAttackParticle; }
+
+ void
+ addAttackParticleEffect(const std::string &particleEffect)
+ { mAttackParticle = particleEffect; }
+
const std::list<std::string>&
getParticleEffects() const { return mParticleEffects; }
private:
std::string mName;
+ std::string mAttackParticle;
std::list<std::string> mSprites;
Being::TargetCursorSize mTargetCursorSize;
std::map<MonsterSoundEvent, std::vector<std::string>* > mSounds;
diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp
index 2f8d78d4..3ae58067 100644
--- a/src/resources/npcdb.cpp
+++ b/src/resources/npcdb.cpp
@@ -20,7 +20,6 @@
*/
#include "npcdb.h"
-
#include "resourcemanager.h"
#include "../log.h"
diff --git a/src/resources/npcdb.h b/src/resources/npcdb.h
index 00b4f99b..b4539866 100644
--- a/src/resources/npcdb.h
+++ b/src/resources/npcdb.h
@@ -22,8 +22,8 @@
#ifndef _TMW_NPC_DB_H
#define _TMW_NPC_DB_H
-#include <map>
#include <list>
+#include <map>
#include <string>
struct NPCsprite
diff --git a/src/resources/resource.cpp b/src/resources/resource.cpp
index 449caf55..e9310905 100644
--- a/src/resources/resource.cpp
+++ b/src/resources/resource.cpp
@@ -22,7 +22,6 @@
#include <cassert>
#include "resource.h"
-
#include "resourcemanager.h"
Resource::~Resource()
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 90b29374..510a16bd 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -20,24 +20,22 @@
*/
#include <cassert>
-#include <sstream>
-#include <sys/time.h>
-
#include <physfs.h>
#include <SDL_image.h>
+#include <sstream>
-#include "resourcemanager.h"
+#include <sys/time.h>
#include "dye.h"
#include "image.h"
+#include "imageset.h"
#include "music.h"
+#include "resourcemanager.h"
#include "soundeffect.h"
-#include "imageset.h"
#include "spritedef.h"
#include "../log.h"
-
ResourceManager *ResourceManager::instance = NULL;
ResourceManager::ResourceManager()
@@ -208,7 +206,7 @@ ResourceManager::getPath(const std::string &file)
// get the real path to the file
const char* tmp = PHYSFS_getRealDir(file.c_str());
std::string path;
-
+
// if the file is not in the search path, then its NULL
if (tmp)
{
@@ -217,9 +215,9 @@ ResourceManager::getPath(const std::string &file)
else
{
// if not found in search path return the default path
- path = std::string(TMW_DATADIR) + std::string("data") + "/" + file;
+ path = std::string(AETHYRA_DATADIR) + std::string("data") + "/" + file;
}
-
+
return path;
}
diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h
index 66813a9c..c814d752 100644
--- a/src/resources/resourcemanager.h
+++ b/src/resources/resourcemanager.h
@@ -27,11 +27,11 @@
#include <string>
#include <vector>
-class Resource;
class Image;
+class ImageSet;
class Music;
+class Resource;
class SoundEffect;
-class ImageSet;
class SpriteDef;
struct SDL_Surface;
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index 289df2e5..b4193fd3 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -21,14 +21,13 @@
#include <set>
-#include "spritedef.h"
-
#include "action.h"
#include "animation.h"
#include "dye.h"
#include "image.h"
#include "imageset.h"
#include "resourcemanager.h"
+#include "spritedef.h"
#include "../log.h"
#include "../utils/xml.h"
diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h
index c7b94d9a..4b712340 100644
--- a/src/resources/spritedef.h
+++ b/src/resources/spritedef.h
@@ -25,10 +25,10 @@
#include <map>
#include <string>
-#include "resource.h"
-
#include <libxml/tree.h>
+#include "resource.h"
+
class Action;
class ImageSet;