diff options
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/atlasmanager.cpp | 2 | ||||
-rw-r--r-- | src/resources/db/monsterdb.cpp | 6 | ||||
-rw-r--r-- | src/resources/db/weaponsdb.cpp | 76 | ||||
-rw-r--r-- | src/resources/db/weaponsdb.h | 44 | ||||
-rw-r--r-- | src/resources/dye.cpp | 2 | ||||
-rw-r--r-- | src/resources/dye.h | 2 | ||||
-rw-r--r-- | src/resources/mapreader.cpp | 1 |
7 files changed, 124 insertions, 9 deletions
diff --git a/src/resources/atlasmanager.cpp b/src/resources/atlasmanager.cpp index 71a6382dc..870de40a9 100644 --- a/src/resources/atlasmanager.cpp +++ b/src/resources/atlasmanager.cpp @@ -250,7 +250,7 @@ SDL_Surface *AtlasManager::createSDLAtlas(TextureAtlas *const atlas) #else SDL_SetAlpha(image->mSDLSurface, 0, SDL_ALPHA_OPAQUE); #endif - graphics->drawImage2(image, item->x, item->y); + graphics->drawImage(image, item->x, item->y); } } } diff --git a/src/resources/db/monsterdb.cpp b/src/resources/db/monsterdb.cpp index 9b9112f0f..7bdbeb33d 100644 --- a/src/resources/db/monsterdb.cpp +++ b/src/resources/db/monsterdb.cpp @@ -68,14 +68,8 @@ void MonsterDB::loadXmlFile(const std::string &fileName) return; } -#ifdef MANASERV_SUPPORT - const int offset = XML::getProperty(rootNode, "offset", - Net::getNetworkType() != ServerInfo::MANASERV - ? OLD_TMWATHENA_OFFSET : 0); -#else const int offset = XML::getProperty(rootNode, "offset", OLD_TMWATHENA_OFFSET); -#endif // iterate <monster>s for_each_xml_child_node(monsterNode, rootNode) diff --git a/src/resources/db/weaponsdb.cpp b/src/resources/db/weaponsdb.cpp new file mode 100644 index 000000000..6e8e4ce1f --- /dev/null +++ b/src/resources/db/weaponsdb.cpp @@ -0,0 +1,76 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014 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 "resources/db/weaponsdb.h" + +#include "utils/xmlutils.h" + +#include "debug.h" + +namespace +{ + WeaponsInfos mBows; + WeaponsInfos mSwords; + WeaponsInfos mShields; + bool mLoaded = false; +} + +static void loadDB(const std::string &name, WeaponsInfos &arr) +{ + readXmlIntVector("weapons.xml", + "weapons", + name, + "item", + "id", + arr); +} + +void WeaponsDB::load() +{ + if (mLoaded) + unload(); + + loadDB("swords", mSwords); + loadDB("bows", mBows); + loadDB("shields", mShields); +} + +void WeaponsDB::unload() +{ + mBows.clear(); + mSwords.clear(); + mShields.clear(); + mLoaded = false; +} + +const WeaponsInfos &WeaponsDB::getBows() +{ + return mBows; +} + +const WeaponsInfos &WeaponsDB::getSwords() +{ + return mSwords; +} + +const WeaponsInfos &WeaponsDB::getShields() +{ + return mShields; +} diff --git a/src/resources/db/weaponsdb.h b/src/resources/db/weaponsdb.h new file mode 100644 index 000000000..33688b338 --- /dev/null +++ b/src/resources/db/weaponsdb.h @@ -0,0 +1,44 @@ +/* + * The ManaPlus Client + * Copyright (C) 2014 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_DB_WEAPONSDB_H +#define RESOURCES_DB_WEAPONSDB_H + +#include <vector> + +#include "localconsts.h" + +typedef std::vector<int> WeaponsInfos; +typedef WeaponsInfos::const_iterator WeaponsInfosIter; + +namespace WeaponsDB +{ + void load(); + + void unload(); + + const WeaponsInfos &getBows(); + + const WeaponsInfos &getSwords(); + + const WeaponsInfos &getShields(); +} // namespace WeaponsDB + +#endif // RESOURCES_DB_WEAPONSDB_H diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp index a1d925a1f..4f9e8a738 100644 --- a/src/resources/dye.cpp +++ b/src/resources/dye.cpp @@ -88,7 +88,7 @@ DyePalette::DyePalette(const std::string &description, logger->log("Error, invalid embedded palette: %s", description.c_str()); } -int DyePalette::hexDecode(const signed char c) +unsigned int DyePalette::hexDecode(const signed char c) { if ('0' <= c && c <= '9') return c - '0'; diff --git a/src/resources/dye.h b/src/resources/dye.h index a68839e47..b6003624b 100644 --- a/src/resources/dye.h +++ b/src/resources/dye.h @@ -82,7 +82,7 @@ class DyePalette final void replaceAOGLColor(uint32_t *restrict pixels, const int bufSize) const; - static int hexDecode(const signed char c) A_WARN_UNUSED; + static unsigned int hexDecode(const signed char c) A_WARN_UNUSED; private: std::vector<DyeColor> mColors; diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index e053e0035..4da901b09 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -214,6 +214,7 @@ void MapReader::addLayerToList(const std::string &fileName) mKnownLayers[name] = childNode; mKnownDocs.insert(doc); } + delete doc; } Map *MapReader::readMap(const std::string &restrict filename, |