diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-15 14:37:33 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-15 14:37:33 +0300 |
commit | 06a19f3327736f67907f012bd21bb1c0a21bb468 (patch) | |
tree | 73a958f3bee9997db99ebb54e4c949bc521abda5 /src/resources | |
parent | 11a02af132567b6ef709ce0b20113375dcad5db7 (diff) | |
download | manaplus-06a19f3327736f67907f012bd21bb1c0a21bb468.tar.gz manaplus-06a19f3327736f67907f012bd21bb1c0a21bb468.tar.bz2 manaplus-06a19f3327736f67907f012bd21bb1c0a21bb468.tar.xz manaplus-06a19f3327736f67907f012bd21bb1c0a21bb468.zip |
Add missing cost to map and maplayer.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/map/map.cpp | 25 | ||||
-rw-r--r-- | src/resources/map/map.h | 51 | ||||
-rw-r--r-- | src/resources/map/maplayer.cpp | 4 | ||||
-rw-r--r-- | src/resources/map/maplayer.h | 24 |
4 files changed, 56 insertions, 48 deletions
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp index 18e3dc7f5..14465956e 100644 --- a/src/resources/map/map.cpp +++ b/src/resources/map/map.cpp @@ -583,8 +583,9 @@ void Map::updateAmbientLayers(const float scrollX, const float scrollY) BLOCK_END("Map::updateAmbientLayers") } -void Map::drawAmbientLayers(Graphics *const graphics, const LayerType type, - const int detail) +void Map::drawAmbientLayers(Graphics *const graphics, + const LayerType type, + const int detail) const { BLOCK_START("Map::drawAmbientLayers") // Detail 0 = no ambient effects except background image @@ -595,7 +596,7 @@ void Map::drawAmbientLayers(Graphics *const graphics, const LayerType type, } // find out which layer list to draw - AmbientLayerVector *layers = nullptr; + const AmbientLayerVector *layers = nullptr; switch (type) { case FOREGROUND_LAYERS: @@ -980,18 +981,14 @@ Path Map::findPath(const int startX, const int startY, } void Map::addParticleEffect(const std::string &effectFile, - const int x, const int y, const int w, const int h) + const int x, const int y, + const int w, const int h) { - ParticleEffectData newEffect; - newEffect.file = effectFile; - newEffect.x = x; - newEffect.y = y; - newEffect.w = w; - newEffect.h = h; + ParticleEffectData newEffect(effectFile, x, y, w, h); mParticleEffects.push_back(newEffect); } -void Map::initializeParticleEffects(Particle *const engine) +void Map::initializeParticleEffects(Particle *const engine) const { BLOCK_START("Map::initializeParticleEffects") if (!engine) @@ -1142,7 +1139,8 @@ std::string Map::getUserMapDirectory() const } void Map::addRange(const std::string &name, const int type, - const int x, const int y, const int dx, const int dy) + const int x, const int y, + const int dx, const int dy) { if (!mObjects) return; @@ -1152,7 +1150,8 @@ void Map::addRange(const std::string &name, const int type, } void Map::addPortal(const std::string &name, const int type, - const int x, const int y, const int dx, const int dy) + const int x, const int y, + const int dx, const int dy) { addPortalTile(name, type, (x / mapTileSize) + (dx / mapTileSize / 2), (y / mapTileSize) + (dy / mapTileSize / 2)); diff --git a/src/resources/map/map.h b/src/resources/map/map.h index e33a83d6a..89ef884c4 100644 --- a/src/resources/map/map.h +++ b/src/resources/map/map.h @@ -209,7 +209,7 @@ class Map final : public Properties, public ConfigListener /** * Initializes all added particle effects */ - void initializeParticleEffects(Particle *const particleEngine); + void initializeParticleEffects(Particle *const particleEngine) const; /** * Adds a tile animation to the map @@ -241,10 +241,12 @@ class Map final : public Properties, public ConfigListener std::string getUserMapDirectory() const A_WARN_UNUSED; void addPortal(const std::string &name, const int type, - const int x, const int y, const int dx, const int dy); + const int x, const int y, + const int dx, const int dy); void addRange(const std::string &name, const int type, - const int x, const int y, const int dx, const int dy); + const int x, const int y, + const int dx, const int dy); void addPortalTile(const std::string &name, const int type, const int x, const int y); @@ -313,7 +315,7 @@ class Map final : public Properties, public ConfigListener const MetaTile *getMetaTiles() const { return mMetaTiles; } - WalkLayer *getWalkLayer() + const WalkLayer *getWalkLayer() const { return mWalkLayer; } void setWalkLayer(WalkLayer *const layer) @@ -355,7 +357,7 @@ class Map final : public Properties, public ConfigListener * Draws the foreground or background layers to the given graphics output. */ void drawAmbientLayers(Graphics *const graphics, const LayerType type, - const int detail); + const int detail) const; /** * Tells whether the given coordinates fall within the map boundaries. @@ -367,11 +369,12 @@ class Map final : public Properties, public ConfigListener */ unsigned *mOccupation[BlockType::NB_BLOCKTYPES]; - int mWidth; - int mHeight; - int mTileWidth, mTileHeight; + const int mWidth; + const int mHeight; + const int mTileWidth; + const int mTileHeight; int mMaxTileHeight; - MetaTile *mMetaTiles; + MetaTile *const mMetaTiles; WalkLayer *mWalkLayer; Layers mLayers; Tilesets mTilesets; @@ -394,20 +397,24 @@ class Map final : public Properties, public ConfigListener // Particle effect data struct ParticleEffectData final { - ParticleEffectData() : - file(), - x(0), - y(0), - w(0), - h(0) + ParticleEffectData(const std::string &file0, + const int x0, + const int y0, + const int w0, + const int h0) : + file(file0), + x(x0), + y(y0), + w(w0), + h(h0) { } - std::string file; - int x; - int y; - int w; - int h; + const std::string file; + const int x; + const int y; + const int w; + const int h; }; std::vector<ParticleEffectData> mParticleEffects; @@ -417,7 +424,7 @@ class Map final : public Properties, public ConfigListener int mOverlayDetail; float mOpacity; - RenderType mOpenGL; + const RenderType mOpenGL; int mPvp; bool mTilesetsIndexed; Tileset** mIndexedTilesets; @@ -442,7 +449,7 @@ class Map final : public Properties, public ConfigListener int mDrawScrollY; int mMask; Resource *mAtlas; - MapHeights *mHeights; + const MapHeights *mHeights; bool mRedrawMap; bool mBeingOpacity; bool mCustom; diff --git a/src/resources/map/maplayer.cpp b/src/resources/map/maplayer.cpp index 5f3c29586..83df5d580 100644 --- a/src/resources/map/maplayer.cpp +++ b/src/resources/map/maplayer.cpp @@ -158,7 +158,7 @@ void MapLayer::draw(Graphics *const graphics, BLOCK_END("MapLayer::draw") } -void MapLayer::drawSDL(Graphics *const graphics) +void MapLayer::drawSDL(Graphics *const graphics) const { BLOCK_START("MapLayer::drawSDL") MapRows::const_iterator rit = mTempRows.begin(); @@ -337,7 +337,7 @@ void MapLayer::updateOGL(Graphics *const graphics, BLOCK_END("MapLayer::updateOGL") } -void MapLayer::drawOGL(Graphics *const graphics) +void MapLayer::drawOGL(Graphics *const graphics) const { BLOCK_START("MapLayer::drawOGL") MapRows::const_iterator rit = mTempRows.begin(); diff --git a/src/resources/map/maplayer.h b/src/resources/map/maplayer.h index 4f06cddef..6eebe5713 100644 --- a/src/resources/map/maplayer.h +++ b/src/resources/map/maplayer.h @@ -54,7 +54,8 @@ class MapLayer final: public ConfigListener * fringe layer. The fringe layer is the layer that draws the actors. * There can be only one fringe layer per map. */ - MapLayer(const int x, const int y, const int width, const int height, + MapLayer(const int x, const int y, + const int width, const int height, const bool isFringeLayer, const int mask); A_DELETE_COPY(MapLayer) @@ -88,10 +89,10 @@ class MapLayer final: public ConfigListener const int scrollX, const int scrollY, const int layerDrawFlags) const; - void drawSDL(Graphics *const graphics); + void drawSDL(Graphics *const graphics) const; #ifdef USE_OPENGL - void drawOGL(Graphics *const graphics); + void drawOGL(Graphics *const graphics) const; void updateOGL(Graphics *const graphics, int startX, int startY, @@ -130,22 +131,23 @@ class MapLayer final: public ConfigListener void optionChanged(const std::string &value) override final; + protected: static int getTileDrawWidth(const Image *img, const int endX, int &width) A_WARN_UNUSED; private: - int mX; - int mY; - int mWidth; - int mHeight; - Image **mTiles; - SpecialLayer *mSpecialLayer; - SpecialLayer *mTempLayer; + const int mX; + const int mY; + const int mWidth; + const int mHeight; + Image **const mTiles; + const SpecialLayer *mSpecialLayer; + const SpecialLayer *mTempLayer; typedef std::vector<MapRowVertexes*> MapRows; MapRows mTempRows; int mMask; - bool mIsFringeLayer; /**< Whether the actors are drawn. */ + const bool mIsFringeLayer; /**< Whether the actors are drawn. */ bool mHighlightAttackRange; }; |