diff options
Diffstat (limited to 'src/resources')
42 files changed, 138 insertions, 174 deletions
diff --git a/src/resources/action.cpp b/src/resources/action.cpp index 67acf1b1..e2cb11f2 100644 --- a/src/resources/action.cpp +++ b/src/resources/action.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/action.h b/src/resources/action.h index 8dde068c..649d3828 100644 --- a/src/resources/action.h +++ b/src/resources/action.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/ambientoverlay.cpp b/src/resources/ambientoverlay.cpp index 9585f4f7..32ed47d1 100644 --- a/src/resources/ambientoverlay.cpp +++ b/src/resources/ambientoverlay.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/ambientoverlay.h b/src/resources/ambientoverlay.h index bb61f826..65f9891d 100644 --- a/src/resources/ambientoverlay.h +++ b/src/resources/ambientoverlay.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/animation.cpp b/src/resources/animation.cpp index 901f4f25..54c319de 100644 --- a/src/resources/animation.cpp +++ b/src/resources/animation.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/animation.h b/src/resources/animation.h index bc8431c7..0c461ebe 100644 --- a/src/resources/animation.h +++ b/src/resources/animation.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/colordb.cpp b/src/resources/colordb.cpp index b53798bb..3a8754ea 100644 --- a/src/resources/colordb.cpp +++ b/src/resources/colordb.cpp @@ -1,8 +1,8 @@ /* - * Color Database - * Copyright 2008 Aethyra Development Team + * Color database + * Copyright (C) 2008 Aethyra Development Team * - * This file is part of Aethyra. + * This file is part of The Mana World. * * 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 @@ -15,8 +15,8 @@ * 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, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <libxml/tree.h> diff --git a/src/resources/colordb.h b/src/resources/colordb.h index d4568d54..c581f653 100644 --- a/src/resources/colordb.h +++ b/src/resources/colordb.h @@ -1,8 +1,8 @@ /* - * Color Database - * Copyright 2008 Aethyra Development Team + * Color database + * Copyright (C) 2008 Aethyra Development Team * - * This file is part of Aethyra. + * This file is part of The Mana World. * * 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 @@ -15,8 +15,8 @@ * 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, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef COLOR_MANAGER_H @@ -47,6 +47,6 @@ namespace ColorDB // Color DB typedef std::map<int, std::string> Colors; typedef Colors::iterator ColorIterator; -}; +} #endif diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp index 38249ddb..1e4fd2fd 100644 --- a/src/resources/dye.cpp +++ b/src/resources/dye.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2007 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/dye.h b/src/resources/dye.h index f39ba043..d0d010bc 100644 --- a/src/resources/dye.h +++ b/src/resources/dye.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2007 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp index ec87c5cd..5bc8407a 100644 --- a/src/resources/emotedb.cpp +++ b/src/resources/emotedb.cpp @@ -1,8 +1,8 @@ /* * Emote database - * Copyright 2009 Aethyra Development Team + * Copyright (C) 2009 Aethyra Development Team * - * This file is part of Aethyra. + * This file is part of The Mana World. * * 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 @@ -15,8 +15,8 @@ * 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, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "emotedb.h" diff --git a/src/resources/emotedb.h b/src/resources/emotedb.h index 48e1d53c..691881c8 100644 --- a/src/resources/emotedb.h +++ b/src/resources/emotedb.h @@ -1,8 +1,8 @@ /* * Emote database - * Copyright 2009 Aethyra Development Team + * Copyright (C) 2009 Aethyra Development Team * - * This file is part of Aethyra. + * This file is part of The Mana World. * * 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 @@ -15,8 +15,8 @@ * 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, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef EMOTE_DB_H diff --git a/src/resources/image.cpp b/src/resources/image.cpp index cff40197..b696389f 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/image.h b/src/resources/image.h index f6b77f26..eeaa574e 100644 --- a/src/resources/image.h +++ b/src/resources/image.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/imageloader.cpp b/src/resources/imageloader.cpp index fe420e89..40d62797 100644 --- a/src/resources/imageloader.cpp +++ b/src/resources/imageloader.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2007 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 @@ -88,7 +87,7 @@ void ProxyImage::convertToDisplayFormat() mSDLImage = NULL; } -gcn::Image *ImageLoader::load(std::string const &filename, bool convert) +gcn::Image *ImageLoader::load(const std::string &filename, bool convert) { ResourceManager *resman = ResourceManager::getInstance(); ProxyImage *i = new ProxyImage(resman->loadSDLSurface(filename)); diff --git a/src/resources/imageloader.h b/src/resources/imageloader.h index 2695b99c..1d6c9ae4 100644 --- a/src/resources/imageloader.h +++ b/src/resources/imageloader.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2007 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 @@ -62,7 +61,8 @@ class ProxyImage : public gcn::Image class ImageLoader : public gcn::ImageLoader { public: - gcn::Image *load(std::string const &filename, bool convertToDisplayFormat); + gcn::Image *load(const std::string &filename, + bool convertToDisplayFormat); }; #endif diff --git a/src/resources/imageset.cpp b/src/resources/imageset.cpp index 33be1573..92bb3242 100644 --- a/src/resources/imageset.cpp +++ b/src/resources/imageset.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/imageset.h b/src/resources/imageset.h index ad209aaf..f59c76bb 100644 --- a/src/resources/imageset.h +++ b/src/resources/imageset.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/imagewriter.cpp b/src/resources/imagewriter.cpp index 5ddd24e3..c350ac07 100644 --- a/src/resources/imagewriter.cpp +++ b/src/resources/imagewriter.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/imagewriter.h b/src/resources/imagewriter.h index c69eb2d3..039d3afb 100644 --- a/src/resources/imagewriter.h +++ b/src/resources/imagewriter.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index 2b94bd61..dbd12eee 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 @@ -52,7 +51,7 @@ void ItemDB::load() logger->log("Initializing item database..."); - mUnknown = new ItemInfo(); + mUnknown = new ItemInfo; mUnknown->setName(_("Unknown item")); mUnknown->setImageName(""); mUnknown->setSprite("error.xml", GENDER_MALE); diff --git a/src/resources/itemdb.h b/src/resources/itemdb.h index 1e55f146..08a7acd0 100644 --- a/src/resources/itemdb.h +++ b/src/resources/itemdb.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index 8dcb1c32..2f118284 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h index 0ea59050..2aff68a9 100644 --- a/src/resources/iteminfo.h +++ b/src/resources/iteminfo.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 901a2561..5fa47261 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 @@ -360,12 +359,12 @@ void 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') @@ -427,10 +426,10 @@ void 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); @@ -444,12 +443,12 @@ void 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; } @@ -523,7 +522,7 @@ Tileset *MapReader::readTileset(xmlNodePtr node, // create animation if (!set) continue; - Animation *ani = new Animation(); + Animation *ani = new Animation; for (int i = 0; ;i++) { std::map<std::string, int>::iterator iFrame, iDelay; diff --git a/src/resources/mapreader.h b/src/resources/mapreader.h index 2f64aa8c..0ed553c3 100644 --- a/src/resources/mapreader.h +++ b/src/resources/mapreader.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp index b1965989..e0259b29 100644 --- a/src/resources/monsterdb.cpp +++ b/src/resources/monsterdb.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 @@ -62,7 +61,7 @@ void MonsterDB::load() continue; } - MonsterInfo *currentInfo = new MonsterInfo(); + MonsterInfo *currentInfo = new MonsterInfo; currentInfo->setName(XML::getProperty(monsterNode, "name", _("unnamed"))); diff --git a/src/resources/monsterdb.h b/src/resources/monsterdb.h index e49901d5..0a218661 100644 --- a/src/resources/monsterdb.h +++ b/src/resources/monsterdb.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/monsterinfo.cpp b/src/resources/monsterinfo.cpp index 725e9cf5..734d1e01 100644 --- a/src/resources/monsterinfo.cpp +++ b/src/resources/monsterinfo.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/monsterinfo.h b/src/resources/monsterinfo.h index 4a3208f4..359791fd 100644 --- a/src/resources/monsterinfo.h +++ b/src/resources/monsterinfo.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/music.cpp b/src/resources/music.cpp index 72094025..ed78a541 100644 --- a/src/resources/music.cpp +++ b/src/resources/music.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/music.h b/src/resources/music.h index f89c0fb2..34907cf1 100644 --- a/src/resources/music.h +++ b/src/resources/music.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp index 3e9decf1..ee65136a 100644 --- a/src/resources/npcdb.cpp +++ b/src/resources/npcdb.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2008 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/npcdb.h b/src/resources/npcdb.h index 394154fa..af6764bf 100644 --- a/src/resources/npcdb.h +++ b/src/resources/npcdb.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2008 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/resource.cpp b/src/resources/resource.cpp index ca9a69c3..d1c3ada4 100644 --- a/src/resources/resource.cpp +++ b/src/resources/resource.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/resource.h b/src/resources/resource.h index f8822d72..7c5f989e 100644 --- a/src/resources/resource.h +++ b/src/resources/resource.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index d6ab39a0..50eda0ce 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 @@ -214,7 +213,7 @@ std::string ResourceManager::getPath(const std::string &file) return path; } -Resource *ResourceManager::get(std::string const &idPath, generator fun, +Resource *ResourceManager::get(const std::string &idPath, generator fun, void *data) { // Check if the id exists, and return the value if it does. @@ -266,7 +265,7 @@ struct ResourceLoader } }; -Resource *ResourceManager::load(std::string const &path, loader fun) +Resource *ResourceManager::load(const std::string &path, loader fun) { ResourceLoader l = { this, path, fun }; return get(path, ResourceLoader::load, &l); @@ -308,7 +307,7 @@ struct DyedImageLoader } }; -Image *ResourceManager::getImage(std::string const &idPath) +Image *ResourceManager::getImage(const std::string &idPath) { DyedImageLoader l = { this, idPath }; return static_cast<Image*>(get(idPath, DyedImageLoader::load, &l)); @@ -350,8 +349,7 @@ struct SpriteDefLoader } }; -SpriteDef *ResourceManager::getSprite - (std::string const &path, int variant) +SpriteDef *ResourceManager::getSprite(const std::string &path, int variant) { SpriteDefLoader l = { path, variant }; std::stringstream ss; @@ -380,7 +378,8 @@ void ResourceManager::release(Resource *res) ResourceManager *ResourceManager::getInstance() { // Create a new instance if necessary. - if (instance == NULL) instance = new ResourceManager(); + if (!instance) + instance = new ResourceManager; return instance; } diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h index 10f6fffe..c3c68d88 100644 --- a/src/resources/resourcemanager.h +++ b/src/resources/resourcemanager.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 @@ -116,7 +115,7 @@ class ResourceManager * @return A valid resource or <code>NULL</code> if the resource could * not be generated. */ - Resource *get(std::string const &idPath, generator fun, void *data); + Resource *get(const std::string &idPath, generator fun, void *data); /** * Loads a resource from a file and adds it to the resource map. @@ -126,7 +125,7 @@ class ResourceManager * @return A valid resource or <code>NULL</code> if the resource could * not be loaded. */ - Resource *load(std::string const &path, loader fun); + Resource *load(const std::string &path, loader fun); /** * Convenience wrapper around ResourceManager::get for loading @@ -156,7 +155,7 @@ class ResourceManager * Creates a sprite definition based on a given path and the supplied * variant. */ - SpriteDef *getSprite(std::string const &path, int variant = 0); + SpriteDef *getSprite(const std::string &path, int variant = 0); /** * Releases a resource, placing it in the set of orphaned resources. diff --git a/src/resources/soundeffect.cpp b/src/resources/soundeffect.cpp index d1d24afb..3a285730 100644 --- a/src/resources/soundeffect.cpp +++ b/src/resources/soundeffect.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/soundeffect.h b/src/resources/soundeffect.h index fe14df02..fc2d4a69 100644 --- a/src/resources/soundeffect.h +++ b/src/resources/soundeffect.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp index d6cc8960..0a87db16 100644 --- a/src/resources/spritedef.cpp +++ b/src/resources/spritedef.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 @@ -33,7 +32,7 @@ #include "../log.h" #include "../utils/xml.h" -Action* SpriteDef::getAction(SpriteAction action) const +Action *SpriteDef::getAction(SpriteAction action) const { Actions::const_iterator i = mActions.find(action); @@ -46,7 +45,7 @@ Action* SpriteDef::getAction(SpriteAction action) const return i->second; } -SpriteDef *SpriteDef::load(std::string const &animationFile, int variant) +SpriteDef *SpriteDef::load(const std::string &animationFile, int variant) { std::string::size_type pos = animationFile.find('|'); std::string palettes; @@ -121,7 +120,7 @@ void SpriteDef::loadSprite(xmlNodePtr spriteNode, int variant, } } -void SpriteDef::loadImageSet(xmlNodePtr node, std::string const &palettes) +void SpriteDef::loadImageSet(xmlNodePtr node, const std::string &palettes) { const std::string name = XML::getProperty(node, "name", ""); @@ -167,7 +166,7 @@ void SpriteDef::loadAction(xmlNodePtr node, int variant_offset) actionName.c_str(), getIdPath().c_str()); return; } - Action *action = new Action(); + Action *action = new Action; mActions[actionType] = action; // When first action set it as default direction @@ -201,7 +200,7 @@ void SpriteDef::loadAnimation(xmlNodePtr animationNode, return; } - Animation *animation = new Animation(); + Animation *animation = new Animation; action->setAnimation(directionType, animation); // Get animation frames @@ -320,7 +319,7 @@ SpriteDef::~SpriteDef() } } -SpriteAction SpriteDef::makeSpriteAction(const std::string& action) +SpriteAction SpriteDef::makeSpriteAction(const std::string &action) { if (action.empty() || action == "default") { return ACTION_DEFAULT; @@ -391,5 +390,5 @@ SpriteDirection SpriteDef::makeSpriteDirection(const std::string& direction) } else { return DIRECTION_INVALID; - }; + } } diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h index 040d96e2..b9d7b85d 100644 --- a/src/resources/spritedef.h +++ b/src/resources/spritedef.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * 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 @@ -72,13 +71,24 @@ class SpriteDef : public Resource /** * Loads a sprite definition file. */ - static SpriteDef *load(std::string const &file, int variant); + static SpriteDef *load(const std::string &file, int variant); /** * Returns the specified action. */ Action *getAction(SpriteAction action) const; + /** + * Converts a string into a SpriteAction enum. + */ + static SpriteAction makeSpriteAction(const std::string &action); + + /** + * Converts a string into a SpriteDirection enum. + */ + static SpriteDirection + makeSpriteDirection(const std::string &direction); + private: /** * Constructor. @@ -99,7 +109,7 @@ class SpriteDef : public Resource /** * Loads an imageset element. */ - void loadImageSet(xmlNodePtr node, std::string const &palettes); + void loadImageSet(xmlNodePtr node, const std::string &palettes); /** * Loads an action element. @@ -129,16 +139,6 @@ class SpriteDef : public Resource */ void substituteAction(SpriteAction complete, SpriteAction with); - /** - * Converts a string into a SpriteAction enum. - */ - static SpriteAction makeSpriteAction(const std::string &action); - - /** - * Converts a string into a SpriteDirection enum. - */ - static SpriteDirection makeSpriteDirection(const std::string &direction); - typedef std::map<std::string, ImageSet*> ImageSets; typedef ImageSets::iterator ImageSetIterator; |