summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/charselectdialog.cpp2
-rw-r--r--src/gui/connection.cpp2
-rw-r--r--src/gui/connection.h6
-rw-r--r--src/gui/itemamount.cpp24
-rw-r--r--src/gui/npcpostdialog.cpp9
-rw-r--r--src/gui/okdialog.cpp2
-rw-r--r--src/gui/outfitwindow.cpp9
-rw-r--r--src/gui/partywindow.cpp17
-rw-r--r--src/gui/quitdialog.cpp2
-rw-r--r--src/gui/serverdialog.cpp2
-rw-r--r--src/gui/skill.cpp2
-rw-r--r--src/gui/skin.cpp10
-rw-r--r--src/gui/storagewindow.cpp2
-rw-r--r--src/gui/trade.cpp2
-rw-r--r--src/gui/viewport.cpp16
-rw-r--r--src/gui/widgets/avatar.cpp6
-rw-r--r--src/gui/widgets/avatar.h3
-rw-r--r--src/gui/widgets/chattab.cpp20
-rw-r--r--src/gui/widgets/progressbar.cpp14
19 files changed, 76 insertions, 74 deletions
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp
index f88fa733..4df0243b 100644
--- a/src/gui/charselectdialog.cpp
+++ b/src/gui/charselectdialog.cpp
@@ -107,7 +107,7 @@ CharSelectDialog::CharSelectDialog(LockedArray<LocalPlayer*> *charInfo,
mGender(gender)
#endif
{
- mSelectButton = new Button(_("Ok"), "ok", this);
+ mSelectButton = new Button(_("OK"), "ok", this);
mCancelButton = new Button(_("Cancel"), "cancel", this);
mPreviousButton = new Button(_("Previous"), "previous", this);
mNextButton = new Button(_("Next"), "next", this);
diff --git a/src/gui/connection.cpp b/src/gui/connection.cpp
index 0862ee69..4863edcd 100644
--- a/src/gui/connection.cpp
+++ b/src/gui/connection.cpp
@@ -30,7 +30,7 @@
#include "utils/gettext.h"
-ConnectionDialog::ConnectionDialog(int previousState):
+ConnectionDialog::ConnectionDialog(State previousState):
Window("Info"), mProgress(0), mPreviousState(previousState)
{
setContentSize(200, 100);
diff --git a/src/gui/connection.h b/src/gui/connection.h
index 62441fa9..d6059c3f 100644
--- a/src/gui/connection.h
+++ b/src/gui/connection.h
@@ -24,6 +24,8 @@
#include "gui/widgets/window.h"
+#include "main.h"
+
#include <guichan/actionlistener.hpp>
class ProgressBar;
@@ -41,7 +43,7 @@ class ConnectionDialog : public Window, gcn::ActionListener
*
* @see Window::Window
*/
- ConnectionDialog(int previousState);
+ ConnectionDialog(State previousState);
/**
* Called when the user presses Cancel. Restores the global state to
@@ -54,7 +56,7 @@ class ConnectionDialog : public Window, gcn::ActionListener
private:
ProgressBar *mProgressBar;
float mProgress;
- int mPreviousState;
+ State mPreviousState;
};
#endif
diff --git a/src/gui/itemamount.cpp b/src/gui/itemamount.cpp
index 252daf19..87df46c1 100644
--- a/src/gui/itemamount.cpp
+++ b/src/gui/itemamount.cpp
@@ -82,7 +82,7 @@ ItemAmountWindow::ItemAmountWindow(Usage usage, Window *parent, Item *item,
// Slider
mItemAmountSlide = new Slider(1.0, mMax);
mItemAmountSlide->setHeight(10);
- mItemAmountSlide->setActionEventId("Slide");
+ mItemAmountSlide->setActionEventId("slide");
mItemAmountSlide->addActionListener(this);
//Item icon
@@ -90,11 +90,11 @@ ItemAmountWindow::ItemAmountWindow(Usage usage, Window *parent, Item *item,
mItemIcon = new Icon(image);
// Buttons
- Button *minusButton = new Button("-", "Minus", this);
- Button *plusButton = new Button("+", "Plus", this);
- Button *okButton = new Button(_("Ok"), "Ok", this);
- Button *cancelButton = new Button(_("Cancel"), "Cancel", this);
- Button *addAllButton = new Button(_("All"), "All", this);
+ Button *minusButton = new Button("-", "minus", this);
+ Button *plusButton = new Button("+", "plus", this);
+ Button *okButton = new Button(_("Ok"), "ok", this);
+ Button *cancelButton = new Button(_("Cancel"), "cancel", this);
+ Button *addAllButton = new Button(_("All"), "all", this);
minusButton->adjustSize();
minusButton->setWidth(plusButton->getWidth());
@@ -168,27 +168,27 @@ void ItemAmountWindow::action(const gcn::ActionEvent &event)
{
int amount = mItemAmountTextField->getValue();
- if (event.getId() == "Cancel")
+ if (event.getId() == "cancel")
{
close();
}
- else if (event.getId() == "Plus" && amount < mMax)
+ else if (event.getId() == "plus" && amount < mMax)
{
amount++;
}
- else if (event.getId() == "Minus" && amount > 1)
+ else if (event.getId() == "minus" && amount > 1)
{
amount--;
}
- else if (event.getId() == "All")
+ else if (event.getId() == "all")
{
amount = mMax;
}
- else if (event.getId() == "Slide")
+ else if (event.getId() == "slide")
{
amount = static_cast<int>(mItemAmountSlide->getValue());
}
- else if (event.getId() == "Ok")
+ else if (event.getId() == "ok")
{
finish(mItem, amount, mUsage);
scheduleDelete();
diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp
index 20123745..32dbe22c 100644
--- a/src/gui/npcpostdialog.cpp
+++ b/src/gui/npcpostdialog.cpp
@@ -41,7 +41,7 @@ NpcPostDialog::NpcPostDialog():
setContentSize(400, 180);
// create text field for receiver
- gcn::Label *senderText = new Label("To:");
+ gcn::Label *senderText = new Label(_("To:"));
senderText->setPosition(5, 5);
mSender = new TextField;
mSender->setPosition(senderText->getWidth() + 5, 5);
@@ -49,8 +49,8 @@ NpcPostDialog::NpcPostDialog():
// create button for sending
Button *sendButton = new Button(_("Send"), "send", this);
- sendButton->setPosition(400-sendButton->getWidth(),
- 170-sendButton->getHeight());
+ sendButton->setPosition(400 - sendButton->getWidth(),
+ 170 - sendButton->getHeight());
Button *cancelButton = new Button(_("Cancel"), "cancel", this);
cancelButton->setPosition(sendButton->getX() - (cancelButton->getWidth() + 2),
sendButton->getY());
@@ -82,7 +82,8 @@ void NpcPostDialog::action(const gcn::ActionEvent &event)
{
if (mSender->getText().empty() || mText->getText().empty())
{
- localChatTab->chatLog("Failed to send as sender or letter invalid");
+ localChatTab->chatLog(_("Failed to send as sender or letter "
+ "invalid."));
}
else
{
diff --git a/src/gui/okdialog.cpp b/src/gui/okdialog.cpp
index 9da070eb..8982d528 100644
--- a/src/gui/okdialog.cpp
+++ b/src/gui/okdialog.cpp
@@ -39,7 +39,7 @@ OkDialog::OkDialog(const std::string &title, const std::string &msg,
mTextBox->setOpaque(false);
mTextBox->setTextWrapped(msg, 260);
- gcn::Button *okButton = new Button(_("Ok"), "ok", this);
+ gcn::Button *okButton = new Button(_("OK"), "ok", this);
const int numRows = mTextBox->getNumberOfRows();
const int fontHeight = getFont()->getHeight();
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index 53950299..f43e1440 100644
--- a/src/gui/outfitwindow.cpp
+++ b/src/gui/outfitwindow.cpp
@@ -153,9 +153,14 @@ void OutfitWindow::wearOutfit(int outfit)
//non vis is 3,4,7
if (i != 3 && i != 4 && i != 7)
{
- if (!(item = player_node->getInventory()->getItem(player_node
- ->mEquipment.get()->getEquipment(i))))
+#ifdef TMWSERV_SUPPORT
+ if (!(item = player_node->mEquipment.get()->getEquipment(i)))
continue;
+#else
+ if (!(item = player_node->getInventory()->getItem(
+ player_node->mEquipment.get()->getEquipment(i))))
+ continue;
+#endif
Net::getInventoryHandler()->unequipItem(item);
}
}
diff --git a/src/gui/partywindow.cpp b/src/gui/partywindow.cpp
index 68e5a371..f66ffaac 100644
--- a/src/gui/partywindow.cpp
+++ b/src/gui/partywindow.cpp
@@ -123,6 +123,7 @@ void PartyWindow::updateMember(int id, const std::string &memberName,
member->name = memberName;
member->leader = leader;
member->online = online;
+ member->avatar->setDisplayBold(leader);
member->avatar->setName(memberName);
member->avatar->setOnline(online);
@@ -170,24 +171,24 @@ void PartyWindow::showPartyInvite(const std::string &inviter,
// check there isnt already an invite showing
if (mPartyInviter != "")
{
- localChatTab->chatLog("Received party request, but one already exists",
- BY_SERVER);
+ localChatTab->chatLog(_("Received party request, but one already "
+ "exists."), BY_SERVER);
return;
}
std::string msg;
// log invite
if (partyName.empty())
- msg = strprintf("%s has invited you to join their party",
+ msg = strprintf(N_("%s has invited you to join their party."),
inviter.c_str());
else
- msg = strprintf("%s has invited you to join the %s party",
+ msg = strprintf(N_("%s has invited you to join the %s party."),
inviter.c_str(), partyName.c_str());
localChatTab->chatLog(msg, BY_SERVER);
// show invite
- acceptDialog = new ConfirmDialog("Accept Party Invite", msg, this);
+ acceptDialog = new ConfirmDialog(_("Accept Party Invite"), msg, this);
acceptDialog->addActionListener(this);
mPartyInviter = inviter;
@@ -200,13 +201,15 @@ void PartyWindow::action(const gcn::ActionEvent &event)
// check if they accepted the invite
if (eventId == "yes")
{
- localChatTab->chatLog("Accepted invite from " + mPartyInviter);
+ localChatTab->chatLog(strprintf(_("Accepted invite from %s."),
+ mPartyInviter.c_str()));
Net::getPartyHandler()->inviteResponse(mPartyInviter, true);
mPartyInviter = "";
}
else if (eventId == "no")
{
- localChatTab->chatLog("Rejected invite from " + mPartyInviter);
+ localChatTab->chatLog(strprintf(_("Rejected invite from %s."),
+ mPartyInviter.c_str()));
Net::getPartyHandler()->inviteResponse(mPartyInviter, false);
mPartyInviter = "";
}
diff --git a/src/gui/quitdialog.cpp b/src/gui/quitdialog.cpp
index e506aea3..98657001 100644
--- a/src/gui/quitdialog.cpp
+++ b/src/gui/quitdialog.cpp
@@ -36,7 +36,7 @@ QuitDialog::QuitDialog(bool* quitGame, QuitDialog** pointerToMe):
mForceQuit = new RadioButton(_("Quit"), "quitdialog");
mSwitchAccountServer = new RadioButton(_("Switch server"), "quitdialog");
mSwitchCharacter = new RadioButton(_("Switch character"), "quitdialog");
- mOkButton = new Button(_("Ok"), "ok", this);
+ mOkButton = new Button(_("OK"), "ok", this);
mCancelButton = new Button(_("Cancel"), "cancel", this);
setContentSize(200, 91);
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index a3dfdeae..5d08a2ec 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -100,7 +100,7 @@ ServerDialog::ServerDialog(LoginData *loginData):
mMostUsedServersDropDown = new DropDown(mMostUsedServersListModel);
- mOkButton = new Button(_("Ok"), "connect", this);
+ mOkButton = new Button(_("OK"), "connect", this);
mCancelButton = new Button(_("Cancel"), "cancel", this);
mServerNameField->setActionEventId("connect");
diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp
index 3a4fb75c..7698098c 100644
--- a/src/gui/skill.cpp
+++ b/src/gui/skill.cpp
@@ -41,7 +41,7 @@
#include "utils/stringutils.h"
#include "utils/xml.h"
-static const char *SKILLS_FILE = _("skills.xml");
+static const char *SKILLS_FILE = "skills.xml";
struct SkillInfo
{
diff --git a/src/gui/skin.cpp b/src/gui/skin.cpp
index f6eb0d58..5881a073 100644
--- a/src/gui/skin.cpp
+++ b/src/gui/skin.cpp
@@ -101,16 +101,14 @@ void Skin::updateAlpha()
int Skin::getMinWidth() const
{
- return (mBorder.grid[ImageRect::UPPER_LEFT]->getWidth() +
- mBorder.grid[ImageRect::UPPER_CENTER]->getWidth()) +
- mBorder.grid[ImageRect::UPPER_RIGHT]->getWidth();
+ return mBorder.grid[ImageRect::UPPER_LEFT]->getWidth() +
+ mBorder.grid[ImageRect::UPPER_RIGHT]->getWidth();
}
int Skin::getMinHeight() const
{
- return (mBorder.grid[ImageRect::UPPER_LEFT]->getHeight() +
- mBorder.grid[ImageRect::LEFT]->getHeight()) +
- mBorder.grid[ImageRect::LOWER_LEFT]->getHeight();
+ return mBorder.grid[ImageRect::UPPER_LEFT]->getHeight() +
+ mBorder.grid[ImageRect::LOWER_LEFT]->getHeight();
}
SkinLoader::SkinLoader()
diff --git a/src/gui/storagewindow.cpp b/src/gui/storagewindow.cpp
index 593a49a3..91224359 100644
--- a/src/gui/storagewindow.cpp
+++ b/src/gui/storagewindow.cpp
@@ -75,7 +75,7 @@ StorageWindow::StorageWindow(int invSize):
mUsedSlots = player_node->getStorage()->getNumberOfSlotsUsed();
- mSlotsLabel = new Label(_("Slots: "));
+ mSlotsLabel = new Label(_("Slots:"));
mSlotsBar = new ProgressBar(0.0f, 100, 20, gcn::Color(225, 200, 25));
mSlotsBar->setText(strprintf("%d/%d", mUsedSlots, mMaxSlots));
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index 1e7faa97..3abb985e 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -308,7 +308,7 @@ void TradeWindow::action(const gcn::ActionEvent &event)
int curMoney = player_node->getMoney();
if(v > curMoney)
{
- localChatTab->chatLog(_("You don't have enough money"), BY_SERVER);
+ localChatTab->chatLog(_("You don't have enough money."), BY_SERVER);
v = curMoney;
}
Net::getTradeHandler()->setMoney(v);
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 2c3f4007..787723c0 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -357,24 +357,12 @@ void Viewport::mousePressed(gcn::MouseEvent &event)
if (player_node->withinAttackRange(being) ||
keyboard.isKeyActive(keyboard.KEY_ATTACK))
{
- player_node->setGotoTarget(being);
-//TODO: This can be changed when TMWServ moves to target based combat
-#ifdef TMWSERV_SUPPORT
- player_node->attack();
-#else
player_node->attack(being,
!keyboard.isKeyActive(keyboard.KEY_TARGET));
-#endif
-
}
else
{
-#ifdef TMWSERV_SUPPORT
- player_node->setDestination(event.getX() + (int) mPixelViewX,
- event.getY() + (int) mPixelViewY);
-#else
- player_node->setDestination(tilex, tiley);
-#endif
+ player_node->setGotoTarget(being);
}
break;
default:
@@ -403,9 +391,9 @@ void Viewport::mousePressed(gcn::MouseEvent &event)
event.getY() + (int) mPixelViewY);
}
#else
- player_node->stopAttack();
player_node->setDestination(tilex, tiley);
#endif
+ player_node->stopAttack();
mPlayerFollowMouse = true;
}
}
diff --git a/src/gui/widgets/avatar.cpp b/src/gui/widgets/avatar.cpp
index 16c77233..f7273c75 100644
--- a/src/gui/widgets/avatar.cpp
+++ b/src/gui/widgets/avatar.cpp
@@ -23,6 +23,7 @@
#include "localplayer.h"
+#include "gui/gui.h"
#include "gui/widgets/icon.h"
#include "gui/widgets/label.h"
@@ -39,7 +40,8 @@ namespace {
Avatar::Avatar():
mHp(0),
- mMaxHp(0)
+ mMaxHp(0),
+ mDisplayBold(false)
{
setOpaque(false);
@@ -111,6 +113,8 @@ void Avatar::updateAvatarLabel()
if (mName != player_node->getName() && mMaxHp != 0)
ss << " (" << mHp << "/" << mMaxHp << ")";
+ if (mDisplayBold)
+ mLabel->setFont(boldFont);
mLabel->setCaption(ss.str());
mLabel->adjustSize();
}
diff --git a/src/gui/widgets/avatar.h b/src/gui/widgets/avatar.h
index 32586668..dbe30a94 100644
--- a/src/gui/widgets/avatar.h
+++ b/src/gui/widgets/avatar.h
@@ -51,6 +51,8 @@ public:
void setMaxHp(int maxHp);
+ void setDisplayBold(bool displayBold) { mDisplayBold = displayBold; }
+
private:
void updateAvatarLabel();
@@ -59,6 +61,7 @@ private:
int mMaxHp;
Icon *mStatus;
gcn::Label *mLabel;
+ bool mDisplayBold;
};
#endif // AVATAR_H
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index 711680d1..85353bf7 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -227,15 +227,19 @@ void ChatTab::chatInput(std::string &msg)
std::string temp = msg.substr(start + 1, end - start - 1);
- toLower(trim(temp));
-
- const ItemInfo itemInfo = ItemDB::get(temp);
- if (itemInfo.getName() != _("Unknown item"))
+ // Do not parse an empty string (it crashes the client)
+ if (!temp.empty())
{
- msg.insert(end, "@@");
- msg.insert(start+1, "|");
- msg.insert(start+1, toString(itemInfo.getId()));
- msg.insert(start+1, "@@");
+ toLower(trim(temp));
+
+ const ItemInfo itemInfo = ItemDB::get(temp);
+ if (itemInfo.getName() != _("Unknown item"))
+ {
+ msg.insert(end, "@@");
+ msg.insert(start+1, "|");
+ msg.insert(start+1, toString(itemInfo.getId()));
+ msg.insert(start+1, "@@");
+ }
}
}
start = msg.find('[', start + 1);
diff --git a/src/gui/widgets/progressbar.cpp b/src/gui/widgets/progressbar.cpp
index 58f24651..c673ffb3 100644
--- a/src/gui/widgets/progressbar.cpp
+++ b/src/gui/widgets/progressbar.cpp
@@ -31,6 +31,8 @@
#include "resources/image.h"
#include "resources/resourcemanager.h"
+#include "utils/dtor.h"
+
#include <guichan/font.hpp>
ImageRect ProgressBar::mBorder;
@@ -59,7 +61,7 @@ ProgressBar::ProgressBar(float progress,
mBorder.grid[1] = dBorders->getSubImage(4, 0, 3, 4);
mBorder.grid[2] = dBorders->getSubImage(7, 0, 4, 4);
mBorder.grid[3] = dBorders->getSubImage(0, 4, 4, 10);
- mBorder.grid[4] = resman->getImage("graphics/gui/bg_quad_dis.png");
+ mBorder.grid[4] = dBorders->getSubImage(4, 4, 3, 10);
mBorder.grid[5] = dBorders->getSubImage(7, 4, 4, 10);
mBorder.grid[6] = dBorders->getSubImage(0, 15, 4, 4);
mBorder.grid[7] = dBorders->getSubImage(4, 15, 3, 4);
@@ -82,15 +84,7 @@ ProgressBar::~ProgressBar()
if (mInstances == 0)
{
- delete mBorder.grid[0];
- delete mBorder.grid[1];
- delete mBorder.grid[2];
- delete mBorder.grid[3];
- mBorder.grid[4]->decRef();
- delete mBorder.grid[5];
- delete mBorder.grid[6];
- delete mBorder.grid[7];
- delete mBorder.grid[8];
+ for_each(mBorder.grid, mBorder.grid + 9, dtor<Image*>());
}
}