diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-01-16 01:47:17 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-01-16 01:47:17 +0300 |
commit | b293d99a34d21d137374e46386b8669907cb3c1d (patch) | |
tree | 7e5e20e2b81e239878c13229c4d02139e8b85c2b /src/resources | |
parent | 34f943198afd1f7f342d63bd70d30cdeacd3dbad (diff) | |
download | manaverse-b293d99a34d21d137374e46386b8669907cb3c1d.tar.gz manaverse-b293d99a34d21d137374e46386b8669907cb3c1d.tar.bz2 manaverse-b293d99a34d21d137374e46386b8669907cb3c1d.tar.xz manaverse-b293d99a34d21d137374e46386b8669907cb3c1d.zip |
add missing const in xmlnode pointers.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/beingcommon.cpp | 3 | ||||
-rw-r--r-- | src/resources/beingcommon.h | 3 | ||||
-rw-r--r-- | src/resources/db/avatardb.cpp | 2 | ||||
-rw-r--r-- | src/resources/db/chardb.cpp | 2 | ||||
-rw-r--r-- | src/resources/db/colordb.cpp | 4 | ||||
-rw-r--r-- | src/resources/db/deaddb.cpp | 2 | ||||
-rw-r--r-- | src/resources/db/emotedb.cpp | 4 | ||||
-rw-r--r-- | src/resources/db/itemdb.cpp | 20 | ||||
-rw-r--r-- | src/resources/db/mapdb.cpp | 12 | ||||
-rw-r--r-- | src/resources/db/moddb.cpp | 2 | ||||
-rw-r--r-- | src/resources/db/npcdb.cpp | 2 | ||||
-rw-r--r-- | src/resources/db/petdb.cpp | 2 | ||||
-rw-r--r-- | src/resources/db/sounddb.cpp | 2 | ||||
-rw-r--r-- | src/resources/mapreader.cpp | 20 | ||||
-rw-r--r-- | src/resources/mapreader.h | 13 | ||||
-rw-r--r-- | src/resources/spritedef.cpp | 5 | ||||
-rw-r--r-- | src/resources/spritedef.h | 9 |
17 files changed, 63 insertions, 44 deletions
diff --git a/src/resources/beingcommon.cpp b/src/resources/beingcommon.cpp index 668d67259..7b7a57d9e 100644 --- a/src/resources/beingcommon.cpp +++ b/src/resources/beingcommon.cpp @@ -29,7 +29,8 @@ #include "debug.h" -void BeingCommon::readBasicAttributes(BeingInfo *const info, XmlNodePtr node, +void BeingCommon::readBasicAttributes(BeingInfo *const info, + XmlNodePtrConst node, const std::string &hoverCursor) { info->setTargetCursorSize(XML::getProperty(node, diff --git a/src/resources/beingcommon.h b/src/resources/beingcommon.h index 5fb1df71b..6124de5a1 100644 --- a/src/resources/beingcommon.h +++ b/src/resources/beingcommon.h @@ -38,7 +38,8 @@ class BeingInfo; namespace BeingCommon { - void readBasicAttributes(BeingInfo *const info, XmlNodePtr node, + void readBasicAttributes(BeingInfo *const info, + XmlNodePtrConst node, const std::string &hoverCursor); void getIncludeFiles(const std::string &dir, StringVect &list); diff --git a/src/resources/db/avatardb.cpp b/src/resources/db/avatardb.cpp index b522c6b76..e51a8d468 100644 --- a/src/resources/db/avatardb.cpp +++ b/src/resources/db/avatardb.cpp @@ -52,7 +52,7 @@ void AvatarDB::load() void AvatarDB::loadXmlFile(const std::string &fileName) { XML::Document doc(fileName); - const XmlNodePtr rootNode = doc.rootNode(); + const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "avatars")) { diff --git a/src/resources/db/chardb.cpp b/src/resources/db/chardb.cpp index 80ddedc37..2d4e2fee2 100644 --- a/src/resources/db/chardb.cpp +++ b/src/resources/db/chardb.cpp @@ -48,7 +48,7 @@ void CharDB::load() XML::Document *doc = new XML::Document( paths.getStringValue("charCreationFile")); - const XmlNodePtr root = doc->rootNode(); + const XmlNodePtrConst root = doc->rootNode(); if (!root || !xmlNameEqual(root, "chars")) { diff --git a/src/resources/db/colordb.cpp b/src/resources/db/colordb.cpp index 34e0614c0..1236a35f1 100644 --- a/src/resources/db/colordb.cpp +++ b/src/resources/db/colordb.cpp @@ -78,7 +78,7 @@ void ColorDB::loadHair(const std::string &fileName, std::map<int, ItemColor> &colors) { XML::Document *doc = new XML::Document(fileName); - XmlNodePtr root = doc->rootNode(); + XmlNodePtrConst root = doc->rootNode(); if (!root || !xmlNameEqual(root, "colors")) { @@ -116,7 +116,7 @@ void ColorDB::loadHair(const std::string &fileName, void ColorDB::loadColorLists(const std::string &fileName) { XML::Document *doc = new XML::Document(fileName); - const XmlNodePtr root = doc->rootNode(); + const XmlNodePtrConst root = doc->rootNode(); if (!root) { delete doc; diff --git a/src/resources/db/deaddb.cpp b/src/resources/db/deaddb.cpp index 870b77394..e66e87e6a 100644 --- a/src/resources/db/deaddb.cpp +++ b/src/resources/db/deaddb.cpp @@ -49,7 +49,7 @@ void DeadDB::load() void DeadDB::loadXmlFile(const std::string &fileName) { XML::Document *doc = new XML::Document(fileName); - const XmlNodePtr root = doc->rootNode(); + const XmlNodePtrConst root = doc->rootNode(); if (!root || !xmlNameEqual(root, "messages")) { diff --git a/src/resources/db/emotedb.cpp b/src/resources/db/emotedb.cpp index 7c710795f..594bcce5d 100644 --- a/src/resources/db/emotedb.cpp +++ b/src/resources/db/emotedb.cpp @@ -65,7 +65,7 @@ void EmoteDB::load() void EmoteDB::loadXmlFile(const std::string &fileName) { XML::Document doc(fileName); - XmlNodePtr rootNode = doc.rootNode(); + XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "emotes")) { @@ -139,7 +139,7 @@ void EmoteDB::loadXmlFile(const std::string &fileName) void EmoteDB::loadSpecialXmlFile(const std::string &fileName) { XML::Document doc(fileName); - XmlNodePtr rootNode = doc.rootNode(); + XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "emotes")) { diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp index 4c47658e6..9865cc3ef 100644 --- a/src/resources/db/itemdb.cpp +++ b/src/resources/db/itemdb.cpp @@ -48,13 +48,16 @@ namespace extern int serverVersion; // Forward declarations -static void loadSpriteRef(ItemInfo *const itemInfo, const XmlNodePtr node); -static void loadSoundRef(ItemInfo *const itemInfo, const XmlNodePtr node); +static void loadSpriteRef(ItemInfo *const itemInfo, + const XmlNodePtr node); +static void loadSoundRef(ItemInfo *const itemInfo, + const XmlNodePtr node); static void loadFloorSprite(SpriteDisplay *const display, - const XmlNodePtr node); + const XmlNodePtrConst node); static void loadReplaceSprite(ItemInfo *const itemInfo, const XmlNodePtr replaceNode); -static void loadOrderSprite(ItemInfo *const itemInfo, const XmlNodePtr node, +static void loadOrderSprite(ItemInfo *const itemInfo, + const XmlNodePtr node, const bool drawAfter); static int parseSpriteName(const std::string &name); static int parseDirectionName(const std::string &name); @@ -757,7 +760,8 @@ void loadSoundRef(ItemInfo *const itemInfo, const XmlNodePtr node) } } -void loadFloorSprite(SpriteDisplay *const display, const XmlNodePtr floorNode) +void loadFloorSprite(SpriteDisplay *const display, + const XmlNodePtrConst floorNode) { for_each_xml_child_node(spriteNode, floorNode) { @@ -778,7 +782,8 @@ void loadFloorSprite(SpriteDisplay *const display, const XmlNodePtr floorNode) } } -void loadReplaceSprite(ItemInfo *const itemInfo, const XmlNodePtr replaceNode) +void loadReplaceSprite(ItemInfo *const itemInfo, + const XmlNodePtr replaceNode) { const std::string removeSprite = XML::getProperty( replaceNode, "sprite", ""); @@ -909,7 +914,8 @@ void loadReplaceSprite(ItemInfo *const itemInfo, const XmlNodePtr replaceNode) } } -void loadOrderSprite(ItemInfo *const itemInfo, const XmlNodePtr node, +void loadOrderSprite(ItemInfo *const itemInfo, + const XmlNodePtr node, const bool drawAfter) { const int sprite = parseSpriteName(XML::getProperty(node, "name", "")); diff --git a/src/resources/db/mapdb.cpp b/src/resources/db/mapdb.cpp index 4b5fb0f42..20d108f13 100644 --- a/src/resources/db/mapdb.cpp +++ b/src/resources/db/mapdb.cpp @@ -38,8 +38,8 @@ namespace namespace MapDB { - void readMap(XmlNodePtr node); - void readAtlas(XmlNodePtr node); + void readMap(XmlNodePtrConst node); + void readAtlas(XmlNodePtrConst node); } void MapDB::load() @@ -59,7 +59,7 @@ void MapDB::loadRemap() XML::Document *const doc = new XML::Document( paths.getStringValue("mapsRemapFile")); - const XmlNodePtr root = doc->rootNode(); + const XmlNodePtrConst root = doc->rootNode(); if (!root) { delete doc; @@ -85,7 +85,7 @@ void MapDB::loadRemap() delete doc; } -void MapDB::readMap(XmlNodePtr node) +void MapDB::readMap(XmlNodePtrConst node) { const std::string map = XML::getProperty(node, "name", ""); if (map.empty()) @@ -103,7 +103,7 @@ void MapDB::readMap(XmlNodePtr node) } } -void MapDB::readAtlas(XmlNodePtr node) +void MapDB::readAtlas(XmlNodePtrConst node) { const std::string atlas = XML::getProperty(node, "name", ""); if (atlas.empty()) @@ -132,7 +132,7 @@ void MapDB::readAtlas(XmlNodePtr node) void MapDB::loadInfo(const std::string &fileName) { XML::Document *doc = new XML::Document(fileName); - const XmlNodePtr root = doc->rootNode(); + const XmlNodePtrConst root = doc->rootNode(); if (!root) { delete doc; diff --git a/src/resources/db/moddb.cpp b/src/resources/db/moddb.cpp index 32846696b..4cdc96b3d 100644 --- a/src/resources/db/moddb.cpp +++ b/src/resources/db/moddb.cpp @@ -51,7 +51,7 @@ void ModDB::load() void ModDB::loadXmlFile(const std::string &fileName) { XML::Document doc(fileName); - const XmlNodePtr rootNode = doc.rootNode(); + const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "mods")) { diff --git a/src/resources/db/npcdb.cpp b/src/resources/db/npcdb.cpp index 412de1a1b..359c86c4a 100644 --- a/src/resources/db/npcdb.cpp +++ b/src/resources/db/npcdb.cpp @@ -57,7 +57,7 @@ void NPCDB::load() void NPCDB::loadXmlFile(const std::string &fileName) { XML::Document doc(fileName); - const XmlNodePtr rootNode = doc.rootNode(); + const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "npcs")) { diff --git a/src/resources/db/petdb.cpp b/src/resources/db/petdb.cpp index 0529ee874..c9f3bdbeb 100644 --- a/src/resources/db/petdb.cpp +++ b/src/resources/db/petdb.cpp @@ -56,7 +56,7 @@ void PETDB::load() void PETDB::loadXmlFile(const std::string &fileName) { XML::Document doc(fileName); - const XmlNodePtr rootNode = doc.rootNode(); + const XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "pets")) { diff --git a/src/resources/db/sounddb.cpp b/src/resources/db/sounddb.cpp index ad98b2705..17ff4bc71 100644 --- a/src/resources/db/sounddb.cpp +++ b/src/resources/db/sounddb.cpp @@ -47,7 +47,7 @@ void SoundDB::load() void SoundDB::loadXmlFile(const std::string &fileName) { XML::Document *doc = new XML::Document(fileName); - const XmlNodePtr root = doc->rootNode(); + const XmlNodePtrConst root = doc->rootNode(); if (!root || !xmlNameEqual(root, "sounds")) { diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 9caa14945..bcafe4bb7 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -227,7 +227,7 @@ Map *MapReader::readMap(const std::string &restrict filename, XML::Document doc(reinterpret_cast<char*>(inflated), inflatedSize); free(inflated); - XmlNodePtr node = doc.rootNode(); + XmlNodePtrConst node = doc.rootNode(); // Parse the inflated map data if (node) @@ -256,7 +256,7 @@ Map *MapReader::readMap(const std::string &restrict filename, return map; } -Map *MapReader::readMap(XmlNodePtr node, const std::string &path) +Map *MapReader::readMap(XmlNodePtrConst node, const std::string &path) { if (!node) return nullptr; @@ -405,7 +405,8 @@ Map *MapReader::readMap(XmlNodePtr node, const std::string &path) return map; } -void MapReader::readProperties(const XmlNodePtr node, Properties *const props) +void MapReader::readProperties(const XmlNodePtrConst node, + Properties *const props) { if (!node || !props) return; @@ -511,7 +512,8 @@ inline static void setTile(Map *const map, MapLayer *const layer, } \ } \ -bool MapReader::readBase64Layer(const XmlNodePtr childNode, Map *const map, +bool MapReader::readBase64Layer(const XmlNodePtrConst childNode, + Map *const map, MapLayer *const layer, const MapLayer::Type &layerType, MapHeights *const heights, @@ -528,7 +530,7 @@ bool MapReader::readBase64Layer(const XmlNodePtr childNode, Map *const map, } // Read base64 encoded map file - XmlNodePtr dataChild = childNode->xmlChildrenNode; + XmlNodePtrConst dataChild = childNode->xmlChildrenNode; if (!dataChild) return true; @@ -613,14 +615,15 @@ bool MapReader::readBase64Layer(const XmlNodePtr childNode, Map *const map, return true; } -bool MapReader::readCsvLayer(const XmlNodePtr childNode, Map *const map, +bool MapReader::readCsvLayer(const XmlNodePtrConst childNode, + Map *const map, MapLayer *const layer, const MapLayer::Type &layerType, MapHeights *const heights, int &restrict x, int &restrict y, const int w, const int h) { - XmlNodePtr dataChild = childNode->xmlChildrenNode; + XmlNodePtrConst dataChild = childNode->xmlChildrenNode; if (!dataChild) return true; @@ -803,7 +806,8 @@ void MapReader::readLayer(const XmlNodePtr node, Map *const map) } } -Tileset *MapReader::readTileset(XmlNodePtr node, const std::string &path, +Tileset *MapReader::readTileset(XmlNodePtr node, + const std::string &path, Map *const map) { if (!map) diff --git a/src/resources/mapreader.h b/src/resources/mapreader.h index 3573fcc89..4f84f1a1a 100644 --- a/src/resources/mapreader.h +++ b/src/resources/mapreader.h @@ -52,7 +52,7 @@ class MapReader final * Read an XML map from a parsed XML tree. The path is used to find the * location of referenced tileset images. */ - static Map *readMap(XmlNodePtr node, + static Map *readMap(XmlNodePtrConst node, const std::string &path) A_WARN_UNUSED; static Map *createEmptyMap(const std::string &restrict filename, @@ -67,7 +67,7 @@ class MapReader final * @param props The Properties instance to which the properties will * be assigned. */ - static void readProperties(const XmlNodePtr node, + static void readProperties(const XmlNodePtrConst node, Properties *const props); /** @@ -75,7 +75,8 @@ class MapReader final */ static void readLayer(const XmlNodePtr node, Map *const map); - static bool readBase64Layer(const XmlNodePtr childNode, Map *const map, + static bool readBase64Layer(const XmlNodePtrConst childNode, + Map *const map, MapLayer *const layer, const MapLayer::Type &layerType, MapHeights *const heights, @@ -83,7 +84,8 @@ class MapReader final int &restrict x, int &restrict y, const int w, const int h); - static bool readCsvLayer(const XmlNodePtr childNode, Map *const map, + static bool readCsvLayer(const XmlNodePtrConst childNode, + Map *const map, MapLayer *const layer, const MapLayer::Type &layerType, MapHeights *const heights, @@ -93,7 +95,8 @@ class MapReader final /** * Reads a tile set. */ - static Tileset *readTileset(XmlNodePtr node, const std::string &path, + static Tileset *readTileset(XmlNodePtr node, + const std::string &path, Map *const map) A_WARN_UNUSED; static void updateMusic(Map *const map); diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp index 9970063c8..e37aa1aa8 100644 --- a/src/resources/spritedef.cpp +++ b/src/resources/spritedef.cpp @@ -85,7 +85,7 @@ SpriteDef *SpriteDef::load(const std::string &animationFile, palettes = animationFile.substr(pos + 1); XML::Document doc(animationFile.substr(0, pos)); - XmlNodePtr rootNode = doc.rootNode(); + XmlNodePtrConst rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "sprite")) { @@ -225,7 +225,8 @@ void SpriteDef::loadImageSet(const XmlNodePtr node, mImageSets[name] = imageSet; } -void SpriteDef::loadAction(const XmlNodePtr node, const int variant_offset) +void SpriteDef::loadAction(const XmlNodePtr node, + const int variant_offset) { const std::string actionName = XML::getProperty(node, "name", ""); const std::string imageSetName = XML::getProperty(node, "imageset", ""); diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h index fe84096c3..ecedde507 100644 --- a/src/resources/spritedef.h +++ b/src/resources/spritedef.h @@ -185,18 +185,21 @@ class SpriteDef final : public Resource /** * Loads a sprite element. */ - void loadSprite(const XmlNodePtr spriteNode, const int variant, + void loadSprite(const XmlNodePtr spriteNode, + const int variant, const std::string &palettes = ""); /** * Loads an imageset element. */ - void loadImageSet(const XmlNodePtr node, const std::string &palettes); + void loadImageSet(const XmlNodePtr node, + const std::string &palettes); /** * Loads an action element. */ - void loadAction(const XmlNodePtr node, const int variant_offset); + void loadAction(const XmlNodePtr node, + const int variant_offset); /** * Loads an animation element. |