summaryrefslogtreecommitdiff
path: root/src/gui/beingpopup.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2010-02-22 00:02:09 -0700
committerJared Adams <jaxad0127@gmail.com>2010-02-22 00:02:09 -0700
commit4406b2fd90a5d4656bc923bf5c751e4c5250a0d2 (patch)
treebf25813b8711fb1dd51a77104a63a9c9647a60df /src/gui/beingpopup.cpp
parent7c925545419eeda0b0b26b290a9ec0412960fbd8 (diff)
downloadmana-client-4406b2fd90a5d4656bc923bf5c751e4c5250a0d2.tar.gz
mana-client-4406b2fd90a5d4656bc923bf5c751e4c5250a0d2.tar.bz2
mana-client-4406b2fd90a5d4656bc923bf5c751e4c5250a0d2.tar.xz
mana-client-4406b2fd90a5d4656bc923bf5c751e4c5250a0d2.zip
Cleanup some popup-related code and make sure BeingPopup is included
Diffstat (limited to 'src/gui/beingpopup.cpp')
-rw-r--r--src/gui/beingpopup.cpp45
1 files changed, 12 insertions, 33 deletions
diff --git a/src/gui/beingpopup.cpp b/src/gui/beingpopup.cpp
index 89933067..3d60589f 100644
--- a/src/gui/beingpopup.cpp
+++ b/src/gui/beingpopup.cpp
@@ -1,8 +1,6 @@
/*
* The Mana Client
- * Copyright (C) 2008 The Legend of Mazzeroth Development Team
- * Copyright (C) 2008-2009 The Mana World Development Team
- * Copyright (C) 2009-2010 The Mana Developers
+ * Copyright (C) 2010 The Mana Developers
*
* This file is part of The Mana Client.
*
@@ -23,10 +21,9 @@
#include "gui/beingpopup.h"
#include "graphics.h"
+#include "player.h"
#include "units.h"
-#include "being.h"
-
#include "gui/gui.h"
#include "gui/palette.h"
@@ -62,29 +59,28 @@ BeingPopup::~BeingPopup()
{
}
-void BeingPopup::setBeing(int x, int y, Being *b)
+void BeingPopup::show(int x, int y, Player *p)
{
- if (!b)
+ if (!p)
{
setVisible(false);
return;
}
- if (!(b->getPartyName().empty()))
+ if (!(p->getPartyName().empty()))
{
- mBeingName->setTextWrapped(b->getName(), 196);
- mBeingParty->setTextWrapped(strprintf(_("Party: %s"),b->getPartyName().c_str()), 196);
-
- int minWidth = mBeingName->getMinWidth();
+ mBeingName->setTextWrapped(p->getName(), 196);
+ mBeingParty->setTextWrapped(strprintf(_("Party: %s"),
+ p->getPartyName().c_str()), 196);
- if (mBeingParty->getMinWidth() > minWidth)
- minWidth = mBeingParty->getMinWidth();
+ int minWidth = std::max(mBeingName->getMinWidth(),
+ mBeingParty->getMinWidth());
const int height = getFont()->getHeight();
- setContentSize(minWidth, (height * 2) + 10);
+ setContentSize(minWidth + 10, (height * 2) + 10);
- view(x, y);
+ position(x, y);
return;
}
@@ -95,20 +91,3 @@ gcn::Color BeingPopup::getColor()
{
return guiPalette->getColor(Palette::GENERIC);
}
-
-void BeingPopup::view(int x, int y)
-{
- const int distance = 20;
-
- int posX = std::max(0, x - getWidth() / 2);
- int posY = y + distance;
-
- if (posX > graphics->getWidth() - getWidth())
- posX = graphics->getWidth() - getWidth();
- if (posY > graphics->getHeight() - getHeight())
- posY = y - getHeight() - distance;
-
- setPosition(posX, posY);
- setVisible(true);
- requestMoveToTop();
-}