summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIra Rice <irarice@gmail.com>2009-01-12 09:54:00 -0700
committerIra Rice <irarice@gmail.com>2009-01-12 09:54:00 -0700
commitfc1539e019b6d916d1470ddf1f31997044af8396 (patch)
treeb952c33128f3920363823f5112f0149f332543a5
parent4018856d2d30532ad2404de4462ff3e473938a22 (diff)
downloadmana-client-fc1539e019b6d916d1470ddf1f31997044af8396.tar.gz
mana-client-fc1539e019b6d916d1470ddf1f31997044af8396.tar.bz2
mana-client-fc1539e019b6d916d1470ddf1f31997044af8396.tar.xz
mana-client-fc1539e019b6d916d1470ddf1f31997044af8396.zip
Fixed minimap so that map names don't overflow the minimap's width.
Signed-off-by: Ira Rice <irarice@gmail.com>
-rw-r--r--src/gui/minimap.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index 0d14c360..61a56445 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -19,6 +19,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <guichan/font.hpp>
+
#include "minimap.h"
#include "../being.h"
@@ -56,12 +58,14 @@ void Minimap::setMapImage(Image *img)
if (mMapImage)
{
- int offsetX = getPadding() + 4;
- int offsetY = getTitleBarHeight() + 4;
+ const int offsetX = getPadding() + 4;
+ const int offsetY = getTitleBarHeight() + 4;
+ const int titleWidth = getFont()->getWidth(getCaption()) + 15;
+ const int mapWidth = mMapImage->getWidth() < 100 ?
+ mMapImage->getWidth() + offsetX : 100;
mMapImage->setAlpha(config.getValue("guialpha", 0.8));
setDefaultSize(offsetX, offsetY,
- mMapImage->getWidth() < 100 ?
- mMapImage->getWidth() + offsetX : 100,
+ mapWidth > titleWidth ? mapWidth : titleWidth,
mMapImage->getHeight() < 100 ?
mMapImage->getHeight() + offsetY : 100);
loadWindowState();