From 1e9b7c519953c73c6e5ca4ce2169eb674267c115 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 20 Apr 2013 16:40:24 +0300 Subject: fix style in other files. --- src/maplayer.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'src/maplayer.cpp') diff --git a/src/maplayer.cpp b/src/maplayer.cpp index 315e9a342..af1a6c165 100644 --- a/src/maplayer.cpp +++ b/src/maplayer.cpp @@ -49,7 +49,8 @@ MapLayer::MapLayer(const int x, const int y, const int width, const int height, mHighlightAttackRange(config.getBoolValue("highlightAttackRange")), mTiles(new Image*[mWidth * mHeight]), mSpecialLayer(nullptr), - mTempLayer(nullptr) + mTempLayer(nullptr), + mTempRows() { std::fill_n(mTiles, mWidth * mHeight, static_cast(nullptr)); @@ -555,12 +556,12 @@ int MapLayer::getTileDrawWidth(const Image *img, SpecialLayer::SpecialLayer(const int width, const int height, const bool drawSprites) : - mWidth(width), mHeight(height), - mDrawSprites(drawSprites) + mWidth(width), + mHeight(height), + mDrawSprites(drawSprites), + mTiles(new MapItem*[mWidth * mHeight]) { - const int size = mWidth * mHeight; - mTiles = new MapItem*[size]; - std::fill_n(mTiles, size, static_cast(nullptr)); + std::fill_n(mTiles, mWidth * mHeight, static_cast(nullptr)); } SpecialLayer::~SpecialLayer() @@ -675,26 +676,26 @@ void SpecialLayer::draw(Graphics *const graphics, int startX, int startY, } MapItem::MapItem(): - mImage(nullptr), mComment(""), mName(""), mX(-1), mY(-1) + mType(EMPTY), mImage(nullptr), mComment(""), mName(""), mX(-1), mY(-1) { setType(EMPTY); } MapItem::MapItem(const int type): - mImage(nullptr), mComment(""), mName(""), mX(-1), mY(-1) + mType(type), mImage(nullptr), mComment(""), mName(""), mX(-1), mY(-1) { setType(type); } MapItem::MapItem(const int type, std::string comment): - mImage(nullptr), mComment(comment), mName(""), mX(-1), mY(-1) + mType(type), mImage(nullptr), mComment(comment), mName(""), mX(-1), mY(-1) { setType(type); } MapItem::MapItem(const int type, std::string comment, const int x, const int y): - mImage(nullptr), mComment(comment), mName(""), mX(x), mY(y) + mType(type), mImage(nullptr), mComment(comment), mName(""), mX(x), mY(y) { setType(type); } @@ -792,11 +793,11 @@ void MapItem::draw(Graphics *const graphics, const int x, const int y, } ObjectsLayer::ObjectsLayer(const unsigned width, const unsigned height) : - mWidth(width), mHeight(height) + mTiles(new MapObjectList*[width * height]), + mWidth(width), + mHeight(height) { - const unsigned size = width * height; - mTiles = new MapObjectList*[size]; - std::fill_n(mTiles, size, static_cast(nullptr)); + std::fill_n(mTiles, width * height, static_cast(nullptr)); } ObjectsLayer::~ObjectsLayer() -- cgit v1.2.3-60-g2f50