summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-10-04 17:47:46 +0300
committerAndrei Karas <akaras@inbox.ru>2016-10-04 17:47:46 +0300
commit0a731a66a23061f24f83ce093f8d516497c17144 (patch)
treede10363e2f0f3ddb392e4b8e87f72df67f1c8e3a /src/resources
parentfa4a9bcbf9a5adb1e288409167eb579b1a68eed8 (diff)
downloadmanaverse-0a731a66a23061f24f83ce093f8d516497c17144.tar.gz
manaverse-0a731a66a23061f24f83ce093f8d516497c17144.tar.bz2
manaverse-0a731a66a23061f24f83ce093f8d516497c17144.tar.xz
manaverse-0a731a66a23061f24f83ce093f8d516497c17144.zip
Move maplayertype into enums directory.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/map/maplayer.h8
-rw-r--r--src/resources/mapreader.cpp33
-rw-r--r--src/resources/mapreader.h6
3 files changed, 21 insertions, 26 deletions
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);