diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-25 23:04:58 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-25 23:04:58 +0200 |
commit | a36909f5c3408153c9b5f9477adde9b27d8c7482 (patch) | |
tree | 0acd7721cd2bb2b27878d20027d0510458581515 /src/gui/minimap.cpp | |
parent | 4e18e7619e9a8c909dea3374a2a7aa39befe0c16 (diff) | |
download | mana-a36909f5c3408153c9b5f9477adde9b27d8c7482.tar.gz mana-a36909f5c3408153c9b5f9477adde9b27d8c7482.tar.bz2 mana-a36909f5c3408153c9b5f9477adde9b27d8c7482.tar.xz mana-a36909f5c3408153c9b5f9477adde9b27d8c7482.zip |
Handle map not found gracefully
Instead of shutting down, the client will now draw a gray background.
This allows the player to still contact a GM in order to be helped out
of the situation.
It also helps me warp out of the non-existing map I accidentally warped
myself onto. ;)
Diffstat (limited to 'src/gui/minimap.cpp')
-rw-r--r-- | src/gui/minimap.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index a5bdc59d..d1c99b84 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -77,21 +77,26 @@ void Minimap::setMap(Map *map) // Set the title for the Minimap std::string caption; - if (map->hasProperty("name")) - caption = map->getProperty("name"); - else if (map->hasProperty("mapname")) - caption = map->getProperty("mapname"); - else + if (map) + caption = map->getName(); + + if (caption.empty()) caption = _("Map"); minimap->setCaption(caption); // Adapt the image if (mMapImage) + { mMapImage->decRef(); + mMapImage = 0; + } - ResourceManager *resman = ResourceManager::getInstance(); - mMapImage = resman->getImage(map->getProperty("minimap")); + if (map) + { + ResourceManager *resman = ResourceManager::getInstance(); + mMapImage = resman->getImage(map->getProperty("minimap")); + } if (mMapImage) { |