summaryrefslogtreecommitdiff
path: root/src/resources/map/maplayer.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2018-11-12 00:24:41 +0300
committerAndrei Karas <akaras@inbox.ru>2018-11-12 18:48:11 +0300
commit7c74a98fb966213ccbdba6e397a6d8a9502f2b17 (patch)
tree60ae28a9b6598889881312fa08360d086f47241c /src/resources/map/maplayer.h
parentc3b5c3ad370358d4e10b4cbe787dbbd61ce82c08 (diff)
downloadmanaverse-7c74a98fb966213ccbdba6e397a6d8a9502f2b17.tar.gz
manaverse-7c74a98fb966213ccbdba6e397a6d8a9502f2b17.tar.bz2
manaverse-7c74a98fb966213ccbdba6e397a6d8a9502f2b17.tar.xz
manaverse-7c74a98fb966213ccbdba6e397a6d8a9502f2b17.zip
Add missing constexpr and noexcept into maplayer.
Diffstat (limited to 'src/resources/map/maplayer.h')
-rw-r--r--src/resources/map/maplayer.h40
1 files changed, 26 insertions, 14 deletions
diff --git a/src/resources/map/maplayer.h b/src/resources/map/maplayer.h
index 081b2537e..5794ca635 100644
--- a/src/resources/map/maplayer.h
+++ b/src/resources/map/maplayer.h
@@ -74,15 +74,18 @@ class MapLayer final : public MemoryCounter, public ConfigListener
/**
* Set tile image, with x and y in layer coordinates.
*/
- void setTile(const int x,
- const int y,
- Image *restrict const img) restrict;
+ constexpr3 void setTile(const int x,
+ const int y,
+ Image *restrict const img) restrict
+ {
+ mTiles[x + y * mWidth].image = img;
+ }
/**
* Set tile image with x + y * width already known.
*/
- void setTile(const int index,
- Image *restrict const img) restrict
+ constexpr3 void setTile(const int index,
+ Image *restrict const img) restrict
{ mTiles[index].image = img; }
/**
@@ -134,27 +137,36 @@ class MapLayer final : public MemoryCounter, public ConfigListener
const int scrollY,
const Actors &actors) const restrict A_NONNULL(2);
- bool isFringeLayer() const restrict noexcept2 A_WARN_UNUSED
+ constexpr3 bool isFringeLayer() const restrict noexcept2 A_WARN_UNUSED
{ return mIsFringeLayer; }
- void setSpecialLayer(const SpecialLayer *restrict const val) restrict
+ constexpr3 void setSpecialLayer(const SpecialLayer *restrict const val)
+ restrict noexcept2
{ mSpecialLayer = val; }
- void setTempLayer(const SpecialLayer *restrict const val) restrict
+ constexpr3 void setTempLayer(const SpecialLayer *restrict const val)
+ restrict noexcept2
{ mTempLayer = val; }
- int getWidth() const restrict noexcept2 A_WARN_UNUSED
+ constexpr3 int getWidth() const restrict noexcept2 A_WARN_UNUSED
{ return mWidth; }
- int getHeight() const restrict noexcept2 A_WARN_UNUSED
+ constexpr3 int getHeight() const restrict noexcept2 A_WARN_UNUSED
{ return mHeight; }
void optionChanged(const std::string &restrict value)
restrict override final;
- void setDrawLayerFlags(const MapTypeT &restrict n) restrict;
+ constexpr3 void setDrawLayerFlags(const MapTypeT &restrict n)
+ restrict noexcept2
+ {
+ mDrawLayerFlags = n;
+ mSpecialFlag = (mDrawLayerFlags != MapType::SPECIAL &&
+ mDrawLayerFlags != MapType::SPECIAL2 &&
+ mDrawLayerFlags != MapType::SPECIAL4);
+ }
- void setActorsFix(const int y) restrict
+ constexpr3 void setActorsFix(const int y) restrict noexcept2
{ mActorsFix = y; }
int calcMemoryLocal() const override final;
@@ -165,12 +177,12 @@ class MapLayer final : public MemoryCounter, public ConfigListener
{ return mName; }
#ifdef UNITTESTS
- TileInfo *getTiles() const
+ constexpr3 TileInfo *getTiles() const restrict noexcept2
{
return mTiles;
}
- void setTileCondition(const int c)
+ constexpr3 void setTileCondition(const int c) restrict noexcept2
{
mTileCondition = c;
}