diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-06-22 20:58:13 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-06-22 20:58:13 +0300 |
commit | 8ad99cc3f4dd98f0b73a2ece9323f01099a81e80 (patch) | |
tree | 33115940e6efabec34efb71e0be6b6d7dfd7e4df /src/resources/map/map.cpp | |
parent | 04f47f060f94ec0e2dfc3cccf62cff167e0ecd68 (diff) | |
download | mv-8ad99cc3f4dd98f0b73a2ece9323f01099a81e80.tar.gz mv-8ad99cc3f4dd98f0b73a2ece9323f01099a81e80.tar.bz2 mv-8ad99cc3f4dd98f0b73a2ece9323f01099a81e80.tar.xz mv-8ad99cc3f4dd98f0b73a2ece9323f01099a81e80.zip |
Add profiler lines into some functions.
Diffstat (limited to 'src/resources/map/map.cpp')
-rw-r--r-- | src/resources/map/map.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/resources/map/map.cpp b/src/resources/map/map.cpp index 279262124..3d13ba2e5 100644 --- a/src/resources/map/map.cpp +++ b/src/resources/map/map.cpp @@ -743,6 +743,7 @@ Path Map::findPath(const int startX, const int startY, const int destX, const int destY, const unsigned char walkmask, const int maxCost) { + BLOCK_START("Map::findPath") // The basic walking cost of a tile. static const int basicCost = 100; const int basicCost2 = 100 * 362 / 256; @@ -752,16 +753,25 @@ Path Map::findPath(const int startX, const int startY, Path path; if (startX >= mWidth || startY >= mHeight || startX < 0 || startY < 0) + { + BLOCK_END("Map::findPath") return path; + } // Return when destination not walkable if (!getWalk(destX, destY, walkmask)) + { + BLOCK_END("Map::findPath") return path; + } // Reset starting tile's G cost to 0 MetaTile *const startTile = &mMetaTiles[startX + startY * mWidth]; if (!startTile) + { + BLOCK_END("Map::findPath") return path; + } startTile->Gcost = 0; @@ -960,6 +970,7 @@ Path Map::findPath(const int startX, const int startY, } } + BLOCK_END("Map::findPath") return path; } @@ -977,8 +988,12 @@ void Map::addParticleEffect(const std::string &effectFile, void Map::initializeParticleEffects(Particle *const engine) { + BLOCK_START("Map::initializeParticleEffects") if (!engine) + { + BLOCK_END("Map::initializeParticleEffects") return; + } if (config.getBoolValue("particleeffects")) { @@ -991,13 +1006,16 @@ void Map::initializeParticleEffects(Particle *const engine) p->adjustEmitterSize(i->w, i->h); } } + BLOCK_END("Map::initializeParticleEffects") } void Map::addExtraLayer() { + BLOCK_START("Map::addExtraLayer") if (!mSpecialLayer) { logger->log1("No special layer"); + BLOCK_END("Map::addExtraLayer") return; } const std::string mapFileName = getUserMapDirectory().append( @@ -1011,6 +1029,7 @@ void Map::addExtraLayer() if (!mapFile.is_open()) { mapFile.close(); + BLOCK_END("Map::addExtraLayer") return; } char line[201]; @@ -1062,6 +1081,7 @@ void Map::addExtraLayer() } mapFile.close(); } + BLOCK_END("Map::addExtraLayer") } void Map::saveExtraLayer() const |