diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-06-26 22:38:40 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-06-26 22:38:40 +0300 |
commit | 3d6d504c4bad50f64d4d54213b13439e938aa517 (patch) | |
tree | 309ae16c4218f509b68c1032368cccb617bc8dd0 /src/gui/minimap.cpp | |
parent | 52b44e43f282882a83a6c7591c454c1b38ca55d5 (diff) | |
download | plus-3d6d504c4bad50f64d4d54213b13439e938aa517.tar.gz plus-3d6d504c4bad50f64d4d54213b13439e938aa517.tar.bz2 plus-3d6d504c4bad50f64d4d54213b13439e938aa517.tar.xz plus-3d6d504c4bad50f64d4d54213b13439e938aa517.zip |
Bit improve speed in map getwalk.
Diffstat (limited to 'src/gui/minimap.cpp')
-rw-r--r-- | src/gui/minimap.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
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); |