summaryrefslogtreecommitdiff
path: root/src/gui/minimap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/minimap.cpp')
-rw-r--r--src/gui/minimap.cpp36
1 files changed, 21 insertions, 15 deletions
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index 019ffe6b..174151c6 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -39,10 +39,10 @@
bool Minimap::mShow = true;
Minimap::Minimap():
- Window(_("MiniMap")),
- mMapImage(NULL),
- mHeightProportion(0.5),
- mWidthProportion(0.5)
+ Window(_("Map")),
+ mMapImage(0),
+ mWidthProportion(0.5),
+ mHeightProportion(0.5)
{
setWindowName("MiniMap");
mShow = config.getValue(getWindowName() + "Show", true);
@@ -55,8 +55,6 @@ Minimap::Minimap():
setSticky(false);
loadWindowState();
-
- //Debug
}
Minimap::~Minimap()
@@ -69,13 +67,24 @@ Minimap::~Minimap()
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
+ caption = _("Map");
+
+ minimap->setCaption(caption);
+
+ // Adapt the image
if (mMapImage)
mMapImage->decRef();
- mMap = map;
-
ResourceManager *resman = ResourceManager::getInstance();
- mMapImage = resman->getImage(mMap->getProperty("minimap"));
+ mMapImage = resman->getImage(map->getProperty("minimap"));
if (mMapImage)
{
@@ -90,12 +99,9 @@ void Minimap::setMap(Map *map)
setMinWidth(mapWidth > titleWidth ? mapWidth : titleWidth);
setMinHeight(mapHeight);
- mWidthProportion = (float) mMapImage->getWidth() / (float) mMap->getWidth();
- mHeightProportion = (float) mMapImage->getHeight() / (float) mMap->getHeight();
-
- logger->log("Minimap width : %d ; %d ; %f", mMapImage->getWidth(), mMap->getWidth(), mWidthProportion);
- logger->log("Minimap height : %d ; %d ; %f", mMapImage->getHeight(), mMap->getHeight(), mHeightProportion);
-
+ mWidthProportion = (float) mMapImage->getWidth() / map->getWidth();
+ mHeightProportion = (float) mMapImage->getHeight() / map->getHeight();
+
setMaxWidth(mMapImage->getWidth() > titleWidth ?
mMapImage->getWidth() + offsetX : titleWidth);
setMaxHeight(mMapImage->getHeight() + offsetY);