diff options
Diffstat (limited to 'src/gui')
158 files changed, 1027 insertions, 874 deletions
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp index b8f58dbb..6614feb9 100644 --- a/src/gui/browserbox.cpp +++ b/src/gui/browserbox.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/browserbox.h b/src/gui/browserbox.h index 500c9fba..5dde402e 100644 --- a/src/gui/browserbox.h +++ b/src/gui/browserbox.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/button.cpp b/src/gui/button.cpp index dbb5f568..1d3a04e4 100644 --- a/src/gui/button.cpp +++ b/src/gui/button.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/button.h b/src/gui/button.h index f21d2661..abaf5c43 100644 --- a/src/gui/button.h +++ b/src/gui/button.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index 5a57dcc6..768dab4d 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,6 +31,7 @@ #include "widgets/layout.h" #include "../npc.h" +#include "../units.h" #include "../net/messageout.h" #include "../net/protocol.h" @@ -43,7 +43,7 @@ BuyDialog::BuyDialog(Network *network): Window(_("Buy")), mNetwork(network), mMoney(0), mAmountItems(0), mMaxItems(0) { - setWindowName(_("Buy")); + setWindowName("Buy"); setResizable(true); setMinWidth(260); setMinHeight(230); @@ -55,7 +55,8 @@ BuyDialog::BuyDialog(Network *network): mScrollArea = new ScrollArea(mShopItemList); mSlider = new Slider(1.0); mQuantityLabel = new gcn::Label("0"); - mMoneyLabel = new gcn::Label(strprintf(_("Price: %d GP / Total: %d GP"), 0, 0)); + mMoneyLabel = new gcn::Label(strprintf(_("Price: %s / Total: %s"), + "", "")); mIncreaseButton = new Button("+", "+", this); mDecreaseButton = new Button("-", "-", this); mBuyButton = new Button(_("Buy"), "buy", this); @@ -236,5 +237,14 @@ void BuyDialog::updateButtonsAndLabels() // Update quantity and money labels mQuantityLabel->setCaption(strprintf("%d / %d", mAmountItems, mMaxItems)); mMoneyLabel->setCaption - (strprintf(_("Price: %d GP / Total: %d GP"), price, mMoney - price)); + (strprintf(_("Price: %s / Total: %s"), + Units::formatCurrency(price).c_str(), + Units::formatCurrency(mMoney - price).c_str())); +} + +void BuyDialog::logic() +{ + Window::logic(); + + if (!current_npc) setVisible(false); } diff --git a/src/gui/buy.h b/src/gui/buy.h index 9029fe9d..2555e139 100644 --- a/src/gui/buy.h +++ b/src/gui/buy.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -96,6 +95,11 @@ class BuyDialog : public Window, public gcn::ActionListener, */ void updateButtonsAndLabels(); + /** + * Check for current NPC + */ + void logic(); + private: Network *mNetwork; gcn::Button *mBuyButton; diff --git a/src/gui/buysell.cpp b/src/gui/buysell.cpp index dc7deef6..818413c2 100644 --- a/src/gui/buysell.cpp +++ b/src/gui/buysell.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -55,12 +54,19 @@ BuySellDialog::BuySellDialog(Network *network): requestFocus(); } +void BuySellDialog::logic() +{ + Window::logic(); + + if (!current_npc) setVisible(false); +} + void BuySellDialog::action(const gcn::ActionEvent &event) { setVisible(false); int action = 0; - NPC::mTalking = false; + NPC::isTalking = false; if (event.getId() == "Buy") { diff --git a/src/gui/buysell.h b/src/gui/buysell.h index 747066a7..197c1a2b 100644 --- a/src/gui/buysell.h +++ b/src/gui/buysell.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,6 +45,11 @@ class BuySellDialog : public Window, public gcn::ActionListener BuySellDialog(Network *network); /** + * Check for current NPC + */ + void logic(); + + /** * Called when receiving actions from the widgets. */ void action(const gcn::ActionEvent &event); diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index fa0594d6..6d5e082a 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,6 +37,7 @@ #include "../game.h" #include "../localplayer.h" #include "../main.h" +#include "../units.h" #include "../net/charserverhandler.h" #include "../net/messageout.h" @@ -86,6 +86,10 @@ CharSelectDialog::CharSelectDialog(Network *network, Window(_("Select Character")), mNetwork(network), mCharInfo(charInfo), mGender(gender), mCharSelected(false) { + mCharInfo->select(0); + LocalPlayer *pi = mCharInfo->getEntry(); + if (pi) + mMoney = Units::formatCurrency(pi->mGp); // Control that shows the Player mPlayerBox = new PlayerBox; mPlayerBox->setWidth(74); @@ -93,7 +97,7 @@ CharSelectDialog::CharSelectDialog(Network *network, mNameLabel = new gcn::Label(strprintf(_("Name: %s"), "")); mLevelLabel = new gcn::Label(strprintf(_("Level: %d"), 0)); mJobLevelLabel = new gcn::Label(strprintf(_("Job Level: %d"), 0)); - mMoneyLabel = new gcn::Label(strprintf(_("Money: %d"), 0)); + mMoneyLabel = new gcn::Label(strprintf(_("Money: %s"), mMoney.c_str())); const std::string tempString = getFont()->getWidth(_("New")) < getFont()->getWidth(_("Delete")) ? @@ -164,10 +168,16 @@ void CharSelectDialog::action(const gcn::ActionEvent &event) else if (event.getId() == "previous") { mCharInfo->prev(); + LocalPlayer *pi = mCharInfo->getEntry(); + if (pi) + mMoney = Units::formatCurrency(pi->mGp); } else if (event.getId() == "next") { mCharInfo->next(); + LocalPlayer *pi = mCharInfo->getEntry(); + if (pi) + mMoney = Units::formatCurrency(pi->mGp); } } @@ -177,10 +187,12 @@ void CharSelectDialog::updatePlayerInfo() if (pi) { - mNameLabel->setCaption(strprintf(_("Name: %s"), pi->getName().c_str())); + mNameLabel->setCaption(strprintf(_("Name: %s"), + pi->getName().c_str())); mLevelLabel->setCaption(strprintf(_("Level: %d"), pi->mLevel)); - mJobLevelLabel->setCaption(strprintf(_("Job Level: %d"), pi->mJobLevel)); - mMoneyLabel->setCaption(strprintf(_("Gold: %d"), pi->mGp)); + mJobLevelLabel->setCaption(strprintf(_("Job Level: %d"), + pi->mJobLevel)); + mMoneyLabel->setCaption(strprintf(_("Money: %s"), mMoney.c_str())); if (!mCharSelected) { mNewDelCharButton->setCaption(_("Delete")); diff --git a/src/gui/char_select.h b/src/gui/char_select.h index 037b809f..28091a18 100644 --- a/src/gui/char_select.h +++ b/src/gui/char_select.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -72,7 +71,7 @@ class CharSelectDialog : public Window, public gcn::ActionListener gcn::Label *mNameLabel; gcn::Label *mLevelLabel; gcn::Label *mJobLevelLabel; - gcn::Label *mMoneyLabel; + gcn::Label *mMoneyLabel; std::string mMoney; PlayerBox *mPlayerBox; diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp index 6977a104..89bfa93a 100644 --- a/src/gui/char_server.cpp +++ b/src/gui/char_server.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -51,7 +50,7 @@ ServerSelectDialog::ServerSelectDialog(LoginData *loginData, int nextState): mLoginData(loginData), mNextState(nextState) { - mServerListModel = new ServerListModel(); + mServerListModel = new ServerListModel; mServerList = new ListBox(mServerListModel); ScrollArea *mScrollArea = new ScrollArea(mServerList); mOkButton = new Button(_("OK"), "ok", this); diff --git a/src/gui/char_server.h b/src/gui/char_server.h index 207fb86e..49a5b47b 100644 --- a/src/gui/char_server.h +++ b/src/gui/char_server.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 91e410ce..20d0213b 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -52,14 +51,14 @@ ChatWindow::ChatWindow(Network * network): Window(""), mNetwork(network), mTmpVisible(false) { - setWindowName(_("Chat")); + setWindowName("Chat"); setResizable(true); setDefaultSize(0, windowContainer->getHeight() - 123, 600, 123); setMinWidth(150); setMinHeight(90); - mItemLinkHandler = new ItemLinkHandler(); + mItemLinkHandler = new ItemLinkHandler; mChatInput = new ChatInput; mChatInput->setActionEventId("chatinput"); @@ -155,13 +154,15 @@ void ChatWindow::chatLog(std::string line, int own, bool ignoreRecord) case BY_GM: if (tmp.nick.empty()) { - tmp.nick = std::string(_("Global announcement: ")); + tmp.nick = std::string(_("Global announcement:")); + tmp.nick += " "; lineColor = "##G"; } else { - tmp.nick = strprintf(_("Global announcement from %s: "), + tmp.nick = strprintf(_("Global announcement from %s:"), tmp.nick.c_str()); + tmp.nick += " "; lineColor = "##1"; // Equiv. to BrowserBox::RED } break; @@ -184,7 +185,8 @@ void ChatWindow::chatLog(std::string line, int own, bool ignoreRecord) lineColor = "##P"; break; case ACT_WHISPER: - tmp.nick += CAT_WHISPER; + tmp.nick = strprintf(_("%s whispers:"), tmp.nick.c_str()); + tmp.nick += " "; lineColor = "##W"; break; case ACT_IS: @@ -246,7 +248,7 @@ void ChatWindow::chatLog(CHATSKILL act) chatLog(const_msg(act), BY_SERVER); } -void ChatWindow::action(const gcn::ActionEvent & event) +void ChatWindow::action(const gcn::ActionEvent &event) { if (event.getId() == "chatinput") { @@ -282,7 +284,7 @@ void ChatWindow::action(const gcn::ActionEvent & event) } } -void ChatWindow::requestChatFocus() +bool ChatWindow::requestChatFocus() { // Make sure chatWindow is visible if (!isVisible()) @@ -297,9 +299,14 @@ void ChatWindow::requestChatFocus() mTmpVisible = true; } + // Don't do anything else if the input is already visible and has focus + if (mChatInput->isVisible() && mChatInput->isFocused()) + return false; + // Give focus to the chat input mChatInput->setVisible(true); mChatInput->requestFocus(); + return true; } bool ChatWindow::isInputFocused() @@ -672,7 +679,7 @@ std::string ChatWindow::const_msg(CHATSKILL act) msg += _("You cannot do that right now!"); break; case RFAIL_ZENY: - msg += _("Seems you need more GP... ;-)"); + msg += _("Seems you need more money... ;-)"); break; case RFAIL_WEAPON: msg += _("You cannot use this skill with that kind of weapon!"); @@ -722,9 +729,8 @@ void ChatWindow::scroll(int amount) mTextOutput->showPart(scr); } -void ChatWindow::keyPressed(gcn::KeyEvent & event) +void ChatWindow::keyPressed(gcn::KeyEvent &event) { - if (event.getKey().getValue() == Key::DOWN && mCurHist != mHistory.end()) { diff --git a/src/gui/chat.h b/src/gui/chat.h index 45d0c92f..6002fed3 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -139,8 +138,11 @@ class ChatWindow : public Window, public gcn::ActionListener, /** * Request focus for typing chat message. + * + * \returns true if the input was shown + * false otherwise */ - void requestChatFocus(); + bool requestChatFocus(); /** * Checks whether ChatWindow is Focused or not. diff --git a/src/gui/chatinput.cpp b/src/gui/chatinput.cpp index 42c6d4de..43f3cde4 100644 --- a/src/gui/chatinput.cpp +++ b/src/gui/chatinput.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/chatinput.h b/src/gui/chatinput.h index 96c30b3f..a4a50502 100644 --- a/src/gui/chatinput.h +++ b/src/gui/chatinput.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/checkbox.cpp b/src/gui/checkbox.cpp index 413c28d0..7fa4fa81 100644 --- a/src/gui/checkbox.cpp +++ b/src/gui/checkbox.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/checkbox.h b/src/gui/checkbox.h index 260ed3a1..20adb43c 100644 --- a/src/gui/checkbox.h +++ b/src/gui/checkbox.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/color.cpp b/src/gui/color.cpp index b68bf68b..f9b89857 100644 --- a/src/gui/color.cpp +++ b/src/gui/color.cpp @@ -2,7 +2,7 @@ * Configurable text colors * Copyright (C) 2008 Douglas Boffey <dougaboffey@netscape.net> * - * This file is part of Aethyra. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -52,7 +52,7 @@ Color::~Color() } } -void Color::setColor(const char c, const int rgb) +void Color::setColor(char c, int rgb) { for (ColVector::iterator col = mColVector.begin(), colEnd = mColVector.end(); @@ -67,7 +67,7 @@ void Color::setColor(const char c, const int rgb) } } -int Color::getColor(const char c, bool &valid) const +int Color::getColor(char c, bool &valid) const { for (ColVector::const_iterator col = mColVector.begin(), colEnd = mColVector.end(); @@ -102,7 +102,7 @@ char Color::getColorCharAt(int i) return mColVector[i].ch; } -void Color::addColor(const char c, const int rgb, const std::string &text) +void Color::addColor(char c, int rgb, const std::string &text) { int trueRgb = (int) config.getValue("Color" + text, rgb); mColVector.push_back(ColorElem(c, trueRgb, text)); diff --git a/src/gui/color.h b/src/gui/color.h index aca3d045..2816cedc 100644 --- a/src/gui/color.h +++ b/src/gui/color.h @@ -2,7 +2,7 @@ * Configurable text colors * Copyright (C) 2008 Douglas Boffey <dougaboffey@netscape.net> * - * This file is part of Aethyra. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -46,7 +46,7 @@ class Color : public gcn::ListModel * @param c charater to be replaced * @param rgb color to replace character */ - void setColor(const char c, const int rgb); + void setColor(char c, int rgb); /** * Define the color replacement for a character @@ -56,7 +56,7 @@ class Color : public gcn::ListModel * @param g green component * @param b blue component */ - void setColor(const char c, const int r, const int g, const int b) + void setColor(char c, int r, int g, int b) { setColor(c, (r << 16) | (g << 8) | b); } @@ -67,12 +67,12 @@ class Color : public gcn::ListModel * @param c character requested * @param valid indicate whether character is known */ - int getColor(const char c, bool &valid) const; + int getColor(char c, bool &valid) const; /** * Return the number of colors known */ - int getNumberOfElements() {return mColVector.size(); } + int getNumberOfElements() { return mColVector.size(); } /** * Return the name of the ith color @@ -111,7 +111,7 @@ class Color : public gcn::ListModel private: struct ColorElem { - ColorElem(const char c, const int rgb, const std::string &text) : + ColorElem(char c, int rgb, const std::string &text) : ch(c), rgb(rgb), text(text) {} char ch; int rgb; @@ -128,7 +128,7 @@ class Color : public gcn::ListModel * @param rgb default color if not found in config * @param text identifier of color */ - void addColor(const char c, const int rgb, const std::string &text); + void addColor(char c, int rgb, const std::string &text); }; extern Color *textColor; diff --git a/src/gui/confirm_dialog.cpp b/src/gui/confirm_dialog.cpp index 2bc330c0..fbbc6101 100644 --- a/src/gui/confirm_dialog.cpp +++ b/src/gui/confirm_dialog.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,7 +33,7 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg, Window *parent): Window(title, true, parent) { - mTextBox = new TextBox(); + mTextBox = new TextBox; mTextBox->setEditable(false); mTextBox->setOpaque(false); diff --git a/src/gui/confirm_dialog.h b/src/gui/confirm_dialog.h index 493e9dda..8d8c0436 100644 --- a/src/gui/confirm_dialog.h +++ b/src/gui/confirm_dialog.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -56,7 +55,6 @@ class ConfirmDialog : public Window, public gcn::ActionListener private: TextBox *mTextBox; ScrollArea *mTextArea; - gcn::Button *okButton; }; #endif diff --git a/src/gui/connection.cpp b/src/gui/connection.cpp index f6033cd7..a69698e9 100644 --- a/src/gui/connection.cpp +++ b/src/gui/connection.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/connection.h b/src/gui/connection.h index f91a0ad1..3caa611f 100644 --- a/src/gui/connection.h +++ b/src/gui/connection.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp index 1e199314..99b36fe4 100644 --- a/src/gui/debugwindow.cpp +++ b/src/gui/debugwindow.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h index 95e8b5e4..e089de27 100644 --- a/src/gui/debugwindow.h +++ b/src/gui/debugwindow.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/emotecontainer.cpp b/src/gui/emotecontainer.cpp index 9764ab9c..ad3f5c83 100644 --- a/src/gui/emotecontainer.cpp +++ b/src/gui/emotecontainer.cpp @@ -2,8 +2,7 @@ * Extended support for activating emotes * Copyright (C) 2009 Aethyra Development Team * - * This file is part of Aethyra derived from original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/emotecontainer.h b/src/gui/emotecontainer.h index 260f1754..fefce793 100644 --- a/src/gui/emotecontainer.h +++ b/src/gui/emotecontainer.h @@ -2,8 +2,7 @@ * Extended support for activating emotes * Copyright (C) 2009 Aethyra Development Team * - * This file is part of Aethyra derived from original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/emoteshortcutcontainer.cpp b/src/gui/emoteshortcutcontainer.cpp index f4cef106..df1bf74c 100644 --- a/src/gui/emoteshortcutcontainer.cpp +++ b/src/gui/emoteshortcutcontainer.cpp @@ -2,8 +2,7 @@ * Extended support for activating emotes * Copyright (C) 2009 Aethyra Development Team * - * This file is part of Aethyra derived from original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/emoteshortcutcontainer.h b/src/gui/emoteshortcutcontainer.h index 4c4b3614..d32a9f79 100644 --- a/src/gui/emoteshortcutcontainer.h +++ b/src/gui/emoteshortcutcontainer.h @@ -2,8 +2,7 @@ * Extended support for activating emotes * Copyright (C) 2009 Aethyra Development Team * - * This file is part of Aethyra derived from original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/emotewindow.cpp b/src/gui/emotewindow.cpp index 30129941..48635720 100644 --- a/src/gui/emotewindow.cpp +++ b/src/gui/emotewindow.cpp @@ -2,7 +2,7 @@ * Extended support for activating emotes * Copyright (C) 2009 Aethyra Development Team * - * This file is part of Aethyra. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,7 +35,7 @@ EmoteWindow::EmoteWindow(): Window(_("Emote")) { - setWindowName(_("Emote")); + setWindowName("Emote"); setResizable(true); setCloseButton(true); setMinWidth(80); @@ -44,7 +44,7 @@ EmoteWindow::EmoteWindow(): mUseButton = new Button(_("Use"), "use", this); - mEmotes = new EmoteContainer(); + mEmotes = new EmoteContainer; mEmotes->addSelectionListener(this); mEmoteScroll = new ScrollArea(mEmotes); diff --git a/src/gui/emotewindow.h b/src/gui/emotewindow.h index 81ee4f05..8af24a7b 100644 --- a/src/gui/emotewindow.h +++ b/src/gui/emotewindow.h @@ -2,7 +2,7 @@ * Extended support for activating emotes * Copyright (C) 2009 Aethyra Development Team * - * This file is part of Aethyra. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index 27ea38ff..9a00f7a7 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra derived from original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -62,7 +61,7 @@ EquipmentWindow::EquipmentWindow(): Window(_("Equipment")), mSelected(-1) { - mItemPopup = new ItemPopup(); + mItemPopup = new ItemPopup; // Control that shows the Player mPlayerBox = new PlayerBox; @@ -160,7 +159,7 @@ void EquipmentWindow::action(const gcn::ActionEvent &event) } } -Item* EquipmentWindow::getItem(const int &x, const int &y) +Item* EquipmentWindow::getItem(int x, int y) const { for (int i = EQUIP_LEGS_SLOT; i < EQUIP_VECTOREND; i++) { diff --git a/src/gui/equipmentwindow.h b/src/gui/equipmentwindow.h index 7fdbaac8..24438477 100644 --- a/src/gui/equipmentwindow.h +++ b/src/gui/equipmentwindow.h @@ -1,27 +1,26 @@ /* - * Aethyra - * Copyright 2004 The Mana World Development Team + * The Mana World + * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra derived from original code - * from The Mana World. + * This file is part of The Mana World. * - * The Mana World is free software; you can redistribute it and/or modify + * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version. * - * The Mana World is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with The Mana World; if not, write to the Free Software + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef EQUIPMENT_WINDOW_H -#define EQUIPMENT_WINDOW_H +#ifndef EQUIPMENTWINDOW_H +#define EQUIPMENTWINDOW_H #include <guichan/actionlistener.hpp> @@ -90,7 +89,7 @@ class EquipmentWindow : public Window, public gcn::ActionListener void mouseExited(gcn::MouseEvent &event); void mouseMoved(gcn::MouseEvent &event); - Item* getItem(const int &x, const int &y); + Item* getItem(int x, int y) const; Equipment *mEquipment; Inventory *mInventory; diff --git a/src/gui/focushandler.cpp b/src/gui/focushandler.cpp index c642127d..b9cfd789 100644 --- a/src/gui/focushandler.cpp +++ b/src/gui/focushandler.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/focushandler.h b/src/gui/focushandler.h index fc5dd240..b0639bd8 100644 --- a/src/gui/focushandler.h +++ b/src/gui/focushandler.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/gccontainer.cpp b/src/gui/gccontainer.cpp index 7aebed15..8325ccd4 100644 --- a/src/gui/gccontainer.cpp +++ b/src/gui/gccontainer.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/gccontainer.h b/src/gui/gccontainer.h index 2071955d..da584a42 100644 --- a/src/gui/gccontainer.h +++ b/src/gui/gccontainer.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 85a33218..6d6ccbdf 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -98,7 +97,7 @@ Gui::Gui(Graphics *graphics): mFocusHandler = new FocusHandler; // Initialize top GUI widget - WindowContainer *guiTop = new WindowContainer(); + WindowContainer *guiTop = new WindowContainer; guiTop->setDimension(gcn::Rectangle(0, 0, graphics->getWidth(), graphics->getHeight())); guiTop->setOpaque(false); @@ -142,7 +141,7 @@ Gui::Gui(Graphics *graphics): config.addListener("customcursor", mConfigListener); // Create the viewport - viewport = new Viewport(); + viewport = new Viewport; viewport->setDimension(gcn::Rectangle(0, 0, graphics->getWidth(), graphics->getHeight())); guiTop->add(viewport); diff --git a/src/gui/gui.h b/src/gui/gui.h index afa358be..340eec09 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/help.cpp b/src/gui/help.cpp index fec39199..30c6a9c4 100644 --- a/src/gui/help.cpp +++ b/src/gui/help.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -37,10 +36,10 @@ HelpWindow::HelpWindow(): setMinWidth(300); setMinHeight(250); setContentSize(455, 350); - setWindowName(_("Help")); + setWindowName("Help"); setResizable(true); - mBrowserBox = new BrowserBox(); + mBrowserBox = new BrowserBox; mBrowserBox->setOpaque(false); mScrollArea = new ScrollArea(mBrowserBox); Button *okButton = new Button(_("Close"), "close", this); diff --git a/src/gui/help.h b/src/gui/help.h index 93d32c18..98e3aa67 100644 --- a/src/gui/help.h +++ b/src/gui/help.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/inttextfield.cpp b/src/gui/inttextfield.cpp index 40bbd887..d3fe448b 100644 --- a/src/gui/inttextfield.cpp +++ b/src/gui/inttextfield.cpp @@ -1,8 +1,8 @@ /* - * Aethyra - * Copyright (C) 2008 Douglas Boffey <dougaboffey@netscape.net> + * The Mana World + * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -57,6 +57,16 @@ void IntTextField::setRange(int min, int max) { mMin = min; mMax = max; + + if (mValue < mMin) + mValue = mMin; + else if (mValue > mMax) + mValue = mMax; + + if (mDefault < mMin) + mDefault = mMin; + else if (mDefault > mMax) + mDefault = mMax; } int IntTextField::getValue() @@ -66,18 +76,28 @@ int IntTextField::getValue() void IntTextField::setValue(int i) { - if (i >= mMin && i <= mMax) - mValue = i; - else if (i < mMin) + if (i < mMin) mValue = mMin; else if (i > mMax) mValue = mMax; + else + mValue = i; const std::string valStr = toString(mValue); setText(valStr); setCaretPosition(valStr.length() + 1); } +void IntTextField::setDefaultValue(int value) +{ + if (value < mMin) + mDefault = mMin; + else if (value > mMax) + mDefault = mMax; + else + mDefault = value; +} + void IntTextField::reset() { setValue(mDefault); diff --git a/src/gui/inttextfield.h b/src/gui/inttextfield.h index f2e294ca..ec768bea 100644 --- a/src/gui/inttextfield.h +++ b/src/gui/inttextfield.h @@ -1,8 +1,8 @@ /* - * Aethyra - * Copyright (C) 2008 Douglas Boffey <dougaboffey@netscape.net> + * The Mana World + * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -56,6 +56,11 @@ class IntTextField : public TextField void setValue(int value); /** + * Set the default value of the text box to the specified value. + */ + void setDefaultValue(int value); + + /** * Responds to key presses. */ void keyPressed(gcn::KeyEvent &event); diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 226b3178..e5450748 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -40,6 +39,7 @@ #include "../inventory.h" #include "../item.h" #include "../localplayer.h" +#include "../units.h" #include "../resources/iteminfo.h" @@ -52,7 +52,7 @@ InventoryWindow::InventoryWindow(int invSize): mMaxSlots(invSize), mItemDesc(false) { - setWindowName(_("Inventory")); + setWindowName("Inventory"); setResizable(true); setCloseButton(true); @@ -78,8 +78,8 @@ InventoryWindow::InventoryWindow(int invSize): mInvenScroll = new ScrollArea(mItems); mInvenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); - mTotalWeight = toString(player_node->mTotalWeight); - mMaxWeight = toString(player_node->mMaxWeight); + mTotalWeight = -1; + mMaxWeight = -1; mUsedSlots = toString(player_node->getInventory()->getNumberOfSlotsUsed()); mSlotsLabel = new gcn::Label(_("Slots: ")); @@ -100,7 +100,7 @@ InventoryWindow::InventoryWindow(int invSize): place(6, 5, mUseButton); Layout &layout = getLayout(); - layout.setRowHeight(0, mDropButton->getHeight()); + layout.setRowHeight(0, mDropButton->getHeight()); loadWindowState(); setLocationRelativeTo(getParent()); @@ -122,12 +122,12 @@ void InventoryWindow::logic() // redesign of InventoryWindow and ItemContainer probably. updateButtons(); - if ((mMaxWeight != toString(player_node->mMaxWeight)) || - mTotalWeight != toString(player_node->mTotalWeight) || + if (mMaxWeight != player_node->mMaxWeight || + mTotalWeight != player_node->mTotalWeight || mUsedSlots != toString(player_node->getInventory()->getNumberOfSlotsUsed())) { - mTotalWeight = toString(player_node->mTotalWeight); - mMaxWeight = toString(player_node->mMaxWeight); + mTotalWeight = player_node->mTotalWeight; + mMaxWeight = player_node->mMaxWeight; mUsedSlots = toString(player_node->getInventory()->getNumberOfSlotsUsed()); // Weight Bar coloration @@ -152,8 +152,9 @@ void InventoryWindow::logic() player_node->mMaxWeight); mSlotsBar->setText(strprintf("%s/%d", mUsedSlots.c_str(), mMaxSlots)); - mWeightBar->setText(strprintf("%sg/%sg", mTotalWeight.c_str(), - mMaxWeight.c_str())); + mWeightBar->setText(strprintf("%s/%s", + Units::formatWeight(mTotalWeight).c_str(), + Units::formatWeight(mMaxWeight).c_str())); } } diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index 83e98687..e1196f78 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,13 +22,13 @@ #ifndef INVENTORYWINDOW_H #define INVENTORYWINDOW_H -#include <guichan/actionlistener.hpp> -#include <guichan/selectionlistener.hpp> - #include "window.h" #include "../inventory.h" +#include <guichan/actionlistener.hpp> +#include <guichan/selectionlistener.hpp> + class Item; class ItemContainer; class ProgressBar; @@ -79,8 +78,7 @@ class InventoryWindow : public Window, gcn::ActionListener, std::string mWeight; std::string mSlots; std::string mUsedSlots; - std::string mTotalWeight; - std::string mMaxWeight; + Uint32 mTotalWeight, mMaxWeight; gcn::Button *mUseButton, *mDropButton; gcn::ScrollArea *mInvenScroll; diff --git a/src/gui/item_amount.cpp b/src/gui/item_amount.cpp index 8ab36df0..92be3d6e 100644 --- a/src/gui/item_amount.cpp +++ b/src/gui/item_amount.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/item_amount.h b/src/gui/item_amount.h index 6bec86b3..618d7d51 100644 --- a/src/gui/item_amount.h +++ b/src/gui/item_amount.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index 02d6e66d..8285a491 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -50,7 +49,7 @@ ItemContainer::ItemContainer(Inventory *inventory, int offset): mLastSelectedItemId(NO_ITEM), mOffset(offset) { - mItemPopup = new ItemPopup(); + mItemPopup = new ItemPopup; ResourceManager *resman = ResourceManager::getInstance(); @@ -123,7 +122,7 @@ void ItemContainer::draw(gcn::Graphics *graphics) // Draw item caption graphics->setFont(getFont()); - graphics->setColor(0x000000); + graphics->setColor(gcn::Color(0, 0, 0)); graphics->drawText( (item->isEquipped() ? "Eq." : toString(item->getQuantity())), itemX + gridWidth / 2, itemY + gridHeight - 11, @@ -169,7 +168,6 @@ void ItemContainer::refindSelectedItem() { if (mSelectedItemIndex != NO_ITEM) { - if (mInventory->getItem(mSelectedItemIndex) && mInventory->getItem(mSelectedItemIndex)->getId() == mLastSelectedItemId) return; // we're already fine @@ -202,6 +200,7 @@ void ItemContainer::setSelectedItemIndex(int index) newSelectedItemIndex = NO_ITEM; else newSelectedItemIndex = index; + if (mSelectedItemIndex != newSelectedItemIndex) { mSelectedItemIndex = newSelectedItemIndex; @@ -271,7 +270,7 @@ void ItemContainer::mouseExited(gcn::MouseEvent &event) mItemPopup->setVisible(false); } -int ItemContainer::getSlotIndex(const int posX, const int posY) const +int ItemContainer::getSlotIndex(int posX, int posY) const { int columns = getWidth() / gridWidth; int index = posX / gridWidth + ((posY / gridHeight) * columns) + mOffset; diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h index fba4656f..5ad140be 100644 --- a/src/gui/itemcontainer.h +++ b/src/gui/itemcontainer.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -119,17 +118,17 @@ class ItemContainer : public gcn::Widget, /** * Find the current item index by the most recently used item ID */ - void refindSelectedItem(void); + void refindSelectedItem(); /** * Determine and set the height of the container. */ - void recalculateHeight(void); + void recalculateHeight(); /** * Sends out selection events to the list of selection listeners. */ - void distributeValueChangedEvent(void); + void distributeValueChangedEvent(); /** * Gets the slot index based on the cursor position. @@ -138,7 +137,7 @@ class ItemContainer : public gcn::Widget, * @param posY The Y Coordinate position. * @return The slot index on success, -1 on failure. */ - int getSlotIndex(const int posX, const int posY) const; + int getSlotIndex(int posX, int posY) const; Inventory *mInventory; Image *mSelImg; diff --git a/src/gui/itemlinkhandler.cpp b/src/gui/itemlinkhandler.cpp index 06263ce2..bd8985dc 100644 --- a/src/gui/itemlinkhandler.cpp +++ b/src/gui/itemlinkhandler.cpp @@ -1,22 +1,21 @@ /* - * Aethyra - * Copyright 2009 The Mana World Development Team + * The Mana World + * Copyright (C) 2009 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * - * The Mana World is free software; you can redistribute it and/or modify + * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version. * - * The Mana World is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with The Mana World; if not, write to the Free Software + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ diff --git a/src/gui/itemlinkhandler.h b/src/gui/itemlinkhandler.h index e4c3ea4a..c04afa9e 100644 --- a/src/gui/itemlinkhandler.h +++ b/src/gui/itemlinkhandler.h @@ -1,27 +1,26 @@ /* - * Aethyra - * Copyright 2009 The Mana World Development Team + * The Mana World + * Copyright (C) 2009 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * - * The Mana World is free software; you can redistribute it and/or modify + * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version. * - * The Mana World is distributed in the hope that it will be useful, + * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with The Mana World; if not, write to the Free Software + * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef ITEM_LINK_HANDLER_H_ -#define ITEM_LINK_HANDLER_H_ +#ifndef ITEM_LINK_HANDLER_H +#define ITEM_LINK_HANDLER_H #include "linkhandler.h" diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index 0f7e2d11..0e0dd9e6 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -1,10 +1,9 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2008 The Legend of Mazzeroth Development Team * Copyright (C) 2008 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Legend of Mazzeroth. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,6 +32,8 @@ #include "widgets/layout.h" +#include "../units.h" + #include "../resources/iteminfo.h" #include "../utils/gettext.h" @@ -51,7 +52,7 @@ ItemPopup::ItemPopup(): mItemName->setPosition(2, 2); // Item Description - mItemDesc = new TextBox(); + mItemDesc = new TextBox; mItemDesc->setEditable(false); mItemDescScroll = new ScrollArea(mItemDesc); @@ -62,7 +63,7 @@ ItemPopup::ItemPopup(): mItemDescScroll->setPosition(2, getFont()->getHeight()); // Item Effect - mItemEffect = new TextBox(); + mItemEffect = new TextBox; mItemEffect->setEditable(false); mItemEffectScroll = new ScrollArea(mItemEffect); @@ -73,7 +74,7 @@ ItemPopup::ItemPopup(): mItemEffectScroll->setPosition(2, (2 * getFont()->getHeight()) + 5); // Item Weight - mItemWeight = new TextBox(); + mItemWeight = new TextBox; mItemWeight->setEditable(false); mItemWeightScroll = new ScrollArea(mItemWeight); @@ -112,8 +113,8 @@ void ItemPopup::setItem(const ItemInfo &item) mItemName->setWidth(boldFont->getWidth(item.getName())); mItemDesc->setTextWrapped(item.getDescription(), 196); mItemEffect->setTextWrapped(item.getEffect(), 196); - mItemWeight->setTextWrapped(_("Weight: ") + toString(item.getWeight()) + - _(" grams"), 196); + mItemWeight->setTextWrapped(_("Weight: ") + + Units::formatWeight(item.getWeight()), 196); int minWidth = mItemName->getWidth(); @@ -209,9 +210,9 @@ unsigned int ItemPopup::getNumRows() void ItemPopup::view(int x, int y) { if (windowContainer->getWidth() < (x + getWidth() + 5)) - x = windowContainer->getWidth() - getWidth(); + x = windowContainer->getWidth() - getWidth(); if ((y - getHeight() - 10) < 0) - y = 0; + y = 0; else y = y - getHeight() - 10; setPosition(x, y); diff --git a/src/gui/itempopup.h b/src/gui/itempopup.h index a91d8c6f..c820e3a0 100644 --- a/src/gui/itempopup.h +++ b/src/gui/itempopup.h @@ -1,10 +1,9 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2008 The Legend of Mazzeroth Development Team * Copyright (C) 2008 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Legend of Mazzeroth. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/itemshortcutcontainer.cpp b/src/gui/itemshortcutcontainer.cpp index e7a9afbe..603e7e50 100644 --- a/src/gui/itemshortcutcontainer.cpp +++ b/src/gui/itemshortcutcontainer.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2007 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -45,7 +44,7 @@ ItemShortcutContainer::ItemShortcutContainer(): addMouseListener(this); addWidgetListener(this); - mItemPopup = new ItemPopup(); + mItemPopup = new ItemPopup; ResourceManager *resman = ResourceManager::getInstance(); @@ -93,6 +92,7 @@ void ItemShortcutContainer::draw(gcn::Graphics *graphics) Graphics *g = static_cast<Graphics*>(graphics); + graphics->setColor(gcn::Color(0, 0, 0)); graphics->setFont(getFont()); for (int i = 0; i < mMaxItems; i++) diff --git a/src/gui/itemshortcutcontainer.h b/src/gui/itemshortcutcontainer.h index f6137af0..22d94ec2 100644 --- a/src/gui/itemshortcutcontainer.h +++ b/src/gui/itemshortcutcontainer.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2007 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/linkhandler.h b/src/gui/linkhandler.h index ea1b25c8..ecc05b13 100644 --- a/src/gui/linkhandler.h +++ b/src/gui/linkhandler.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp index 6d5c0ca8..2f7d2f7f 100644 --- a/src/gui/listbox.cpp +++ b/src/gui/listbox.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/listbox.h b/src/gui/listbox.h index 09f00cdf..cfb58f15 100644 --- a/src/gui/listbox.h +++ b/src/gui/listbox.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/login.cpp b/src/gui/login.cpp index cd331322..e91f7616 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -55,17 +54,13 @@ LoginDialog::LoginDialog(LoginData *loginData): gcn::Label *portLabel = new gcn::Label(_("Port:")); gcn::Label *dropdownLabel = new gcn::Label(_("Recent:")); std::vector<std::string> dfltServer; - dfltServer.push_back("www.aethyra.org"); - dfltServer.push_back("www.aethyra.org"); - dfltServer.push_back("209.168.213.109"); + dfltServer.push_back("server.themanaworld.org"); std::vector<std::string> dfltPort; - dfltPort.push_back("21001"); - dfltPort.push_back("22001"); - dfltPort.push_back("21001"); + dfltPort.push_back("6901"); mServerList = new DropDownList("MostRecent00", dfltServer, dfltPort, MAX_SERVER_LIST_SIZE); mServerListBox = new ListBox(mServerList); - mServerScrollArea = new ScrollArea(); + mServerScrollArea = new ScrollArea; mUserField = new TextField(mLoginData->username); mPassField = new PasswordField(mLoginData->password); @@ -76,7 +71,7 @@ LoginDialog::LoginDialog(LoginData *loginData): mServerListBox); mServerDropDown->setOpaque(false); - mKeepCheck = new CheckBox(_("Keep"), mLoginData->remember); + mKeepCheck = new CheckBox(_("Remember Username"), mLoginData->remember); mOkButton = new Button(_("OK"), "ok", this); mCancelButton = new Button(_("Cancel"), "cancel", this); mRegisterButton = new Button(_("Register"), "register", this); @@ -84,6 +79,7 @@ LoginDialog::LoginDialog(LoginData *loginData): mUserField->setActionEventId("ok"); mPassField->setActionEventId("ok"); mServerField->setActionEventId("ok"); + mPortField->setActionEventId("ok"); mServerDropDown->setActionEventId("changeSelection"); mUserField->addKeyListener(this); @@ -294,7 +290,7 @@ std::string LoginDialog::DropDownList::getElementAt(int i) { if (i < 0 || i >= getNumberOfElements()) { - return ""; + return ""; } return getServerAt(i) + ":" + getPortAt(i); } diff --git a/src/gui/login.h b/src/gui/login.h index 4d63ec63..1f0f2ddb 100644 --- a/src/gui/login.h +++ b/src/gui/login.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/menuwindow.cpp b/src/gui/menuwindow.cpp index 8a695865..97553586 100644 --- a/src/gui/menuwindow.cpp +++ b/src/gui/menuwindow.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/menuwindow.h b/src/gui/menuwindow.h index f70a332e..9bb54e29 100644 --- a/src/gui/menuwindow.h +++ b/src/gui/menuwindow.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 2a97b949..57fd7457 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004-2005 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -41,7 +40,7 @@ Minimap::Minimap(): mMapImage(NULL), mProportion(0.5) { - setWindowName(_("MiniMap")); + setWindowName("MiniMap"); mShow = config.getValue(getWindowName() + "Show", true); setDefaultSize(5, 25, 100, 100); setResizable(true); diff --git a/src/gui/minimap.h b/src/gui/minimap.h index 6e88f821..3ce0aacd 100644 --- a/src/gui/minimap.h +++ b/src/gui/minimap.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004-2005 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp index 6537b48e..9a3d27cc 100644 --- a/src/gui/ministatus.cpp +++ b/src/gui/ministatus.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,7 +22,9 @@ #include "gui.h" #include "ministatus.h" #include "progressbar.h" +#include "status.h" +#include "../animatedsprite.h" #include "../configuration.h" #include "../graphics.h" #include "../localplayer.h" @@ -56,38 +57,29 @@ MiniStatusWindow::MiniStatusWindow(): loadWindowState(); } -void MiniStatusWindow::update() +void MiniStatusWindow::setIcon(int index, AnimatedSprite *sprite) { - // HP Bar coloration - if (player_node->mHp < int(player_node->mMaxHp / 3)) - { - mHpBar->setColor(223, 32, 32); // Red - } - else if (player_node->mHp < int((player_node->mMaxHp / 3) * 2)) - { - mHpBar->setColor(230, 171, 34); // Orange - } - else - { - mHpBar->setColor(0, 171, 34); // Green - } + if (index >= (int) mIcons.size()) + mIcons.resize(index + 1, NULL); - float xp = (float) player_node->getXp() / player_node->mXpForNextLevel; + if (mIcons[index]) + delete mIcons[index]; - if (xp != xp) xp = 0.0f; // check for NaN - if (xp < 0.0f) xp = 0.0f; // make sure the experience isn't negative (uninitialized pointer most likely) - if (xp > 1.0f) xp = 1.0f; + mIcons[index] = sprite; +} - mHpBar->setProgress((float) player_node->mHp / player_node->mMaxHp); - mMpBar->setProgress((float) player_node->mMp / player_node->mMaxMp); - mXpBar->setProgress(xp); +void MiniStatusWindow::eraseIcon(int index) +{ + mIcons.erase(mIcons.begin() + index); +} - // Update labels - mHpBar->setText(toString(player_node->mHp)); - mMpBar->setText(toString(player_node->mMp)); +extern volatile int tick_time; - std::stringstream updatedText; - updatedText << (float) ((int) (xp * 10000.0f)) / 100.0f << "%"; +void MiniStatusWindow::update() +{ + StatusWindow::updateHPBar(mHpBar); + StatusWindow::updateMPBar(mMpBar); + StatusWindow::updateXPBar(mXpBar); // Displays the number of monsters to next lvl // (disabled for now but interesting idea) @@ -102,7 +94,10 @@ void MiniStatusWindow::update() } */ - mXpBar->setText(updatedText.str()); + for (unsigned int i = 0; i < mIcons.size(); i++) + if (mIcons[i]) + mIcons[i]->update(tick_time * 10); + } void MiniStatusWindow::draw(gcn::Graphics *graphics) @@ -110,3 +105,15 @@ void MiniStatusWindow::draw(gcn::Graphics *graphics) update(); drawChildren(graphics); } + +void MiniStatusWindow::drawIcons(Graphics *graphics) +{ + // Draw icons + int icon_x = mXpBar->getX() + mXpBar->getWidth() + 4; + for (unsigned int i = 0; i < mIcons.size(); i++) { + if (mIcons[i]) { + mIcons[i]->draw(graphics, icon_x, 3); + icon_x += 2 + mIcons[i]->getWidth(); + } + } +} diff --git a/src/gui/ministatus.h b/src/gui/ministatus.h index 33ee548d..f262a2a0 100644 --- a/src/gui/ministatus.h +++ b/src/gui/ministatus.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,6 +24,9 @@ #include "window.h" +#include <vector> + +class AnimatedSprite; class ProgressBar; /** @@ -45,6 +47,15 @@ class MiniStatusWindow : public Window */ void draw(gcn::Graphics *graphics); + /** + * Sets one of the icons. + */ + void setIcon(int index, AnimatedSprite *sprite); + + void eraseIcon(int index); + + void drawIcons(Graphics *graphics); + private: /** * Updates this dialog with values from player_node. @@ -57,6 +68,8 @@ class MiniStatusWindow : public Window ProgressBar *mHpBar; ProgressBar *mMpBar; ProgressBar *mXpBar; + + std::vector<AnimatedSprite *> mIcons; }; #endif diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp index b94e8aa4..954f22d8 100644 --- a/src/gui/npc_text.cpp +++ b/src/gui/npc_text.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -35,7 +34,8 @@ #include "../utils/gettext.h" NpcTextDialog::NpcTextDialog(Network *network): - Window(_("NPC")), mNetwork(network) + Window(_("NPC")), mNetwork(network), + mState(NPC_TEXT_STATE_WAITING) { setResizable(true); @@ -49,8 +49,7 @@ NpcTextDialog::NpcTextDialog(Network *network): mTextBox->setOpaque(false); mScrollArea = new ScrollArea(mTextBox); - mButton = new Button(_("OK"), "", this); - mButton->setActionEventId("ok"); + mButton = new Button(_("Waiting for server"), "ok", this); mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mScrollArea->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS); @@ -65,6 +64,12 @@ NpcTextDialog::NpcTextDialog(Network *network): setLocationRelativeTo(getParent()); } +void NpcTextDialog::clearText() +{ + NPC::isTalking = false; + setText(""); +} + void NpcTextDialog::setText(const std::string &text) { mText = text; @@ -74,26 +79,44 @@ void NpcTextDialog::setText(const std::string &text) void NpcTextDialog::addText(const std::string &text) { setText(mText + text + "\n"); + mScrollArea->setVerticalScrollAmount(mScrollArea->getVerticalMaxScroll()); } -void NpcTextDialog::clearText() +void NpcTextDialog::showNextButton() { - NPC::mTalking = false; - setText(""); + mButton->setCaption(_("Next")); + mState = NPC_TEXT_STATE_NEXT; + mButton->setEnabled(true); +} + +void NpcTextDialog::showCloseButton() +{ + mButton->setCaption(_("Close")); + mState = NPC_TEXT_STATE_CLOSE; + mButton->setEnabled(true); } void NpcTextDialog::action(const gcn::ActionEvent &event) { if (event.getId() == "ok") { - clearText(); - setVisible(false); - - if (current_npc) + if (mState == NPC_TEXT_STATE_NEXT && current_npc) { nextDialog(); - - current_npc = 0; + addText("\n> Next\n"); + } else if (mState == NPC_TEXT_STATE_CLOSE || + (mState == NPC_TEXT_STATE_NEXT && !current_npc)) { + setText(""); + if (current_npc) nextDialog(); + setVisible(false); + current_npc = 0; + NPC::isTalking = false; + } else return; } + else return; + + mButton->setEnabled(false); + mButton->setCaption(_("Waiting for server")); + mState = NPC_TEXT_STATE_WAITING; } void NpcTextDialog::nextDialog(int npcID) @@ -109,4 +132,3 @@ void NpcTextDialog::widgetResized(const gcn::Event &event) setText(mText); } - diff --git a/src/gui/npc_text.h b/src/gui/npc_text.h index a72de5d0..019c22a5 100644 --- a/src/gui/npc_text.h +++ b/src/gui/npc_text.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -74,6 +73,10 @@ class NpcTextDialog : public Window, public gcn::ActionListener */ void addText(const std::string &string); + void showNextButton(); + + void showCloseButton(); + void nextDialog(int npcID = current_npc); /** @@ -90,6 +93,13 @@ class NpcTextDialog : public Window, public gcn::ActionListener gcn::Button *mButton; std::string mText; + + enum NPCTextState { + NPC_TEXT_STATE_WAITING, + NPC_TEXT_STATE_NEXT, + NPC_TEXT_STATE_CLOSE + }; + NPCTextState mState; }; extern NpcTextDialog *npcTextDialog; diff --git a/src/gui/npcintegerdialog.cpp b/src/gui/npcintegerdialog.cpp index 132a7608..9778d790 100644 --- a/src/gui/npcintegerdialog.cpp +++ b/src/gui/npcintegerdialog.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +21,7 @@ #include "button.h" #include "inttextfield.h" +#include "npc_text.h" #include "npcintegerdialog.h" #include "widgets/layout.h" @@ -32,17 +32,20 @@ #include "../net/protocol.h" #include "../utils/gettext.h" +#include "../utils/strprintf.h" + +extern NpcTextDialog *npcTextDialog; NpcIntegerDialog::NpcIntegerDialog(Network *network): Window(_("NPC Number Request")), mNetwork(network) { - mValueField = new IntTextField(); + mValueField = new IntTextField; mDecButton = new Button("-", "decvalue", this); mIncButton = new Button("+", "incvalue", this); - okButton = new Button(_("OK"), "ok", this); - cancelButton = new Button(_("Cancel"), "cancel", this); - resetButton = new Button(_("Reset"), "reset", this); + gcn::Button *okButton = new Button(_("OK"), "ok", this); + gcn::Button *cancelButton = new Button(_("Cancel"), "cancel", this); + gcn::Button *resetButton = new Button(_("Reset"), "reset", this); mDecButton->setSize(20, 20); mIncButton->setSize(20, 20); @@ -63,7 +66,7 @@ NpcIntegerDialog::NpcIntegerDialog(Network *network): setLocationRelativeTo(getParent()); } -void NpcIntegerDialog::setRange(const int min, const int max) +void NpcIntegerDialog::setRange(int min, int max) { mValueField->setRange(min, max); } @@ -85,11 +88,13 @@ void NpcIntegerDialog::action(const gcn::ActionEvent &event) if (event.getId() == "ok") { finish = true; + npcTextDialog->addText(strprintf("\n> %d\n", mValueField->getValue())); } else if (event.getId() == "cancel") { finish = true; mValueField->reset(); + npcTextDialog->addText(_("\n> Cancel\n")); } else if (event.getId() == "decvalue") { @@ -107,18 +112,22 @@ void NpcIntegerDialog::action(const gcn::ActionEvent &event) if (finish) { setVisible(false); - NPC::mTalking = false; + NPC::isTalking = false; MessageOut outMsg(mNetwork); outMsg.writeInt16(CMSG_NPC_INT_RESPONSE); outMsg.writeInt32(current_npc); outMsg.writeInt32(mValueField->getValue()); - current_npc = 0; mValueField->reset(); } } +void NpcIntegerDialog::setDefaultValue(int value) +{ + mValueField->setDefaultValue(value); +} + bool NpcIntegerDialog::isInputFocused() { return mValueField->isFocused(); @@ -128,3 +137,10 @@ void NpcIntegerDialog::requestFocus() { mValueField->requestFocus(); } + +void NpcIntegerDialog::setVisible(bool visible) +{ + if (visible) npcTextDialog->setVisible(true); + + Window::setVisible(visible); +} diff --git a/src/gui/npcintegerdialog.h b/src/gui/npcintegerdialog.h index 15bdee48..58f6970b 100644 --- a/src/gui/npcintegerdialog.h +++ b/src/gui/npcintegerdialog.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -66,7 +65,14 @@ class NpcIntegerDialog : public Window, public gcn::ActionListener * @param min The minimum value to allow * @param max The maximum value to allow */ - void setRange(const int min, const int max); + void setRange(int min, int max); + + /** + * Sets the default value. + * + * @param value The new default value + */ + void setDefaultValue(int value); /** * Checks whether NpcStringDialog is Focused or not. @@ -78,14 +84,13 @@ class NpcIntegerDialog : public Window, public gcn::ActionListener */ void requestFocus(); + void setVisible(bool visible); + private: Network *mNetwork; gcn::Button *mDecButton; gcn::Button *mIncButton; IntTextField *mValueField; - gcn::Button *okButton; - gcn::Button *cancelButton; - gcn::Button *resetButton; }; extern NpcIntegerDialog *npcIntegerDialog; diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp index 73b00239..f5479efc 100644 --- a/src/gui/npclistdialog.cpp +++ b/src/gui/npclistdialog.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,6 +23,7 @@ #include "button.h" #include "listbox.h" +#include "npc_text.h" #include "npclistdialog.h" #include "scrollarea.h" @@ -35,6 +35,9 @@ #include "../net/protocol.h" #include "../utils/gettext.h" +#include "../utils/strprintf.h" + +extern NpcTextDialog *npcTextDialog; NpcListDialog::NpcListDialog(Network *network): Window(_("NPC")), mNetwork(network) @@ -49,10 +52,10 @@ NpcListDialog::NpcListDialog(Network *network): mItemList = new ListBox(this); mItemList->setWrappingEnabled(true); - scrollArea = new ScrollArea(mItemList); + gcn::ScrollArea *scrollArea = new ScrollArea(mItemList); - okButton = new Button(_("OK"), "ok", this); - cancelButton = new Button(_("Cancel"), "cancel", this); + gcn::Button *okButton = new Button(_("OK"), "ok", this); + gcn::Button *cancelButton = new Button(_("Cancel"), "cancel", this); setContentSize(260, 175); scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); @@ -89,7 +92,7 @@ void NpcListDialog::parseItems(const std::string &itemString) void NpcListDialog::reset() { - NPC::mTalking = false; + NPC::isTalking = false; mItemList->setSelected(-1); mItems.clear(); } @@ -97,18 +100,23 @@ void NpcListDialog::reset() void NpcListDialog::action(const gcn::ActionEvent &event) { int choice = 0; - if (event.getId() == "ok") { // Send the selected index back to the server int selectedIndex = mItemList->getSelected(); if (selectedIndex > -1) + { choice = selectedIndex + 1; + npcTextDialog->addText(strprintf("\n> \"%s\"\n", + mItems[selectedIndex].c_str())); + } } else if (event.getId() == "cancel") { choice = 0xff; // 0xff means cancel + npcTextDialog->addText(_("\n> Cancel\n")); + npcTextDialog->showCloseButton(); } if (choice) @@ -120,11 +128,16 @@ void NpcListDialog::action(const gcn::ActionEvent &event) outMsg.writeInt16(CMSG_NPC_LIST_CHOICE); outMsg.writeInt32(current_npc); outMsg.writeInt8(choice); - - current_npc = 0; } } +void NpcListDialog::setVisible(bool visible) +{ + if (visible) npcTextDialog->setVisible(true); + + Window::setVisible(visible); +} + void NpcListDialog::requestFocus() { mItemList->requestFocus(); diff --git a/src/gui/npclistdialog.h b/src/gui/npclistdialog.h index 0a0e9813..b5a62515 100644 --- a/src/gui/npclistdialog.h +++ b/src/gui/npclistdialog.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,12 +22,12 @@ #ifndef GUI_NPCLISTDIALOG_H #define GUI_NPCLISTDIALOG_H -#include <vector> +#include "window.h" #include <guichan/actionlistener.hpp> #include <guichan/listmodel.hpp> -#include "window.h" +#include <vector> class Network; @@ -75,6 +74,8 @@ class NpcListDialog : public Window, public gcn::ActionListener, */ void reset(); + void setVisible(bool visible); + /** * Requests the listbox to take focus for input. */ @@ -83,9 +84,6 @@ class NpcListDialog : public Window, public gcn::ActionListener, private: Network *mNetwork; gcn::ListBox *mItemList; - gcn::ScrollArea *scrollArea; - gcn::Button *okButton; - gcn::Button *cancelButton; std::vector<std::string> mItems; }; diff --git a/src/gui/npcstringdialog.cpp b/src/gui/npcstringdialog.cpp index f2c7434c..aec30826 100644 --- a/src/gui/npcstringdialog.cpp +++ b/src/gui/npcstringdialog.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,6 +20,7 @@ */ #include "button.h" +#include "npc_text.h" #include "npcstringdialog.h" #include "textfield.h" @@ -32,14 +32,17 @@ #include "../net/protocol.h" #include "../utils/gettext.h" +#include "../utils/strprintf.h" + +extern NpcTextDialog *npcTextDialog; NpcStringDialog::NpcStringDialog(Network *network): Window(_("NPC Text Request")), mNetwork(network) { mValueField = new TextField(""); - okButton = new Button(_("OK"), "ok", this); - cancelButton = new Button(_("Cancel"), "cancel", this); + gcn::Button *okButton = new Button(_("OK"), "ok", this); + gcn::Button *cancelButton = new Button(_("Cancel"), "cancel", this); place(0, 0, mValueField, 3); place(1, 1, cancelButton); @@ -57,17 +60,24 @@ std::string NpcStringDialog::getValue() void NpcStringDialog::setValue(const std::string &value) { mValueField->setText(value); + mDefault = value; } void NpcStringDialog::action(const gcn::ActionEvent &event) { if (event.getId() == "cancel") { - mValueField->setText(""); + mValueField->setText(mDefault); + npcTextDialog->addText(_("\n> Cancel\n")); + } + else + { + npcTextDialog->addText(strprintf("\n> \"%s\"\n", + mValueField->getText().c_str())); } setVisible(false); - NPC::mTalking = false; + NPC::isTalking = false; std::string text = mValueField->getText(); mValueField->setText(""); @@ -78,8 +88,6 @@ void NpcStringDialog::action(const gcn::ActionEvent &event) outMsg.writeInt32(current_npc); outMsg.writeString(text, text.length()); outMsg.writeInt8(0); - - current_npc = 0; } bool NpcStringDialog::isInputFocused() @@ -91,3 +99,10 @@ void NpcStringDialog::requestFocus() { mValueField->requestFocus(); } + +void NpcStringDialog::setVisible(bool visible) +{ + if (visible) npcTextDialog->setVisible(true); + + Window::setVisible(visible); +} diff --git a/src/gui/npcstringdialog.h b/src/gui/npcstringdialog.h index ee620daf..0c552baa 100644 --- a/src/gui/npcstringdialog.h +++ b/src/gui/npcstringdialog.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,9 +22,11 @@ #ifndef GUI_NPCSTRINGDIALOG_H #define GUI_NPCSTRINGDIALOG_H +#include "window.h" + #include <guichan/actionlistener.hpp> -#include "window.h" +class Network; class Network; @@ -71,11 +72,12 @@ class NpcStringDialog : public Window, public gcn::ActionListener */ void requestFocus(); + void setVisible(bool visible); + private: Network *mNetwork; gcn::TextField *mValueField; - gcn::Button *okButton; - gcn::Button *cancelButton; + std::string mDefault; }; extern NpcStringDialog *npcStringDialog; diff --git a/src/gui/ok_dialog.cpp b/src/gui/ok_dialog.cpp index 9621b389..d73c7d7c 100644 --- a/src/gui/ok_dialog.cpp +++ b/src/gui/ok_dialog.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,12 +33,12 @@ OkDialog::OkDialog(const std::string &title, const std::string &msg, Window *parent): Window(title, true, parent) { - mTextBox = new TextBox(); + mTextBox = new TextBox; mTextBox->setEditable(false); mTextBox->setOpaque(false); mTextArea = new ScrollArea(mTextBox); - okButton = new Button(_("Ok"), "ok", this); + gcn::Button *okButton = new Button(_("Ok"), "ok", this); mTextArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mTextArea->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); diff --git a/src/gui/ok_dialog.h b/src/gui/ok_dialog.h index c84cf4c4..24325c2f 100644 --- a/src/gui/ok_dialog.h +++ b/src/gui/ok_dialog.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,13 +19,13 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef _OK_DIALOG_H -#define _OK_DIALOG_H - -#include <guichan/actionlistener.hpp> +#ifndef OK_DIALOG_H +#define OK_DIALOG_H #include "window.h" +#include <guichan/actionlistener.hpp> + class ScrollArea; class TextBox; @@ -55,7 +54,6 @@ class OkDialog : public Window, public gcn::ActionListener { private: TextBox *mTextBox; ScrollArea *mTextArea; - gcn::Button *okButton; }; #endif diff --git a/src/gui/passwordfield.cpp b/src/gui/passwordfield.cpp index 073f5e36..345ee1c3 100644 --- a/src/gui/passwordfield.cpp +++ b/src/gui/passwordfield.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/passwordfield.h b/src/gui/passwordfield.h index adad54fe..42f8d187 100644 --- a/src/gui/passwordfield.h +++ b/src/gui/passwordfield.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp index 2a6cdb20..7223c453 100644 --- a/src/gui/playerbox.cpp +++ b/src/gui/playerbox.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/playerbox.h b/src/gui/playerbox.h index ee25520a..7c08defd 100644 --- a/src/gui/playerbox.h +++ b/src/gui/playerbox.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index cead20ed..4577baee 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -57,7 +56,7 @@ PopupMenu::PopupMenu(): setTitleBarHeight(0); setShowTitle(false); - mBrowserBox = new BrowserBox(); + mBrowserBox = new BrowserBox; mBrowserBox->setPosition(4, 4); mBrowserBox->setHighlightMode(BrowserBox::BACKGROUND); mBrowserBox->setOpaque(false); @@ -83,22 +82,22 @@ void PopupMenu::showPopup(int x, int y, Being *being) mBrowserBox->addRow("##3---"); switch (player_relations.getRelation(name)) { - case PlayerRelation::NEUTRAL: - mBrowserBox->addRow(strprintf(_("@@friend|Befriend %s@@"), name.c_str())); - - case PlayerRelation::FRIEND: - mBrowserBox->addRow(strprintf(_("@@disregard|Disregard %s@@"), name.c_str())); - mBrowserBox->addRow(strprintf(_("@@ignore|Ignore %s@@"), name.c_str())); - break; - - case PlayerRelation::DISREGARDED: - mBrowserBox->addRow(strprintf(_("@@unignore|Un-Ignore %s@@"), name.c_str())); - mBrowserBox->addRow(strprintf(_("@@ignore|Completely ignore %s@@"), name.c_str())); - break; - - case PlayerRelation::IGNORED: - mBrowserBox->addRow(strprintf(_("@@unignore|Un-Ignore %s@@"), name.c_str())); - break; + case PlayerRelation::NEUTRAL: + mBrowserBox->addRow(strprintf(_("@@friend|Befriend %s@@"), name.c_str())); + + case PlayerRelation::FRIEND: + mBrowserBox->addRow(strprintf(_("@@disregard|Disregard %s@@"), name.c_str())); + mBrowserBox->addRow(strprintf(_("@@ignore|Ignore %s@@"), name.c_str())); + break; + + case PlayerRelation::DISREGARDED: + mBrowserBox->addRow(strprintf(_("@@unignore|Un-Ignore %s@@"), name.c_str())); + mBrowserBox->addRow(strprintf(_("@@ignore|Completely ignore %s@@"), name.c_str())); + break; + + case PlayerRelation::IGNORED: + mBrowserBox->addRow(strprintf(_("@@unignore|Un-Ignore %s@@"), name.c_str())); + break; } //mBrowserBox->addRow(_("@@follow|Follow ") + name + "@@"); @@ -148,42 +147,55 @@ void PopupMenu::handleLink(const std::string& link) Being *being = beingManager->findBeing(mBeingId); // Talk To action - if (link == "talk" && being && being->getType() == Being::NPC && + if (link == "talk" && + being && + being->getType() == Being::NPC && current_npc == 0) { dynamic_cast<NPC*>(being)->talk(); } // Trade action - else if (link == "trade" && being && being->getType() == Being::PLAYER) + else if (link == "trade" && + being && + being->getType() == Being::PLAYER) { player_node->trade(being); tradePartnerName = being->getName(); } // Attack action - else if (link == "attack" && being && being->getType() == Being::PLAYER) + else if (link == "attack" && + being && + being->getType() == Being::PLAYER) { player_node->attack(being, true); } - else if (link == "unignore" && being && being->getType() == Being::PLAYER) + else if (link == "unignore" && + being && + being->getType() == Being::PLAYER) { player_relations.setRelation(being->getName(), PlayerRelation::NEUTRAL); } - else if (link == "ignore" && being && being->getType() == Being::PLAYER) + else if (link == "ignore" && + being && + being->getType() == Being::PLAYER) { player_relations.setRelation(being->getName(), PlayerRelation::IGNORED); } - else if (link == "disregard" && being && + else if (link == "disregard" && + being && being->getType() == Being::PLAYER) { player_relations.setRelation(being->getName(), PlayerRelation::DISREGARDED); } - else if (link == "friend" && being && being->getType() == Being::PLAYER) + else if (link == "friend" && + being && + being->getType() == Being::PLAYER) { player_relations.setRelation(being->getName(), PlayerRelation::FRIEND); } @@ -244,7 +256,8 @@ void PopupMenu::handleLink(const std::string& link) { new ItemAmountWindow(AMOUNT_ITEM_DROP, inventoryWindow, mItem); } - else if (link == "party-invite" && being && + else if (link == "party-invite" && + being && being->getType() == Being::PLAYER) { MessageOut outMsg(player_node->getNetwork()); diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h index 89152751..0a6877d9 100644 --- a/src/gui/popupmenu.h +++ b/src/gui/popupmenu.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp index bec86bb1..019bf371 100644 --- a/src/gui/progressbar.cpp +++ b/src/gui/progressbar.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -135,13 +134,13 @@ void ProgressBar::draw(gcn::Graphics *graphics) graphics->setFont(f); - graphics->setColor(gcn::Color(0, 0, 0, alpha)); + graphics->setColor(gcn::Color(0, 0, 0)); graphics->drawText(mText, textX + 1, textY, gcn::Graphics::CENTER); graphics->drawText(mText, textX, textY - 1, gcn::Graphics::CENTER); graphics->drawText(mText, textX, textY + 1, gcn::Graphics::CENTER); graphics->drawText(mText, textX - 1, textY, gcn::Graphics::CENTER); - graphics->setColor(gcn::Color(255, 255, 255, alpha)); + graphics->setColor(gcn::Color(255, 255, 255)); graphics->drawText(mText, textX, textY, gcn::Graphics::CENTER); graphics->setColor(gcn::Color(0, 0, 0)); diff --git a/src/gui/progressbar.h b/src/gui/progressbar.h index 3c88f3a3..5526589c 100644 --- a/src/gui/progressbar.h +++ b/src/gui/progressbar.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/radiobutton.cpp b/src/gui/radiobutton.cpp index c839238b..52ceb837 100644 --- a/src/gui/radiobutton.cpp +++ b/src/gui/radiobutton.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/radiobutton.h b/src/gui/radiobutton.h index cd501126..3d952b3f 100644 --- a/src/gui/radiobutton.h +++ b/src/gui/radiobutton.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/recorder.cpp b/src/gui/recorder.cpp index ff8825ef..ce097db2 100644 --- a/src/gui/recorder.cpp +++ b/src/gui/recorder.cpp @@ -2,7 +2,7 @@ * A chat recorder * Copyright (C) 2008 Lloyd Bryant <lloyd_bryant@netzero.net> * - * This file is part of Aethyra. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -34,7 +34,7 @@ Recorder::Recorder(ChatWindow *chat, const std::string &title, const std::string &buttonTxt) : Window(title) { - setWindowName(_("Recorder")); + setWindowName("Recorder"); const int offsetX = 2 * getPadding() + 10; const int offsetY = getTitleBarHeight() + getPadding() + 10; @@ -98,7 +98,8 @@ void Recorder::changeRecordingStatus(const std::string &msg) * recorded. */ mChat->chatLog(_("Starting to record..."), BY_SERVER); - std::string file = std::string(PHYSFS_getUserDir()) + "/.aethyra/" + msgCopy; + const std::string file = + std::string(PHYSFS_getUserDir()) + "/.tmw/" + msgCopy; mStream.open(file.c_str(), std::ios_base::trunc); diff --git a/src/gui/recorder.h b/src/gui/recorder.h index 4f41ff42..0bbab012 100644 --- a/src/gui/recorder.h +++ b/src/gui/recorder.h @@ -2,7 +2,7 @@ * A chat recorder * Copyright (C) 2008 Lloyd Bryant <lloyd_bryant@netzero.net> * - * This file is part of Aethyra. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/register.cpp b/src/gui/register.cpp index 13928e41..c2190501 100644 --- a/src/gui/register.cpp +++ b/src/gui/register.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/register.h b/src/gui/register.h index 922320db..9588e07e 100644 --- a/src/gui/register.h +++ b/src/gui/register.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp index 43b27f23..44ef929b 100644 --- a/src/gui/scrollarea.cpp +++ b/src/gui/scrollarea.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,18 +35,16 @@ ImageRect ScrollArea::background; ImageRect ScrollArea::vMarker; Image *ScrollArea::buttons[4][2]; -ScrollArea::ScrollArea(bool gc, bool opaque): +ScrollArea::ScrollArea(): gcn::ScrollArea(), - mOpaque(opaque), - mGC(gc) + mOpaque(true) { init(); } -ScrollArea::ScrollArea(gcn::Widget *widget, bool gc, bool opaque): +ScrollArea::ScrollArea(gcn::Widget *widget): gcn::ScrollArea(widget), - mOpaque(opaque), - mGC(gc) + mOpaque(true) { init(); } @@ -55,8 +52,7 @@ ScrollArea::ScrollArea(gcn::Widget *widget, bool gc, bool opaque): ScrollArea::~ScrollArea() { // Garbage collection - if (mGC) - delete getContent(); + delete getContent(); instances--; diff --git a/src/gui/scrollarea.h b/src/gui/scrollarea.h index 080b851c..e9aa5ed2 100644 --- a/src/gui/scrollarea.h +++ b/src/gui/scrollarea.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,6 +30,10 @@ class ImageRect; /** * A scroll area. * + * Contrary to Guichan's scroll area, this scroll area takes ownership over its + * content. However, it won't delete a previously set content widget when + * setContent is called! + * * \ingroup GUI */ class ScrollArea : public gcn::ScrollArea @@ -39,12 +42,12 @@ class ScrollArea : public gcn::ScrollArea /** * Constructor. */ - ScrollArea(bool gc = true, bool opaque = true); + ScrollArea(); /** * Constructor. */ - ScrollArea(gcn::Widget *content, bool gc = true, bool opaque = true); + ScrollArea(gcn::Widget *content); /** * Destructor. @@ -107,7 +110,6 @@ class ScrollArea : public gcn::ScrollArea static Image *buttons[4][2]; bool mOpaque; - bool mGC; }; #endif diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index 154d1a57..1aa0e2d3 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,6 +31,7 @@ #include "widgets/layout.h" #include "../npc.h" +#include "../units.h" #include "../net/messageout.h" #include "../net/protocol.h" @@ -57,8 +57,8 @@ SellDialog::SellDialog(Network *network): mScrollArea = new ScrollArea(mShopItemList); mSlider = new Slider(1.0); mQuantityLabel = new gcn::Label("0"); - mMoneyLabel = new gcn::Label( - strprintf(_("Price: %d GP / Total: %d GP"), 0, 0)); + mMoneyLabel = new gcn::Label(strprintf(_("Price: %s / Total: %s"), + "", "")); mIncreaseButton = new Button("+", "+", this); mDecreaseButton = new Button("-", "-", this); mSellButton = new Button(_("Sell"), "sell", this); @@ -263,7 +263,14 @@ void SellDialog::updateButtonsAndLabels() // Update the quantity and money labels mQuantityLabel->setCaption(strprintf("%d / %d", mAmountItems, mMaxItems)); - mMoneyLabel->setCaption - (strprintf(_("Price: %d GP / Total: %d GP"), - income, mPlayerMoney + income)); + mMoneyLabel->setCaption(strprintf(_("Price: %s / Total: %s"), + Units::formatCurrency(income).c_str(), + Units::formatCurrency(mPlayerMoney + income).c_str())); +} + +void SellDialog::logic() +{ + Window::logic(); + + if (!current_npc) setVisible(false); } diff --git a/src/gui/sell.h b/src/gui/sell.h index 3776477f..3777b91e 100644 --- a/src/gui/sell.h +++ b/src/gui/sell.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -82,6 +81,11 @@ class SellDialog : public Window, gcn::ActionListener, gcn::SelectionListener */ void setMoney(int amount); + /** + * Check for current NPC + */ + void logic(); + private: /** * Updates the state of buttons and labels. diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index 4798f598..148e8b75 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -70,7 +69,7 @@ Setup::Setup(): btn->setEnabled(statusWindow != NULL); } - TabbedArea *panel = new TabbedArea(); + TabbedArea *panel = new TabbedArea; panel->setDimension(gcn::Rectangle(5, 5, width - 10, height - 40)); SetupTab *tab; diff --git a/src/gui/setup.h b/src/gui/setup.h index 9f1bafc7..e4eb0902 100644 --- a/src/gui/setup.h +++ b/src/gui/setup.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp index 3c26f14b..a4bc05ae 100644 --- a/src/gui/setup_audio.cpp +++ b/src/gui/setup_audio.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/setup_audio.h b/src/gui/setup_audio.h index aad16617..9e951895 100644 --- a/src/gui/setup_audio.h +++ b/src/gui/setup_audio.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp index 31b56b51..49c99996 100644 --- a/src/gui/setup_colors.cpp +++ b/src/gui/setup_colors.cpp @@ -2,7 +2,7 @@ * Configurable text colors * Copyright (C) 2008 Douglas Boffey <dougaboffey@netscape.net> * - * This file is part of Aethyra. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -59,7 +59,7 @@ Setup_Colors::Setup_Colors() : // Replace this later with a more appropriate link handler. For now, this'll // do, as it'll do nothing when clicked on. - mPreview->setLinkHandler(new ItemLinkHandler()); + mPreview->setLinkHandler(new ItemLinkHandler); mPreviewBox = new ScrollArea(mPreview); mPreviewBox->setHeight(20); @@ -68,7 +68,7 @@ Setup_Colors::Setup_Colors() : mRedLabel = new gcn::Label(_("Red: ")); - mRedText = new TextField(); + mRedText = new TextField; mRedText->setWidth(40); mRedText->setRange(0, 255); mRedText->setNumeric(true); @@ -82,7 +82,7 @@ Setup_Colors::Setup_Colors() : mGreenLabel = new gcn::Label(_("Green: ")); - mGreenText = new TextField(); + mGreenText = new TextField; mGreenText->setWidth(40); mGreenText->setRange(0, 255); mGreenText->setNumeric(true); @@ -96,7 +96,7 @@ Setup_Colors::Setup_Colors() : mBlueLabel = new gcn::Label(_("Blue: ")); - mBlueText = new TextField(); + mBlueText = new TextField; mBlueText->setWidth(40); mBlueText->setRange(0, 255); mBlueText->setNumeric(true); diff --git a/src/gui/setup_colors.h b/src/gui/setup_colors.h index 98a2d18b..2831297f 100644 --- a/src/gui/setup_colors.h +++ b/src/gui/setup_colors.h @@ -2,7 +2,7 @@ * Configurable text colors * Copyright (C) 2008 Douglas Boffey <dougaboffey@netscape.net> * - * This file is part of Aethyra. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp index 5bbaa368..c0c04949 100644 --- a/src/gui/setup_joystick.cpp +++ b/src/gui/setup_joystick.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/setup_joystick.h b/src/gui/setup_joystick.h index ae888206..eba8a2cc 100644 --- a/src/gui/setup_joystick.h +++ b/src/gui/setup_joystick.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp index 0f79e3c6..aba8cf35 100644 --- a/src/gui/setup_keyboard.cpp +++ b/src/gui/setup_keyboard.cpp @@ -1,9 +1,9 @@ /* - * Aethyra - * Copyright (C) 2007 The Mana World Development Team + * Custom keyboard shortcuts configuration + * Copyright (C) 2007 Joshua Langley <joshlangley@optusnet.com.au> + * Copyright (C) 2009 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -69,7 +69,7 @@ class KeyListModel : public gcn::ListModel }; Setup_Keyboard::Setup_Keyboard(): - mKeyListModel(new KeyListModel()), + mKeyListModel(new KeyListModel), mKeyList(new ListBox(mKeyListModel)), mKeySetting(false) { diff --git a/src/gui/setup_keyboard.h b/src/gui/setup_keyboard.h index 5fa961ae..dee12135 100644 --- a/src/gui/setup_keyboard.h +++ b/src/gui/setup_keyboard.h @@ -1,9 +1,8 @@ /* - * Aethyra - * Copyright (C) 2007 The Mana World Development Team + * Custom keyboard shortcuts configuration + * Copyright (C) 2007 Joshua Langley <joshlangley@optusnet.com.au> * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp index 9105d44a..96792436 100644 --- a/src/gui/setup_players.cpp +++ b/src/gui/setup_players.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2008 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -70,9 +69,9 @@ static const char *RELATION_NAMES[PlayerRelation::RELATIONS_NR] = class PlayerRelationListModel : public gcn::ListModel { public: - virtual ~PlayerRelationListModel(void) { } + virtual ~PlayerRelationListModel() { } - virtual int getNumberOfElements(void) + virtual int getNumberOfElements() { return PlayerRelation::RELATIONS_NR; } @@ -88,30 +87,30 @@ public: class PlayerTableModel : public TableModel { public: - PlayerTableModel(void) : + PlayerTableModel() : mPlayers(NULL) { playerRelationsUpdated(); } - virtual ~PlayerTableModel(void) + virtual ~PlayerTableModel() { freeWidgets(); if (mPlayers) delete mPlayers; } - virtual int getRows(void) + virtual int getRows() { return mPlayers->size(); } - virtual int getColumns(void) + virtual int getColumns() { return COLUMNS_NR; } - virtual int getRowHeight(void) + virtual int getRowHeight() { return ROW_HEIGHT; } @@ -124,7 +123,7 @@ public: return RELATION_CHOICE_COLUMN_WIDTH; } - virtual void playerRelationsUpdated(void) + virtual void playerRelationsUpdated() { signalBeforeUpdate(); @@ -140,10 +139,10 @@ public: std::string name = (*player_names)[r]; gcn::Widget *widget = new gcn::Label(name); mWidgets.push_back(widget); - gcn::ListModel *playerRelation = new PlayerRelationListModel(); + gcn::ListModel *playerRelation = new PlayerRelationListModel; gcn::DropDown *choicebox = new DropDown(playerRelation, - new ScrollArea(), + new ScrollArea, new ListBox(playerRelation), false); choicebox->setSelected(player_relations.getRelation(name)); @@ -168,7 +167,7 @@ public: return mWidgets[WIDGET_AT(row, column)]; } - virtual void freeWidgets(void) + virtual void freeWidgets() { if (mPlayers) delete mPlayers; @@ -199,9 +198,9 @@ protected: class IgnoreChoicesListModel : public gcn::ListModel { public: - virtual ~IgnoreChoicesListModel(void) { } + virtual ~IgnoreChoicesListModel() { } - virtual int getNumberOfElements(void) + virtual int getNumberOfElements() { return player_relations.getPlayerIgnoreStrategies()->size(); } @@ -221,7 +220,7 @@ public: Setup_Players::Setup_Players(): mPlayerTableTitleModel(new StaticTableModel(1, COLUMNS_NR)), - mPlayerTableModel(new PlayerTableModel()), + mPlayerTableModel(new PlayerTableModel), mPlayerTable(new GuiTable(mPlayerTableModel)), mPlayerTitleTable(new GuiTable(mPlayerTableTitleModel)), mPlayerScrollArea(new ScrollArea(mPlayerTable)), @@ -241,8 +240,8 @@ Setup_Players::Setup_Players(): RELATION_CHOICE_COLUMN_WIDTH); mPlayerTitleTable->setBackgroundColor(gcn::Color(0xbf, 0xbf, 0xbf)); - gcn::ListModel *ignoreChoices = new IgnoreChoicesListModel(); - mIgnoreActionChoicesBox = new DropDown(ignoreChoices, new ScrollArea(), + gcn::ListModel *ignoreChoices = new IgnoreChoicesListModel; + mIgnoreActionChoicesBox = new DropDown(ignoreChoices, new ScrollArea, new ListBox(ignoreChoices), false); for (int i = 0; i < COLUMNS_NR; i++) @@ -295,7 +294,7 @@ Setup_Players::Setup_Players(): setDimension(gcn::Rectangle(0, 0, 325, 280)); } -Setup_Players::~Setup_Players(void) +Setup_Players::~Setup_Players() { player_relations.removeListener(this); } diff --git a/src/gui/setup_players.h b/src/gui/setup_players.h index 23a994a0..72d81f71 100644 --- a/src/gui/setup_players.h +++ b/src/gui/setup_players.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2008 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 7e3d483c..e89afd94 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -122,6 +121,10 @@ Setup_Video::Setup_Video(): mCustomCursorCheckBox(new CheckBox(_("Custom cursor"), mCustomCursorEnabled)), mParticleEffectsCheckBox(new CheckBox(_("Particle effects"), mParticleEffectsEnabled)), mNameCheckBox(new CheckBox(_("Show name"), mNameEnabled)), + mPickupNotifyLabel(new gcn::Label(_("Show pickup notification"))), + mPickupChatCheckBox(new CheckBox(_("in chat"), mPickupChatEnabled)), + mPickupParticleCheckBox(new CheckBox(_("as particle"), + mPickupParticleEnabled)), mSpeechSlider(new Slider(0, 3)), mSpeechLabel(new gcn::Label("")), mAlphaSlider(new Slider(0.2, 1.0)), @@ -139,11 +142,7 @@ Setup_Video::Setup_Video(): mOverlayDetailField(new gcn::Label("")), mParticleDetail(3 - (int) config.getValue("particleEmitterSkip", 1)), mParticleDetailSlider(new Slider(0, 3)), - mParticleDetailField(new gcn::Label("")), - mPickupNotifyLabel(new gcn::Label(_("Show pickup notification"))), - mPickupChatCheckBox(new CheckBox(_("in chat"), mPickupChatEnabled)), - mPickupParticleCheckBox(new CheckBox(_("as particle"), - mPickupParticleEnabled)) + mParticleDetailField(new gcn::Label("")) { setOpaque(false); @@ -319,7 +318,7 @@ void Setup_Video::apply() * See http://libsdl.org/cgi/docwiki.cgi/SDL_SetVideoMode */ -#ifdef WIN32 +#if defined(WIN32) || defined(__APPLE__) // checks for opengl usage if (!(config.getValue("opengl", false) == 1)) { @@ -337,7 +336,7 @@ void Setup_Video::apply() logger->error(error.str()); } } -#ifdef WIN32 +#if defined(WIN32) || defined(__APPLE__) } else { new OkDialog(_("Switching to full screen"), _("Restart needed for changes to take effect.")); diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h index b491cf23..7d9732a1 100644 --- a/src/gui/setup_video.h +++ b/src/gui/setup_video.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -75,6 +74,10 @@ class Setup_Video : public SetupTab, public gcn::ActionListener, gcn::CheckBox *mParticleEffectsCheckBox; gcn::CheckBox *mNameCheckBox; + gcn::Label *mPickupNotifyLabel; + gcn::CheckBox *mPickupChatCheckBox; + gcn::CheckBox *mPickupParticleCheckBox; + gcn::Slider *mSpeechSlider; gcn::Label *mSpeechLabel; gcn::Slider *mAlphaSlider; @@ -97,10 +100,6 @@ class Setup_Video : public SetupTab, public gcn::ActionListener, int mParticleDetail; gcn::Slider *mParticleDetailSlider; gcn::Label *mParticleDetailField; - - gcn::Label *mPickupNotifyLabel; - gcn::CheckBox *mPickupChatCheckBox; - gcn::CheckBox *mPickupParticleCheckBox; }; #endif diff --git a/src/gui/setuptab.h b/src/gui/setuptab.h index 7e1bc36f..3e0c51e2 100644 --- a/src/gui/setuptab.h +++ b/src/gui/setuptab.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp index bd676bc0..85f238c0 100644 --- a/src/gui/shop.cpp +++ b/src/gui/shop.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/shop.h b/src/gui/shop.h index 26a9429d..faffe7e3 100644 --- a/src/gui/shop.h +++ b/src/gui/shop.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/shoplistbox.cpp b/src/gui/shoplistbox.cpp index 776f26bc..64c97246 100644 --- a/src/gui/shoplistbox.cpp +++ b/src/gui/shoplistbox.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -81,15 +80,14 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) { gcn::Color backgroundColor = gcn::Color(255, 255, 255, alpha); - if (i == mSelected) - { - backgroundColor = gcn::Color(red, green, blue, alpha); - } - else if (mShopItems && + if (mShopItems && mPlayerMoney < mShopItems->at(i)->getPrice() && mPriceCheck) - { - backgroundColor = gcn::Color(145, 145, 145, alpha); - } + if (i == mSelected) + backgroundColor = gcn::Color(145, 0, 0, alpha); + else + backgroundColor = gcn::Color(145, 145, 145, alpha); + else if (i == mSelected) + backgroundColor = gcn::Color(red, green, blue, alpha); graphics->setColor(backgroundColor); graphics->fillRectangle(gcn::Rectangle(0, y, getWidth(), mRowHeight)); diff --git a/src/gui/shoplistbox.h b/src/gui/shoplistbox.h index bed9902b..5d3378b1 100644 --- a/src/gui/shoplistbox.h +++ b/src/gui/shoplistbox.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/shortcutcontainer.cpp b/src/gui/shortcutcontainer.cpp index 50ec9d06..f149266b 100644 --- a/src/gui/shortcutcontainer.cpp +++ b/src/gui/shortcutcontainer.cpp @@ -1,9 +1,8 @@ /* - * Aethyra - * Copyright 2007 The Mana World Development Team + * The Mana World + * Copyright (C) 2007 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/shortcutcontainer.h b/src/gui/shortcutcontainer.h index 3f2e1c60..7b09fb96 100644 --- a/src/gui/shortcutcontainer.h +++ b/src/gui/shortcutcontainer.h @@ -1,9 +1,8 @@ /* - * Aethyra - * Copyright 2007 The Mana World Development Team + * The Mana World + * Copyright (C) 2007 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,8 +19,8 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef SHORTCUTCONTAINER_H__ -#define SHORTCUTCONTAINER_H__ +#ifndef SHORTCUTCONTAINER_H +#define SHORTCUTCONTAINER_H #include <guichan/mouselistener.hpp> #include <guichan/widget.hpp> diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp index ee32ca70..c704fc44 100644 --- a/src/gui/shortcutwindow.cpp +++ b/src/gui/shortcutwindow.cpp @@ -1,9 +1,8 @@ /* - * Aethyra - * Copyright 2007 The Mana World Development Team + * The Mana World + * Copyright (C) 2007 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/shortcutwindow.h b/src/gui/shortcutwindow.h index 42077d9c..64592328 100644 --- a/src/gui/shortcutwindow.h +++ b/src/gui/shortcutwindow.h @@ -1,9 +1,8 @@ /* - * Aethyra - * Copyright 2007 The Mana World Development Team + * The Mana World + * Copyright (C) 2007 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp index 42ac4d86..61bb9ce9 100644 --- a/src/gui/skill.cpp +++ b/src/gui/skill.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,11 +46,14 @@ struct SkillInfo bool modifiable; }; -static const SkillInfo fakeSkillInfo = { _("???"), false }; +static const SkillInfo fakeSkillInfo = { + _("Mystery Skill"), + false +}; std::vector<SkillInfo> skill_db; -static void initSkillinfo(void); +static void initSkillinfo(); class SkillGuiTableModel : public StaticTableModel { @@ -77,12 +79,12 @@ public: return 35; } - virtual int getRowHeight(void) + virtual int getRowHeight() { return 12; } - virtual void update(void) + virtual void update() { mEntriesNr = mDialog->getSkills().size(); resize(); @@ -114,7 +116,6 @@ public: } } - private: SkillDialog *mDialog; int mEntriesNr; @@ -133,7 +134,7 @@ SkillDialog::SkillDialog(): mTable->setActionEventId("skill"); mTable->addActionListener(this); - setWindowName(_("Skills")); + setWindowName("Skills"); setCloseButton(true); setDefaultSize(windowContainer->getWidth() - 260, 25, 255, 260); @@ -235,7 +236,7 @@ bool SkillDialog::hasSkill(int id) void SkillDialog::addSkill(int id, int lvl, int mp) { - SKILL *tmp = new SKILL(); + SKILL *tmp = new SKILL; tmp->id = id; tmp->lv = lvl; tmp->sp = mp; @@ -256,11 +257,11 @@ void SkillDialog::setSkill(int id, int lvl, int mp) void SkillDialog::cleanList() { - for_each(mSkillList.begin(), mSkillList.end(), make_dtor(mSkillList)); + delete_all(mSkillList); mSkillList.clear(); } -static void initSkillinfo(void) +static void initSkillinfo() { SkillInfo emptySkillInfo = { "", false }; diff --git a/src/gui/skill.h b/src/gui/skill.h index bcdd515c..0600d106 100644 --- a/src/gui/skill.h +++ b/src/gui/skill.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -66,7 +65,7 @@ class SkillDialog : public Window, public gcn::ActionListener void setSkill(int id, int lv, int sp); void cleanList(); - const std::vector<SKILL*>& getSkills(void) const { return mSkillList; } + const std::vector<SKILL*>& getSkills() const { return mSkillList; } private: GuiTable *mTable; diff --git a/src/gui/slider.cpp b/src/gui/slider.cpp index db34cc6a..9bfa840f 100644 --- a/src/gui/slider.cpp +++ b/src/gui/slider.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/slider.h b/src/gui/slider.h index 35d875db..56ea334a 100644 --- a/src/gui/slider.h +++ b/src/gui/slider.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp index d54bf9ad..9ee91166 100644 --- a/src/gui/speechbubble.cpp +++ b/src/gui/speechbubble.cpp @@ -1,9 +1,8 @@ /* - * Aethyra - * Copyright (C) 2008, The Legend of Mazzeroth Development Team + * Speech bubbles + * Copyright (C) 2008 The Legend of Mazzeroth Development Team * - * This file is part of Aethyra based on original code - * from The Legend of Mazzeroth. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,7 +42,7 @@ SpeechBubble::SpeechBubble(): mCaption->setFont(boldFont); mCaption->setPosition(5, 3); - mSpeechBox = new TextBox(); + mSpeechBox = new TextBox; mSpeechBox->setEditable(false); mSpeechBox->setOpaque(false); diff --git a/src/gui/speechbubble.h b/src/gui/speechbubble.h index 6b03cc85..573e61f0 100644 --- a/src/gui/speechbubble.h +++ b/src/gui/speechbubble.h @@ -1,9 +1,8 @@ /* - * Aethyra - * Copyright (C) 2008, The Legend of Mazzeroth Development Team + * Speech bubbles + * Copyright (C) 2008 The Legend of Mazzeroth Development Team * - * This file is part of Aethyra based on original code - * from The Legend of Mazzeroth. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/status.cpp b/src/gui/status.cpp index 6419eabb..ff0c8563 100644 --- a/src/gui/status.cpp +++ b/src/gui/status.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,6 +29,7 @@ #include "widgets/layout.h" #include "../localplayer.h" +#include "../units.h" #include "../utils/gettext.h" #include "../utils/strprintf.h" @@ -37,9 +37,10 @@ StatusWindow::StatusWindow(LocalPlayer *player): Window(player->getName()), - mPlayer(player) + mPlayer(player), + mCurrency(0) { - setWindowName(_("Status")); + setWindowName("Status"); setCloseButton(true); setDefaultSize((windowContainer->getWidth() - 365) / 2, (windowContainer->getHeight() - 255) / 2, 400, 345); @@ -50,7 +51,8 @@ StatusWindow::StatusWindow(LocalPlayer *player): mLvlLabel = new gcn::Label(strprintf(_("Level: %d"), 0)); mJobLvlLabel = new gcn::Label(strprintf(_("Job: %d"), 0)); - mGpLabel = new gcn::Label(strprintf(_("Money: %d GP"), 0)); + mGpLabel = new gcn::Label(strprintf(_("Money: %s"), + Units::formatCurrency(mCurrency).c_str())); mHpLabel = new gcn::Label(_("HP:")); mHpBar = new ProgressBar(1.0f, 80, 15, 0, 171, 34); @@ -79,8 +81,11 @@ StatusWindow::StatusWindow(LocalPlayer *player): mStatsDefenseLabel= new gcn::Label(_("Defense:")); mStatsMagicAttackLabel = new gcn::Label(_("M.Attack:")); mStatsMagicDefenseLabel = new gcn::Label(_("M.Defense:")); + // Gettext flag for next line: xgettext:no-c-format mStatsAccuracyLabel = new gcn::Label(_("% Accuracy:")); + // Gettext flag for next line: xgettext:no-c-format mStatsEvadeLabel = new gcn::Label(_("% Evade:")); + // Gettext flag for next line: xgettext:no-c-format mStatsReflexLabel = new gcn::Label(_("% Reflex:")); mStatsAttackPoints = new gcn::Label; @@ -169,42 +174,20 @@ void StatusWindow::update() mJobLvlLabel->setCaption(strprintf(_("Job: %d"), mPlayer->mJobLevel)); mJobLvlLabel->adjustSize(); - mGpLabel->setCaption(strprintf(_("Money: %d GP"), mPlayer->mGp)); - mGpLabel->adjustSize(); - - mHpBar->setText(toString(mPlayer->mHp) + - "/" + toString(mPlayer->mMaxHp)); - - mMpBar->setText(toString(mPlayer->mMp) + - "/" + toString(mPlayer->mMaxMp)); - - mXpBar->setText(toString(mPlayer->getXp()) + - "/" + toString(mPlayer->mXpForNextLevel)); + if (mCurrency != mPlayer->mGp) { + mCurrency = mPlayer->mGp; + mGpLabel->setCaption(strprintf(_("Money: %s"), + Units::formatCurrency(mCurrency).c_str())); + mGpLabel->adjustSize(); + } - mJobBar->setText(toString(mPlayer->mJobXp) + - "/" + toString(mPlayer->mJobXpForNextLevel)); + updateHPBar(mHpBar, true); - // HP Bar coloration - if (mPlayer->mHp < int(mPlayer->mMaxHp / 3)) - { - mHpBar->setColor(223, 32, 32); // Red - } - else if (mPlayer->mHp < int((mPlayer->mMaxHp / 3) * 2)) - { - mHpBar->setColor(230, 171, 34); // Orange - } - else - { - mHpBar->setColor(0, 171, 34); // Green - } + updateMPBar(mMpBar, true); - mHpBar->setProgress((float) mPlayer->mHp / (float) mPlayer->mMaxHp); - mMpBar->setProgress((float) mPlayer->mMp / (float) mPlayer->mMaxMp); + updateXPBar(mXpBar, false); - mXpBar->setProgress( - (float) mPlayer->getXp() / (float) mPlayer->mXpForNextLevel); - mJobBar->setProgress( - (float) mPlayer->mJobXp / (float) mPlayer->mJobXpForNextLevel); + updateJobBar(mJobBar, false); // Stats Part // ---------- @@ -311,3 +294,84 @@ void StatusWindow::action(const gcn::ActionEvent &event) } } } + +void StatusWindow::updateHPBar(ProgressBar *bar, bool showMax) +{ + if (showMax) + bar->setText(toString(player_node->mHp) + + "/" + toString(player_node->mMaxHp)); + else + bar->setText(toString(player_node->mHp)); + + // HP Bar coloration + if (player_node->mHp < player_node->mMaxHp / 3) + { + bar->setColor(223, 32, 32); // Red + } + else if (player_node->mHp < (player_node->mMaxHp / 3) * 2) + { + bar->setColor(230, 171, 34); // Orange + } + else + { + bar->setColor(0, 171, 34); // Green + } + + bar->setProgress((float) player_node->mHp / (float) player_node->mMaxHp); +} + +void StatusWindow::updateMPBar(ProgressBar *bar, bool showMax) +{ + if (showMax) + bar->setText(toString(player_node->mMp) + + "/" + toString(player_node->mMaxMp)); + else + bar->setText(toString(player_node->mMp)); + + + bar->setProgress((float) player_node->mMp / (float) player_node->mMaxMp); +} + +void StatusWindow::updateXPBar(ProgressBar *bar, bool percent) +{ + if (player_node->mXpForNextLevel == 0) { + bar->setText(_("Max level")); + bar->setProgress(1.0); + } else { + if (percent) + { + float xp = (float) player_node->getXp() / + player_node->mXpForNextLevel; + bar->setText(toString((float) ((int) (xp * 10000.0f)) / 100.0f) + + "%"); + } + else + bar->setText(toString(player_node->getXp()) + + "/" + toString(player_node->mXpForNextLevel)); + + bar->setProgress((float) player_node->getXp() / + (float) player_node->mXpForNextLevel); + } +} + +void StatusWindow::updateJobBar(ProgressBar *bar, bool percent) +{ + if (player_node->mJobXpForNextLevel == 0) { + bar->setText(_("Max level")); + bar->setProgress(1.0); + } else { + if (percent) + { + float xp = (float) player_node->mJobXp / + player_node->mJobXpForNextLevel; + bar->setText(toString((float) ((int) (xp * 10000.0f)) / 100.0f) + + "%"); + } + else + bar->setText(toString(player_node->mJobXp) + + "/" + toString(player_node->mJobXpForNextLevel)); + + bar->setProgress((float) player_node->mJobXp / + (float) player_node->mJobXpForNextLevel); + } +} diff --git a/src/gui/status.h b/src/gui/status.h index 5056f631..f3f54f4e 100644 --- a/src/gui/status.h +++ b/src/gui/status.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -58,6 +57,11 @@ class StatusWindow : public Window, public gcn::ActionListener */ void update(); + static void updateHPBar(ProgressBar *bar, bool showMax = false); + static void updateMPBar(ProgressBar *bar, bool showMax = false); + static void updateXPBar(ProgressBar *bar, bool percent = true); + static void updateJobBar(ProgressBar *bar, bool percent = true); + private: LocalPlayer *mPlayer; @@ -66,6 +70,7 @@ class StatusWindow : public Window, public gcn::ActionListener */ gcn::Label *mLvlLabel, *mJobLvlLabel; gcn::Label *mGpLabel; + Uint32 mCurrency; gcn::Label *mHpLabel, *mMpLabel, *mXpLabel, *mJobLabel; ProgressBar *mHpBar, *mMpBar; ProgressBar *mXpBar, *mJobBar; diff --git a/src/gui/table.cpp b/src/gui/table.cpp index b2571495..1371a78e 100644 --- a/src/gui/table.cpp +++ b/src/gui/table.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2008 The Mana World Development Team * - * This file is part of Aethyra derived from original code - * from Guichan. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,7 +37,7 @@ class GuiTableActionListener : public gcn::ActionListener public: GuiTableActionListener(GuiTable *_table, gcn::Widget *_widget, int _row, int _column); - virtual ~GuiTableActionListener(void); + virtual ~GuiTableActionListener(); virtual void action(const gcn::ActionEvent& actionEvent); @@ -63,7 +62,7 @@ GuiTableActionListener::GuiTableActionListener(GuiTable *table, gcn::Widget *wid } } -GuiTableActionListener::~GuiTableActionListener(void) +GuiTableActionListener::~GuiTableActionListener() { if (mWidget) { @@ -97,12 +96,12 @@ GuiTable::GuiTable(TableModel *initial_model, gcn::Color background, addKeyListener(this); } -GuiTable::~GuiTable(void) +GuiTable::~GuiTable() { delete mModel; } -TableModel* GuiTable::getModel(void) const +TableModel *GuiTable::getModel() const { return mModel; } @@ -125,7 +124,7 @@ void GuiTable::setModel(TableModel *new_model) } } -void GuiTable::recomputeDimensions(void) +void GuiTable::recomputeDimensions() { int rows_nr = mModel->getRows(); int columns_nr = mModel->getColumns(); @@ -153,12 +152,12 @@ void GuiTable::setSelected(int row, int column) mSelectedRow = row; } -int GuiTable::getSelectedRow(void) +int GuiTable::getSelectedRow() { return mSelectedRow; } -int GuiTable::getSelectedColumn(void) +int GuiTable::getSelectedColumn() { return mSelectedColumn; } @@ -168,7 +167,7 @@ void GuiTable::setLinewiseSelection(bool linewise) mLinewiseMode = linewise; } -int GuiTable::getRowHeight(void) +int GuiTable::getRowHeight() { if (mModel) return mModel->getRowHeight() + 1; // border @@ -200,7 +199,7 @@ void GuiTable::setSelectedRow(int selected) { mSelectedRow = 0; } - else if ((selected >= mModel->getRows() && !mWrappingEnabled) || + else if ((selected >= mModel->getRows() && !mWrappingEnabled) || (selected < 0 && mWrappingEnabled)) { mSelectedRow = mModel->getRows() - 1; @@ -225,7 +224,7 @@ void GuiTable::setSelectedColumn(int selected) { mSelectedColumn = 0; } - else if ((selected >= mModel->getColumns() && !mWrappingEnabled) || + else if ((selected >= mModel->getColumns() && !mWrappingEnabled) || (selected < 0 && mWrappingEnabled)) { mSelectedColumn = mModel->getColumns() - 1; @@ -239,11 +238,11 @@ void GuiTable::setSelectedColumn(int selected) void GuiTable::uninstallActionListeners(void) { - delete_all(action_listeners); - action_listeners.clear(); + delete_all(mActionListeners); + mActionListeners.clear(); } -void GuiTable::installActionListeners(void) +void GuiTable::installActionListeners() { if (!mModel) return; @@ -255,7 +254,7 @@ void GuiTable::installActionListeners(void) for (int column = 0; column < columns; ++column) { gcn::Widget *widget = mModel->getElementAt(row, column); - action_listeners.push_back(new GuiTableActionListener(this, widget, + mActionListeners.push_back(new GuiTableActionListener(this, widget, row, column)); } @@ -292,7 +291,7 @@ void GuiTable::draw(gcn::Graphics* graphics) int max_rows_nr = mModel->getRows() - first_row; // clip if neccessary: if (max_rows_nr < rows_nr) rows_nr = max_rows_nr; - + // Now determine the first and last column // Take the easy way out; these are usually bounded and all visible. int first_column = 0; @@ -325,7 +324,7 @@ void GuiTable::draw(gcn::Graphics* graphics) if (!mLinewiseMode && c == mSelectedColumn && r == mSelectedRow) { bool valid; - const int red = + const int red = (textColor->getColor('H', valid) >> 16) & 0xFF; const int green = (textColor->getColor('H', valid) >> 8) & 0xFF; @@ -347,7 +346,7 @@ void GuiTable::draw(gcn::Graphics* graphics) if (mLinewiseMode && r == mSelectedRow) { bool valid; - const int red = + const int red = (textColor->getColor('H', valid) >> 16) & 0xFF; const int green = (textColor->getColor('H', valid) >> 8) & 0xFF; @@ -384,7 +383,7 @@ void GuiTable::moveToBottom(gcn::Widget *widget) mTopWidget = NULL; } -gcn::Rectangle GuiTable::getChildrenArea(void) +gcn::Rectangle GuiTable::getChildrenArea() { return gcn::Rectangle(0, 0, getWidth(), getHeight()); } @@ -474,7 +473,7 @@ void GuiTable::mouseWheelMovedDown(gcn::MouseEvent& mouseEvent) mouseEvent.consume(); } } - + void GuiTable::mouseDragged(gcn::MouseEvent& mouseEvent) { } @@ -494,7 +493,7 @@ void GuiTable::modelUpdated(bool completed) } } -gcn::Widget* GuiTable::getWidgetAt(int x, int y) +gcn::Widget *GuiTable::getWidgetAt(int x, int y) { int row = getRowForY(y); int column = getColumnForX(x); @@ -546,12 +545,13 @@ void GuiTable::_setFocusHandler(gcn::FocusHandler* focusHandler) { gcn::Widget::_setFocusHandler(focusHandler); - if (mModel) - for (int r = 0; r < mModel->getRows(); ++r) - for (int c = 0; c < mModel->getColumns(); ++c) - { + if (mModel) { + for (int r = 0; r < mModel->getRows(); ++r) { + for (int c = 0; c < mModel->getColumns(); ++c) { gcn::Widget *w = mModel->getElementAt(r, c); if (w) w->_setFocusHandler(focusHandler); } + } + } } diff --git a/src/gui/table.h b/src/gui/table.h index a508d0e4..d73cf340 100644 --- a/src/gui/table.h +++ b/src/gui/table.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2008 The Mana World Development Team * - * This file is part of Aethyra derived from original code - * from Guichan. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -47,17 +46,19 @@ class GuiTable : public gcn::Widget, public gcn::KeyListener, public TableModelListener { - friend class GuiTableActionListener; // so that the action listener can call distributeActionEvent + // so that the action listener can call distributeActionEvent + friend class GuiTableActionListener; + public: GuiTable(TableModel * initial_model = NULL, gcn::Color background = 0xffffff, bool opacity = true); - virtual ~GuiTable(void); + virtual ~GuiTable(); /** * Retrieves the active table model */ - TableModel *getModel(void) const; + TableModel *getModel() const; /** * Sets the table model @@ -73,9 +74,9 @@ public: void setSelected(int row, int column); - int getSelectedRow(void); + int getSelectedRow(); - int getSelectedColumn(void); + int getSelectedColumn(); void setSelectedRow(int selected); @@ -137,25 +138,25 @@ public: virtual void mouseWheelMovedUp(gcn::MouseEvent& mouseEvent); virtual void mouseWheelMovedDown(gcn::MouseEvent& mouseEvent); - + virtual void mouseDragged(gcn::MouseEvent& mouseEvent); // Constraints inherited from TableModelListener virtual void modelUpdated(bool); protected: + /** Frees all action listeners on inner widgets. */ + virtual void uninstallActionListeners(); + /** Installs all action listeners on inner widgets. */ + virtual void installActionListeners(); - virtual void uninstallActionListeners(void); // frees all action listeners on inner widgets - virtual void installActionListeners(void); // installs all action listeners on inner widgets - - virtual int getRowHeight(void); + virtual int getRowHeight(); virtual int getColumnWidth(int i); - -private: +private: int getRowForY(int y); // -1 on error int getColumnForX(int x); // -1 on error - void recomputeDimensions(void); + void recomputeDimensions(); bool mLinewiseMode; bool mWrappingEnabled; bool mOpaque; @@ -172,11 +173,14 @@ private: int mSelectedRow; int mSelectedColumn; - int mPopFramesNr; // Number of frames to skip upwards when drawing the selected widget + /** Number of frames to skip upwards when drawing the selected widget. */ + int mPopFramesNr; - gcn::Widget *mTopWidget; // If someone moves a fresh widget to the top, we must display it + /** If someone moves a fresh widget to the top, we must display it. */ + gcn::Widget *mTopWidget; - std::vector<GuiTableActionListener *> action_listeners; // Vector for compactness; used as a list in practice. + /** Vector for compactness; used as a list in practice. */ + std::vector<GuiTableActionListener *> mActionListeners; }; diff --git a/src/gui/table_model.cpp b/src/gui/table_model.cpp index 8998961e..4fa13bae 100644 --- a/src/gui/table_model.cpp +++ b/src/gui/table_model.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2008 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,13 +35,13 @@ void TableModel::removeListener(TableModelListener *listener) listeners.erase(listener); } -void TableModel::signalBeforeUpdate(void) +void TableModel::signalBeforeUpdate() { for (std::set<TableModelListener *>::const_iterator it = listeners.begin(); it != listeners.end(); it++) (*it)->modelUpdated(false); } -void TableModel::signalAfterUpdate(void) +void TableModel::signalAfterUpdate() { for (std::set<TableModelListener *>::const_iterator it = listeners.begin(); it != listeners.end(); it++) (*it)->modelUpdated(true); @@ -61,12 +60,12 @@ StaticTableModel::StaticTableModel(int row, int column) : mWidths.resize(column, 1); } -StaticTableModel::~StaticTableModel(void) +StaticTableModel::~StaticTableModel() { delete_all(mTableModel); } -void StaticTableModel::resize(void) +void StaticTableModel::resize() { mRows = getRows(); mColumns = getColumns(); @@ -98,7 +97,7 @@ void StaticTableModel::set(int row, int column, gcn::Widget *widget) signalAfterUpdate(); } -gcn::Widget* StaticTableModel::getElementAt(int row, int column) +gcn::Widget *StaticTableModel::getElementAt(int row, int column) { return mTableModel[WIDGET_AT(row, column)]; } @@ -120,7 +119,7 @@ void StaticTableModel::fixRowHeight(int height) mHeight = -height; } -int StaticTableModel::getRowHeight(void) +int StaticTableModel::getRowHeight() { return abs(mHeight); } @@ -133,12 +132,12 @@ int StaticTableModel::getColumnWidth(int column) return abs(mWidths[column]); } -int StaticTableModel::getRows(void) +int StaticTableModel::getRows() { return mRows; } -int StaticTableModel::getColumns(void) +int StaticTableModel::getColumns() { return mColumns; } diff --git a/src/gui/table_model.h b/src/gui/table_model.h index 6edd7d65..9ca36120 100644 --- a/src/gui/table_model.h +++ b/src/gui/table_model.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2008 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,8 +29,9 @@ class TableModelListener { public: /** - * Must be invoked by the TableModel whenever a global change is about to occur or - * has occurred (e.g., when a row or column is being removed or added). + * Must be invoked by the TableModel whenever a global change is about to + * occur or has occurred (e.g., when a row or column is being removed or + * added). * * This method is triggered twice, once before and once after the update. * @@ -46,22 +46,22 @@ public: class TableModel { public: - virtual ~TableModel(void) { } + virtual ~TableModel() { } /** * Determines the number of rows (lines) in the table */ - virtual int getRows(void) = 0; + virtual int getRows() = 0; /** * Determines the number of columns in each row */ - virtual int getColumns(void) = 0; + virtual int getColumns() = 0; /** * Determines the height for each row */ - virtual int getRowHeight(void) = 0; + virtual int getRowHeight() = 0; /** * Determines the width of each individual column @@ -81,12 +81,12 @@ protected: /** * Tells all listeners that the table is about to see an update */ - virtual void signalBeforeUpdate(void); + virtual void signalBeforeUpdate(); /** * Tells all listeners that the table has seen an update */ - virtual void signalAfterUpdate(void); + virtual void signalAfterUpdate(); private: std::set<TableModelListener *> listeners; @@ -97,7 +97,7 @@ class StaticTableModel : public TableModel { public: StaticTableModel(int width, int height); - virtual ~StaticTableModel(void); + virtual ~StaticTableModel(); /** * Inserts a widget into the table model. @@ -107,7 +107,8 @@ public: virtual void set(int row, int column, gcn::Widget *widget); /** - * Fixes the column width for a given column; this overrides dynamic width inference. + * Fixes the column width for a given column; this overrides dynamic width + * inference. * * Semantics are undefined for width 0. */ @@ -123,17 +124,16 @@ public: /** * Resizes the table model */ - virtual void resize(void); + virtual void resize(); - virtual int getRows(void); - virtual int getColumns(void); - virtual int getRowHeight(void); - virtual int getWidth(void); - virtual int getHeight(void); + virtual int getRows(); + virtual int getColumns(); + virtual int getRowHeight(); + virtual int getWidth(); + virtual int getHeight(); virtual int getColumnWidth(int index); virtual gcn::Widget *getElementAt(int row, int column); - protected: int mRows, mColumns; int mHeight; diff --git a/src/gui/textbox.cpp b/src/gui/textbox.cpp index 589986cd..a4024de3 100644 --- a/src/gui/textbox.cpp +++ b/src/gui/textbox.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/textbox.h b/src/gui/textbox.h index 33ea42f9..10a81fc0 100644 --- a/src/gui/textbox.h +++ b/src/gui/textbox.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/textfield.cpp b/src/gui/textfield.cpp index 054bc405..0e839b1f 100644 --- a/src/gui/textfield.cpp +++ b/src/gui/textfield.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/textfield.h b/src/gui/textfield.h index b82912c0..73824615 100644 --- a/src/gui/textfield.h +++ b/src/gui/textfield.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp index a12b94ed..2deabbf2 100644 --- a/src/gui/trade.cpp +++ b/src/gui/trade.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,6 +37,7 @@ #include "../inventory.h" #include "../item.h" #include "../localplayer.h" +#include "../units.h" #include "../net/messageout.h" #include "../net/protocol.h" @@ -52,7 +52,7 @@ TradeWindow::TradeWindow(Network *network): mMyInventory(new Inventory(INVENTORY_SIZE)), mPartnerInventory(new Inventory(INVENTORY_SIZE)) { - setWindowName(_("Trade")); + setWindowName("Trade"); setDefaultSize(115, 227, 342, 209); setResizable(true); @@ -78,7 +78,7 @@ TradeWindow::TradeWindow(Network *network): mPartnerScroll = new ScrollArea(mPartnerItemContainer); - mMoneyLabel = new gcn::Label(strprintf(_("You get %d GP."), 0)); + mMoneyLabel = new gcn::Label(strprintf(_("You get %s."), "")); mMoneyLabel2 = new gcn::Label(_("You give:")); mMoneyField = new TextField; mMoneyField->setWidth(50); @@ -119,7 +119,8 @@ void TradeWindow::widgetResized(const gcn::Event &event) void TradeWindow::addMoney(int amount) { - mMoneyLabel->setCaption(strprintf(_("You get %d GP."), amount)); + mMoneyLabel->setCaption(strprintf(_("You get %s."), + Units::formatCurrency(amount).c_str())); mMoneyLabel->adjustSize(); } @@ -169,7 +170,7 @@ void TradeWindow::reset() mOkButton->setEnabled(true); mOkOther = false; mOkMe = false; - mMoneyLabel->setCaption(strprintf(_("You get %d GP."), 0)); + mMoneyLabel->setCaption(strprintf(_("You get %s."), "")); mMoneyField->setEnabled(true); mMoneyField->setText(""); } diff --git a/src/gui/trade.h b/src/gui/trade.h index f4a6b5cd..df724038 100644 --- a/src/gui/trade.h +++ b/src/gui/trade.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/truetypefont.cpp b/src/gui/truetypefont.cpp index e50fb457..b4b839e9 100644 --- a/src/gui/truetypefont.cpp +++ b/src/gui/truetypefont.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -44,8 +43,7 @@ class TextChunk bool operator==(const TextChunk &chunk) const { - return ( - chunk.text == text && chunk.color == color); + return (chunk.text == text && chunk.color == color); } void generate(TTF_Font *font) @@ -134,12 +132,12 @@ void TrueTypeFont::drawString(gcn::Graphics *graphics, bool found = false; - for (CacheIterator i = cache.begin(); i != cache.end(); i++) + for (CacheIterator i = mCache.begin(); i != mCache.end(); ++i) { if (chunk == (*i)) { // Raise priority: move it to front - cache.splice(cache.begin(), cache, i); + mCache.splice(mCache.begin(), mCache, i); found = true; break; } @@ -148,19 +146,19 @@ void TrueTypeFont::drawString(gcn::Graphics *graphics, // Surface not found if (!found) { - if (cache.size() >= CACHE_SIZE) + if (mCache.size() >= CACHE_SIZE) { - cache.pop_back(); + mCache.pop_back(); } - cache.push_front(chunk); - cache.front().generate(mFont); + mCache.push_front(chunk); + mCache.front().generate(mFont); } - cache.front().img->setAlpha(alpha); - g->drawImage(cache.front().img, x, y); + mCache.front().img->setAlpha(alpha); + g->drawImage(mCache.front().img, x, y); } -int TrueTypeFont::getWidth(const std::string& text) const +int TrueTypeFont::getWidth(const std::string &text) const { int w, h; TTF_SizeUTF8(mFont, text.c_str(), &w, &h); diff --git a/src/gui/truetypefont.h b/src/gui/truetypefont.h index 085aa226..de146087 100644 --- a/src/gui/truetypefont.h +++ b/src/gui/truetypefont.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -63,13 +62,15 @@ class TrueTypeFont : public gcn::Font /** * @see Font::drawString */ - void drawString(gcn::Graphics* graphics, const std::string& text, int x, int y); + void drawString(gcn::Graphics *graphics, + const std::string &text, + int x, int y); private: TTF_Font *mFont; // Word surfaces cache - std::list<TextChunk> cache; + std::list<TextChunk> mCache; }; #endif diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index 81dcb047..6ec62337 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -108,7 +107,7 @@ UpdaterWindow::UpdaterWindow(const std::string &updateHost, { mCurlError[0] = 0; - mBrowserBox = new BrowserBox(); + mBrowserBox = new BrowserBox; mScrollArea = new ScrollArea(mBrowserBox); mLabel = new gcn::Label(_("Connecting...")); mProgressBar = new ProgressBar(0.0, 310, 20, 168, 116, 31); @@ -361,7 +360,7 @@ int UpdaterWindow::downloadThread(void *ptr) // Remove the corrupted file ::remove(outFilename.c_str()); logger->log( - _("Checksum for file %s failed: (%lx/%lx)"), + "Checksum for file %s failed: (%lx/%lx)", uw->mCurrentFile.c_str(), adler, uw->mCurrentChecksum); attempts++; diff --git a/src/gui/updatewindow.h b/src/gui/updatewindow.h index 234a6f57..4ada3c3a 100644 --- a/src/gui/updatewindow.h +++ b/src/gui/updatewindow.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 56274573..7f97d98c 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +19,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "ministatus.h" #include "popupmenu.h" #include "viewport.h" @@ -64,7 +64,7 @@ Viewport::Viewport(): config.addListener("ScrollLaziness", this); config.addListener("ScrollRadius", this); - mPopupMenu = new PopupMenu(); + mPopupMenu = new PopupMenu; } Viewport::~Viewport() @@ -77,6 +77,8 @@ void Viewport::setMap(Map *map) mMap = map; } +extern MiniStatusWindow *miniStatusWindow; + void Viewport::draw(gcn::Graphics *gcnGraphics) { static int lastTick = tick_time; @@ -215,6 +217,9 @@ void Viewport::draw(gcn::Graphics *gcnGraphics) (*i)->drawEmotion(graphics, (int) mPixelViewX, (int) mPixelViewY); } + if (miniStatusWindow) + miniStatusWindow->drawIcons(graphics); + // Draw contained widgets WindowContainer::draw(gcnGraphics); } @@ -335,7 +340,8 @@ void Viewport::mousePressed(gcn::MouseEvent &event) else if (event.getButton() == gcn::MouseEvent::MIDDLE) { // Find the being nearest to the clicked position - Being *target = beingManager->findBeingByPixel(x, y); + Being *target = beingManager->findNearestLivingBeing(tilex, tiley, 20, + Being::MONSTER); if (target) player_node->setTarget(target); diff --git a/src/gui/viewport.h b/src/gui/viewport.h index 12fdb187..6e7a2370 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 9fcf173c..eef9ae33 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -1,9 +1,8 @@ /* - * Aethyra - * Copyright (C) 2008 The Mana World Development Team + * The Mana World + * Copyright (C) 2006 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -41,7 +40,7 @@ Image *DropDown::buttons[2][2]; ImageRect DropDown::skin; float DropDown::mAlpha = config.getValue("guialpha", 0.8); -DropDown::DropDown(gcn::ListModel *listModel, gcn::ScrollArea *scrollArea, +DropDown::DropDown(gcn::ListModel *listModel, gcn::ScrollArea *scrollArea, gcn::ListBox *listBox, bool opacity): gcn::DropDown::DropDown(listModel, scrollArea, listBox), mOpaque(opacity) diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index 191740d9..1e6dc821 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -1,9 +1,8 @@ /* - * Aethyra - * Copyright (C) 2008 The Mana World Development Team + * The Mana World + * Copyright (C) 2006 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/layout.cpp b/src/gui/widgets/layout.cpp index 7fab91d7..4ffdda36 100644 --- a/src/gui/widgets/layout.cpp +++ b/src/gui/widgets/layout.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2007 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/layout.h b/src/gui/widgets/layout.h index 04b75ca5..20a4222d 100644 --- a/src/gui/widgets/layout.h +++ b/src/gui/widgets/layout.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2007 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/layouthelper.cpp b/src/gui/widgets/layouthelper.cpp index ed002f99..410de98a 100644 --- a/src/gui/widgets/layouthelper.cpp +++ b/src/gui/widgets/layouthelper.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2009 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/layouthelper.h b/src/gui/widgets/layouthelper.h index 1125d209..afa92a18 100644 --- a/src/gui/widgets/layouthelper.h +++ b/src/gui/widgets/layouthelper.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2009 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp index f3cc4f83..fa264e37 100644 --- a/src/gui/widgets/resizegrip.cpp +++ b/src/gui/widgets/resizegrip.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/resizegrip.h b/src/gui/widgets/resizegrip.h index 7c96af45..620c133f 100644 --- a/src/gui/widgets/resizegrip.h +++ b/src/gui/widgets/resizegrip.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index 97f6010c..3a79dd91 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2008 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/tab.h b/src/gui/widgets/tab.h index 4b331d66..3af4e2bf 100644 --- a/src/gui/widgets/tab.h +++ b/src/gui/widgets/tab.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2008 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 2c454b69..a8f2b6f0 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2008 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -72,7 +71,7 @@ gcn::Widget* TabbedArea::getWidget(const std::string &name) void TabbedArea::addTab(const std::string &caption, gcn::Widget *widget) { - Tab* tab = new Tab(); + Tab* tab = new Tab; tab->setCaption(caption); mTabsToDelete.push_back(tab); diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index 863ff79e..01d70380 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2008 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/window.cpp b/src/gui/window.cpp index e285c3c4..48229ec8 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -88,7 +87,7 @@ Window::Window(const std::string& caption, bool modal, Window *parent, const std if (instances == 0) { - windowConfigListener = new WindowConfigListener(); + windowConfigListener = new WindowConfigListener; // Send GUI alpha changed for initialization windowConfigListener->optionChanged("guialpha"); config.addListener("guialpha", windowConfigListener); @@ -248,7 +247,7 @@ void Window::setResizable(bool r) if (r) { - mGrip = new ResizeGrip(); + mGrip = new ResizeGrip; mGrip->setX(getWidth() - mGrip->getWidth() - getChildrenArea().x); mGrip->setY(getHeight() - mGrip->getHeight() - getChildrenArea().y); add(mGrip); @@ -732,4 +731,3 @@ void Window::reflowLayout(int w, int h) mLayout = NULL; setContentSize(w, h); } - diff --git a/src/gui/window.h b/src/gui/window.h index 0a0f4be9..518de6e9 100644 --- a/src/gui/window.h +++ b/src/gui/window.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,7 +30,6 @@ #include "../guichanfwd.h" class ConfigListener; -class GCContainer; class ContainerPlacer; class Image; class ImageRect; @@ -178,7 +176,7 @@ class Window : public gcn::Window, gcn::WidgetListener * * @return The parent window or <code>NULL</code> if there is none. */ - Window* getParentWindow() { return mParent; } + Window *getParentWindow() { return mParent; } /** * Schedule this window for deletion. It will be deleted at the start @@ -223,7 +221,7 @@ class Window : public gcn::Window, gcn::WidgetListener /** * Returns the name of the window. This is not the window title. */ - const std::string& getWindowName() { return mWindowName; } + const std::string &getWindowName() { return mWindowName; } /** * Reads the position (and the size for resizable windows) in the @@ -301,7 +299,6 @@ class Window : public gcn::Window, gcn::WidgetListener void setGuiAlpha(); - GCContainer *mChrome; /**< Contained container */ ResizeGrip *mGrip; /**< Resize grip */ Window *mParent; /**< The parent window */ Layout *mLayout; /**< Layout handler */ diff --git a/src/gui/windowcontainer.cpp b/src/gui/windowcontainer.cpp index 0aa61965..2846b1c1 100644 --- a/src/gui/windowcontainer.cpp +++ b/src/gui/windowcontainer.cpp @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/src/gui/windowcontainer.h b/src/gui/windowcontainer.h index 09f34cf5..62704d1b 100644 --- a/src/gui/windowcontainer.h +++ b/src/gui/windowcontainer.h @@ -1,9 +1,8 @@ /* - * Aethyra + * The Mana World * Copyright (C) 2004 The Mana World Development Team * - * This file is part of Aethyra based on original code - * from The Mana World. + * This file is part of The Mana World. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by |