diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-10-04 19:38:47 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-10-04 19:38:47 +0300 |
commit | 60745b8038b18d4b7b7198a03547676b92988426 (patch) | |
tree | 93170d1fe52baa08a640ddb56629424c698cc53b | |
parent | b844884ba160f7a0204382cbbce4c98ecae1139b (diff) | |
download | mv-60745b8038b18d4b7b7198a03547676b92988426.tar.gz mv-60745b8038b18d4b7b7198a03547676b92988426.tar.bz2 mv-60745b8038b18d4b7b7198a03547676b92988426.tar.xz mv-60745b8038b18d4b7b7198a03547676b92988426.zip |
Move maplayerposition into enums directory.
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/enums/resources/map/maplayerposition.h | 37 | ||||
-rw-r--r-- | src/resources/map/map.cpp | 16 | ||||
-rw-r--r-- | src/resources/map/map.h | 9 |
5 files changed, 51 insertions, 13 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 74e4150ab..3d0eb0af0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -688,6 +688,7 @@ SET(SRCS resources/db/moddb.h resources/mapinfo.h enums/resources/map/mapitemtype.h + enums/resources/map/maplayerposition.h resources/mapreader.cpp resources/mapreader.h resources/memorycounter.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 1e61acaa4..360b20e14 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1300,6 +1300,7 @@ manaplus_SOURCES += main.cpp \ resources/itemtypemapdata.h \ resources/mapinfo.h \ enums/resources/map/mapitemtype.h \ + enums/resources/map/maplayerposition.h \ resources/mapreader.cpp \ resources/mapreader.h \ resources/modinfo.cpp \ diff --git a/src/enums/resources/map/maplayerposition.h b/src/enums/resources/map/maplayerposition.h new file mode 100644 index 000000000..3fb923ff6 --- /dev/null +++ b/src/enums/resources/map/maplayerposition.h @@ -0,0 +1,37 @@ +/* + * 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_MAPLAYERPOSITION_H +#define ENUMS_RESOURCES_MAP_MAPLAYERPOSITION_H + +#include "enums/simpletypes/enumdefines.h" + +#include "localconsts.h" + +enumStart(MapLayerPosition) +{ + FOREGROUND_LAYERS = 0, + BACKGROUND_LAYERS +} +enumEnd(MapLayerPosition); + +#endif // ENUMS_RESOURCES_MAP_MAPLAYERPOSITION_H diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp index 2d6631aa5..f662bedac 100644 --- a/src/resources/map/map.cpp +++ b/src/resources/map/map.cpp @@ -352,7 +352,9 @@ void Map::draw(Graphics *restrict const graphics, static_cast<float>(scrollY)); // Draw backgrounds - drawAmbientLayers(graphics, BACKGROUND_LAYERS, mOverlayDetail); + drawAmbientLayers(graphics, + MapLayerPosition::BACKGROUND_LAYERS, + mOverlayDetail); if (mDrawLayersFlags == MapType::BLACKWHITE && userPalette) { @@ -521,7 +523,9 @@ void Map::draw(Graphics *restrict const graphics, } } - drawAmbientLayers(graphics, FOREGROUND_LAYERS, mOverlayDetail); + drawAmbientLayers(graphics, + MapLayerPosition::FOREGROUND_LAYERS, + mOverlayDetail); BLOCK_END("Map::draw") } @@ -639,12 +643,12 @@ void Map::updateAmbientLayers(const float scrollX, } void Map::drawAmbientLayers(Graphics *restrict const graphics, - const LayerType type, + const MapLayerPositionT type, const int detail) const restrict2 { BLOCK_START("Map::drawAmbientLayers") // Detail 0 = no ambient effects except background image - if (detail <= 0 && type != BACKGROUND_LAYERS) + if (detail <= 0 && type != MapLayerPosition::BACKGROUND_LAYERS) { BLOCK_END("Map::drawAmbientLayers") return; @@ -654,10 +658,10 @@ void Map::drawAmbientLayers(Graphics *restrict const graphics, const AmbientLayerVector *restrict layers = nullptr; switch (type) { - case FOREGROUND_LAYERS: + case MapLayerPosition::FOREGROUND_LAYERS: layers = &mForegrounds; break; - case BACKGROUND_LAYERS: + case MapLayerPosition::BACKGROUND_LAYERS: layers = &mBackgrounds; break; default: diff --git a/src/resources/map/map.h b/src/resources/map/map.h index a1f8c9f5a..ef1a37afa 100644 --- a/src/resources/map/map.h +++ b/src/resources/map/map.h @@ -30,6 +30,7 @@ #include "enums/render/rendertype.h" #include "enums/resources/map/blocktype.h" +#include "enums/resources/map/maplayerposition.h" #include "enums/resources/map/maptype.h" #include "resources/memorycounter.h" @@ -381,12 +382,6 @@ class Map final : public Properties, void removeActor(const Actors::iterator &restrict iterator) restrict2; private: - enum LayerType - { - FOREGROUND_LAYERS = 0, - BACKGROUND_LAYERS - }; - /** * Updates scrolling of ambient layers. Has to be called each game tick. */ @@ -397,7 +392,7 @@ class Map final : public Properties, * Draws the foreground or background layers to the given graphics output. */ void drawAmbientLayers(Graphics *restrict const graphics, - const LayerType type, + const MapLayerPositionT type, const int detail) const restrict2 A_NONNULL(2); /** |