summaryrefslogtreecommitdiff
path: root/src/gui/minimap.cpp
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2011-02-07 14:33:13 -0800
committerAndrei Karas <akaras@inbox.ru>2011-02-08 19:10:11 +0200
commit5f59d91bf515f02f65e8883b310d89e518b4ea80 (patch)
tree054bbafe628f8936da17a847e4e3b3e321c4be02 /src/gui/minimap.cpp
parentb2ce88bae2b95adb612456d9659669d6b686de7b (diff)
downloadmv-5f59d91bf515f02f65e8883b310d89e518b4ea80.tar.gz
mv-5f59d91bf515f02f65e8883b310d89e518b4ea80.tar.bz2
mv-5f59d91bf515f02f65e8883b310d89e518b4ea80.tar.xz
mv-5f59d91bf515f02f65e8883b310d89e518b4ea80.zip
Possibly buggy patch to autogenerate minimap
is the surface ever freed? note that black and white seem too contrasty
Diffstat (limited to 'src/gui/minimap.cpp')
-rw-r--r--src/gui/minimap.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index 798318c99..9efacdce6 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -94,7 +94,20 @@ void Minimap::setMap(Map *map)
mMapImage = 0;
}
- if (map)
+ if (true/* TODO replace this with an option*/) {
+ // should this optionally happen only if there is no resourcemanager option? i.e. a tristate always, fallback, never?
+ SDL_Surface* surface = SDL_CreateRGBSurface(SDL_SWSURFACE, map->getWidth(), map->getHeight(), 32, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x00000000);
+ // I'm not sure if the locks are necessary since it's a SWSURFACE
+ SDL_LockSurface(surface);
+ int* data = (int*)surface->pixels;
+ for (int y = 0; y < surface->h; y++)
+ for (int x = 0; x < surface->w; x++)
+ *(data++) = -map->getWalk(x,y);
+ SDL_UnlockSurface(surface);
+ mMapImage = Image::load(surface);
+ SDL_FreeSurface(surface);
+ }
+ else if (map)
{
std::string tempname =
"graphics/minimaps/" + map->getFilename() + ".png";