diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-10-04 17:47:46 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-10-04 17:47:46 +0300 |
commit | 0a731a66a23061f24f83ce093f8d516497c17144 (patch) | |
tree | de10363e2f0f3ddb392e4b8e87f72df67f1c8e3a /src | |
parent | fa4a9bcbf9a5adb1e288409167eb579b1a68eed8 (diff) | |
download | plus-0a731a66a23061f24f83ce093f8d516497c17144.tar.gz plus-0a731a66a23061f24f83ce093f8d516497c17144.tar.bz2 plus-0a731a66a23061f24f83ce093f8d516497c17144.tar.xz plus-0a731a66a23061f24f83ce093f8d516497c17144.zip |
Move maplayertype into enums directory.
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/enums/resources/map/maplayertype.h | 39 | ||||
-rw-r--r-- | src/resources/map/maplayer.h | 8 | ||||
-rw-r--r-- | src/resources/mapreader.cpp | 33 | ||||
-rw-r--r-- | src/resources/mapreader.h | 6 |
6 files changed, 62 insertions, 26 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 83a27177f..3e83dd3fd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -674,6 +674,7 @@ SET(SRCS enums/resources/frametype.h enums/resources/imageposition.h enums/resources/imagetype.h + enums/resources/map/maplayertype.h enums/resources/item/itemdbtype.h enums/resources/item/itemsoundevent.h enums/resources/item/itemtype.h diff --git a/src/Makefile.am b/src/Makefile.am index ab7a58b77..3fab04574 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1292,6 +1292,7 @@ manaplus_SOURCES += main.cpp \ enums/resources/frametype.h \ enums/resources/imageposition.h \ enums/resources/imagetype.h \ + enums/resources/map/maplayertype.h \ enums/resources/item/itemdbtype.h \ enums/resources/item/itemsoundevent.h \ enums/resources/item/itemtype.h \ diff --git a/src/enums/resources/map/maplayertype.h b/src/enums/resources/map/maplayertype.h new file mode 100644 index 000000000..6039ebf45 --- /dev/null +++ b/src/enums/resources/map/maplayertype.h @@ -0,0 +1,39 @@ +/* + * The ManaPlus Client + * Copyright (C) 2004-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011-2016 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 ENUMS_RESOURCES_MAP_MAPLAYERTYPE_H +#define ENUMS_RESOURCES_MAP_MAPLAYERTYPE_H + +#include "enums/simpletypes/enumdefines.h" + +#include "localconsts.h" + +enumStart(MapLayerType) +{ + TILES = 0, + COLLISION, + HEIGHTS, + ACTIONS +} +enumEnd(MapLayerType); + +#endif // ENUMS_RESOURCES_MAP_MAPLAYERTYPE_H diff --git a/src/resources/map/maplayer.h b/src/resources/map/maplayer.h index 8ba017398..2bdd8d43c 100644 --- a/src/resources/map/maplayer.h +++ b/src/resources/map/maplayer.h @@ -48,14 +48,6 @@ struct MetaTile; class MapLayer final: public MemoryCounter, public ConfigListener { public: - enum Type - { - TILES = 0, - COLLISION, - HEIGHTS, - ACTIONS - }; - friend class Map; /** diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 1427493ea..d7e182cac 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -31,6 +31,7 @@ #include "const/resources/map/map.h" #include "enums/resources/map/mapitemtype.h" +#include "enums/resources/map/maplayertype.h" #include "resources/map/map.h" #include "resources/map/mapheights.h" @@ -529,14 +530,14 @@ void MapReader::readProperties(const XmlNodePtrConst node, inline static void setTile(Map *const map, MapLayer *const layer, - const MapLayer::Type &layerType, + const MapLayerTypeT &layerType, MapHeights *const heights, const int x, const int y, const int gid) A_NONNULL(1); inline static void setTile(Map *const map, MapLayer *const layer, - const MapLayer::Type &layerType, + const MapLayerTypeT &layerType, MapHeights *const heights, const int x, const int y, const int gid) @@ -544,7 +545,7 @@ inline static void setTile(Map *const map, const Tileset * const set = map->getTilesetWithGid(gid); switch (layerType) { - case MapLayer::TILES: + case MapLayerType::TILES: { Image *const img = set ? set->get(gid - set->getFirstGid()) : nullptr; @@ -553,7 +554,7 @@ inline static void setTile(Map *const map, break; } - case MapLayer::COLLISION: + case MapLayerType::COLLISION: { if (set) { @@ -595,7 +596,7 @@ inline static void setTile(Map *const map, break; } - case MapLayer::HEIGHTS: + case MapLayerType::HEIGHTS: { if (!set || !heights) break; @@ -614,7 +615,7 @@ inline static void setTile(Map *const map, } default: - case MapLayer::ACTIONS: + case MapLayerType::ACTIONS: break; } } @@ -622,7 +623,7 @@ inline static void setTile(Map *const map, bool MapReader::readBase64Layer(const XmlNodePtrConst childNode, Map *const map, MapLayer *const layer, - const MapLayer::Type &layerType, + const MapLayerTypeT &layerType, MapHeights *const heights, const std::string &compression, int &restrict x, int &restrict y, @@ -759,7 +760,7 @@ bool MapReader::readBase64Layer(const XmlNodePtrConst childNode, bool MapReader::readCsvLayer(const XmlNodePtrConst childNode, Map *const map, MapLayer *const layer, - const MapLayer::Type &layerType, + const MapLayerTypeT &layerType, MapHeights *const heights, int &restrict x, int &restrict y, const int w, const int h) @@ -859,13 +860,13 @@ void MapReader::readLayer(const XmlNodePtr node, Map *const map) int tileCondition = -1; int conditionLayer = 0; - MapLayer::Type layerType = MapLayer::TILES; + MapLayerTypeT layerType = MapLayerType::TILES; if (isCollisionLayer) - layerType = MapLayer::COLLISION; + layerType = MapLayerType::COLLISION; else if (isHeightLayer) - layerType = MapLayer::HEIGHTS; + layerType = MapLayerType::HEIGHTS; else if (isActionsLayer) - layerType = MapLayer::ACTIONS; + layerType = MapLayerType::ACTIONS; map->indexTilesets(); @@ -933,7 +934,7 @@ void MapReader::readLayer(const XmlNodePtr node, Map *const map) switch (layerType) { - case MapLayer::TILES: + case MapLayerType::TILES: { layer = new MapLayer(name, offsetX, offsetY, @@ -944,15 +945,15 @@ void MapReader::readLayer(const XmlNodePtr node, Map *const map) map->addLayer(layer); break; } - case MapLayer::HEIGHTS: + case MapLayerType::HEIGHTS: { heights = new MapHeights(w, h); map->addHeights(heights); break; } default: - case MapLayer::ACTIONS: - case MapLayer::COLLISION: + case MapLayerType::ACTIONS: + case MapLayerType::COLLISION: break; } diff --git a/src/resources/mapreader.h b/src/resources/mapreader.h index 48a9edd0c..911c295ca 100644 --- a/src/resources/mapreader.h +++ b/src/resources/mapreader.h @@ -23,6 +23,8 @@ #ifndef RESOURCES_MAPREADER_H #define RESOURCES_MAPREADER_H +#include "enums/resources/map/maplayertype.h" + #include "utils/xml.h" #include "resources/map/maplayer.h" @@ -82,7 +84,7 @@ class MapReader final static bool readBase64Layer(const XmlNodePtrConst childNode, Map *const map, MapLayer *const layer, - const MapLayer::Type &layerType, + const MapLayerTypeT &layerType, MapHeights *const heights, const std::string &compression, int &restrict x, int &restrict y, @@ -91,7 +93,7 @@ class MapReader final static bool readCsvLayer(const XmlNodePtrConst childNode, Map *const map, MapLayer *const layer, - const MapLayer::Type &layerType, + const MapLayerTypeT &layerType, MapHeights *const heights, int &restrict x, int &restrict y, const int w, const int h) A_NONNULL(2); |