From 3d6d504c4bad50f64d4d54213b13439e938aa517 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 26 Jun 2011 22:38:40 +0300 Subject: Bit improve speed in map getwalk. --- src/gui/minimap.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/gui/minimap.cpp') diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 32887466c..dd0edc0ba 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -130,11 +130,13 @@ void Minimap::setMap(Map *map) setVisible(false); return; } - for (int y = 0; y < surface->h; y ++) - { - for (int x = 0; x < surface->w; x ++) - *(data ++) = -map->getWalk(x, y); - } + const int size = surface->h * surface->w; + const int mask = (Map::BLOCKMASK_WALL | Map::BLOCKMASK_AIR + | Map::BLOCKMASK_WATER); + + for (int ptr = 0; ptr < size; ptr ++) + *(data ++) = -!(map->mMetaTiles[ptr].blockmask & mask); + SDL_UnlockSurface(surface); mMapImage = Image::load(surface); -- cgit v1.2.3-70-g09d2