diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-02-19 15:49:45 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-02-19 15:49:45 +0300 |
commit | b30a5d2289a0b68410dee5343e148aba88ea4839 (patch) | |
tree | 9d756785b9166ced76675ad3ebe398c09b494a3c /src/gui | |
parent | 9a3a196dbf633a699c26d0227802a42f025c8bfd (diff) | |
parent | 164e4ed5a153ce06badb52f3a5a4dff16c58d7e6 (diff) | |
download | mv-b30a5d2289a0b68410dee5343e148aba88ea4839.tar.gz mv-b30a5d2289a0b68410dee5343e148aba88ea4839.tar.bz2 mv-b30a5d2289a0b68410dee5343e148aba88ea4839.tar.xz mv-b30a5d2289a0b68410dee5343e148aba88ea4839.zip |
Merge branch 'master' into stripped
Diffstat (limited to 'src/gui')
54 files changed, 183 insertions, 128 deletions
diff --git a/src/gui/botcheckerwindow.cpp b/src/gui/botcheckerwindow.cpp index 2043b4fe3..4a092ab55 100644 --- a/src/gui/botcheckerwindow.cpp +++ b/src/gui/botcheckerwindow.cpp @@ -53,7 +53,8 @@ #define TIME_COLUMN 1 #define ROW_HEIGHT 12 -// The following column widths really shouldn't be hardcoded but should scale with the size of the widget... excep +// The following column widths really shouldn't be hardcoded but should +// scale with the size of the widget... excep // that, right now, the widget doesn't exactly scale either. #define NAME_COLUMN_WIDTH 185 #define TIME_COLUMN_WIDTH 70 diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp index 6831ad5b6..69e4d703f 100644 --- a/src/gui/chatwindow.cpp +++ b/src/gui/chatwindow.cpp @@ -159,7 +159,7 @@ ChatWindow::ChatWindow(): mGMLoaded(false) { listen(CHANNEL_NOTICES); - listen(Mana::CHANNEL_ATTRIBUTES); + listen(CHANNEL_ATTRIBUTES); setWindowName("Chat"); @@ -311,6 +311,7 @@ void ChatWindow::fillCommands() mCommands.push_back("<MONSTER>"); mCommands.push_back("<PEOPLE>"); mCommands.push_back("<PARTY>"); + mCommands.push_back("/setdrop "); } void ChatWindow::loadGMCommands() @@ -594,7 +595,7 @@ void ChatWindow::ignoreAllWhispers() PlayerRelation::IGNORED); } - delete(iter->second); + delete (iter->second); iter->second = nullptr; } } @@ -866,19 +867,19 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event) addInputText(Temp, false); } -void ChatWindow::processEvent(Mana::Channels channel, const Mana::Event &event) +void ChatWindow::processEvent(Channels channel, const Event &event) { - if (channel == Mana::CHANNEL_NOTICES) + if (channel == CHANNEL_NOTICES) { - if (event.getName() == Mana::EVENT_SERVERNOTICE && localChatTab) + if (event.getName() == EVENT_SERVERNOTICE && localChatTab) localChatTab->chatLog(event.getString("message"), BY_SERVER); } - else if (channel == Mana::CHANNEL_ATTRIBUTES) + else if (channel == CHANNEL_ATTRIBUTES) { if (!config.getBoolValue("showBattleEvents")) return; - if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) + if (event.getName() == EVENT_UPDATEATTRIBUTE) { switch (event.getInt("id")) { @@ -902,7 +903,7 @@ void ChatWindow::processEvent(Mana::Channels channel, const Mana::Event &event) break; }; } - else if (event.getName() == Mana::EVENT_UPDATESTAT) + else if (event.getName() == EVENT_UPDATESTAT) { if (!config.getBoolValue("showJobExp")) return; @@ -1122,7 +1123,7 @@ std::string ChatWindow::addColors(std::string &msg) int cMap[] = {1, 4, 5, 2, 3, 6, 7, 9, 0, 8}; // rainbow - switch(mChatColor) + switch (mChatColor) { case 11: msg = removeColors(msg); diff --git a/src/gui/chatwindow.h b/src/gui/chatwindow.h index 82e3d31f2..b3dce33fc 100644 --- a/src/gui/chatwindow.h +++ b/src/gui/chatwindow.h @@ -80,7 +80,7 @@ struct CHATLOG class ChatWindow : public Window, public gcn::ActionListener, public gcn::KeyListener, - public Mana::Listener + public Listener { public: /** @@ -190,7 +190,7 @@ class ChatWindow : public Window, */ void mousePressed(gcn::MouseEvent &event); - void processEvent(Mana::Channels channel, const Mana::Event &event); + void processEvent(Channels channel, const Event &event); /** * Scrolls the chat window diff --git a/src/gui/confirmdialog.cpp b/src/gui/confirmdialog.cpp index cf9d541ad..22acf5116 100644 --- a/src/gui/confirmdialog.cpp +++ b/src/gui/confirmdialog.cpp @@ -112,4 +112,3 @@ void ConfirmDialog::action(const gcn::ActionEvent &event) scheduleDelete(); } } - diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp index d13545bea..b65068dc5 100644 --- a/src/gui/debugwindow.cpp +++ b/src/gui/debugwindow.cpp @@ -62,7 +62,7 @@ DebugWindow::DebugWindow(): setSaveVisible(true); setStickyButtonLock(true); - setDefaultSize(400, 150, ImageRect::CENTER); + setDefaultSize(400, 300, ImageRect::CENTER); mTabs = new TabbedArea; mMapWidget = new MapDebugTab; @@ -269,9 +269,10 @@ TargetDebugTab::TargetDebugTab() mTargetLabel = new Label(strprintf("%s ?", _("Target:"))); mTargetIdLabel = new Label(strprintf("%s ? ", _("Target Id:"))); - mTargetLevelLabel = new Label(strprintf("%s ?", _("Target Level:"))); - mTargetPartyLabel = new Label(strprintf("%s ?", _("Target Party:"))); - mTargetGuildLabel = new Label(strprintf("%s ?", _("Target Guild:"))); + mTargetLevelLabel = new Label(strprintf("%s ?", _("Target level:"))); + mTargetRaceLabel = new Label(strprintf("%s ?", _("Target race:"))); + mTargetPartyLabel = new Label(strprintf("%s ?", _("Target party:"))); + mTargetGuildLabel = new Label(strprintf("%s ?", _("Target guild:"))); mAttackDelayLabel = new Label(strprintf("%s ?", _("Attack delay:"))); mMinHitLabel = new Label(strprintf("%s ?", _("Minimal hit:"))); mMaxHitLabel = new Label(strprintf("%s ?", _("Maximum hit:"))); @@ -280,12 +281,13 @@ TargetDebugTab::TargetDebugTab() place(0, 0, mTargetLabel, 2); place(0, 1, mTargetIdLabel, 2); place(0, 2, mTargetLevelLabel, 2); - place(0, 3, mAttackDelayLabel, 2); - place(0, 4, mTargetPartyLabel, 2); - place(0, 5, mTargetGuildLabel, 2); - place(0, 6, mMinHitLabel, 2); - place(0, 7, mMaxHitLabel, 2); - place(0, 8, mCriticalHitLabel, 2); + place(0, 3, mTargetRaceLabel, 2); + place(0, 4, mAttackDelayLabel, 2); + place(0, 5, mTargetPartyLabel, 2); + place(0, 6, mTargetGuildLabel, 2); + place(0, 7, mMinHitLabel, 2); + place(0, 8, mMaxHitLabel, 2); + place(0, 9, mCriticalHitLabel, 2); place.getCell().matchColWidth(0, 0); place = h.getPlacer(0, 1); @@ -315,6 +317,9 @@ void TargetDebugTab::logic() _("Target Level:"))); } + mTargetRaceLabel->setCaption(strprintf("%s %s", + _("Target race:"), target->getRaceName().c_str())); + mTargetPartyLabel->setCaption(strprintf("%s %s", _("Target Party:"), target->getPartyName().c_str())); @@ -396,4 +401,4 @@ void NetDebugTab::logic() PacketCounters::getInBytes())); mOutPackets1Label->setCaption(strprintf(_("Out: %d bytes/s"), PacketCounters::getOutBytes())); -}
\ No newline at end of file +} diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h index ff86eaf74..8be6f1220 100644 --- a/src/gui/debugwindow.h +++ b/src/gui/debugwindow.h @@ -82,6 +82,7 @@ class TargetDebugTab : public DebugTab Label *mTargetLabel; Label *mTargetIdLabel; Label *mTargetLevelLabel; + Label *mTargetRaceLabel; Label *mTargetPartyLabel; Label *mTargetGuildLabel; Label *mAttackDelayLabel; diff --git a/src/gui/didyouknowwindow.cpp b/src/gui/didyouknowwindow.cpp index db0878360..a6b89923e 100644 --- a/src/gui/didyouknowwindow.cpp +++ b/src/gui/didyouknowwindow.cpp @@ -22,6 +22,7 @@ #include "gui/didyouknowwindow.h" +#include "configuration.h" #include "logger.h" #include "gui/gui.h" @@ -34,9 +35,9 @@ #include "gui/widgets/scrollarea.h" #include "resources/resourcemanager.h" -#include "configuration.h" #include "utils/gettext.h" +#include "utils/langs.h" #include "debug.h" diff --git a/src/gui/emotepopup.cpp b/src/gui/emotepopup.cpp index a286f78e8..39017ac91 100644 --- a/src/gui/emotepopup.cpp +++ b/src/gui/emotepopup.cpp @@ -197,12 +197,15 @@ void EmotePopup::recalculateSize() ++mRowCount; if (mRowCount) + { mColumnCount = emoteCount / mRowCount; + if (emoteCount % mRowCount > 0) + ++ mColumnCount; + } else + { mColumnCount = 1; - - if (emoteCount % mRowCount > 0) - ++mColumnCount; + } setContentSize(mColumnCount * gridWidth, mRowCount * gridHeight); } diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 1d8b45872..f8d68a672 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -42,6 +42,8 @@ #include "resources/imageloader.h" #include "resources/resourcemanager.h" +#include "utils/langs.h" + #include <guichan/exception.hpp> #include <guichan/image.hpp> diff --git a/src/gui/helpwindow.cpp b/src/gui/helpwindow.cpp index a099c7a7a..5876667da 100644 --- a/src/gui/helpwindow.cpp +++ b/src/gui/helpwindow.cpp @@ -36,6 +36,7 @@ #include "configuration.h" #include "utils/gettext.h" +#include "utils/langs.h" #include "debug.h" diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 23f1e6fcf..8c59d10eb 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -113,7 +113,7 @@ InventoryWindow::InventoryWindow(Inventory *inventory): setWindowName("Inventory"); } - listen(Mana::CHANNEL_ATTRIBUTES); + listen(CHANNEL_ATTRIBUTES); if (setupWindow) setupWindow->registerWindowForReset(this); @@ -585,10 +585,10 @@ void InventoryWindow::close() } } -void InventoryWindow::processEvent(Mana::Channels channel A_UNUSED, - const Mana::Event &event) +void InventoryWindow::processEvent(Channels channel A_UNUSED, + const Event &event) { - if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) + if (event.getName() == EVENT_UPDATEATTRIBUTE) { int id = event.getInt("id"); if (id == TOTAL_WEIGHT || id == MAX_WEIGHT) diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index 9d4be5afc..08456ba29 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -54,7 +54,7 @@ class InventoryWindow : public Window, public gcn::KeyListener, public gcn::SelectionListener, public InventoryListener, - public Mana::Listener + public Listener { public: /** @@ -126,7 +126,7 @@ class InventoryWindow : public Window, void updateDropButton(); - void processEvent(Mana::Channels channel, const Mana::Event &event); + void processEvent(Channels channel, const Event &event); void updateButtons(Item *item = nullptr); diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index 9a9e5f50d..d96aa564f 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -282,4 +282,4 @@ void ItemPopup::mouseMoved(gcn::MouseEvent &event) setVisible(false); mLastName = ""; mLastColor = 1; -}
\ No newline at end of file +} diff --git a/src/gui/killstats.cpp b/src/gui/killstats.cpp index 972c660ec..357a016f2 100644 --- a/src/gui/killstats.cpp +++ b/src/gui/killstats.cpp @@ -60,7 +60,7 @@ KillStats::KillStats(): setStickyButtonLock(true); setDefaultSize(250, 250, 350, 300); - listen(Mana::CHANNEL_ATTRIBUTES); + listen(CHANNEL_ATTRIBUTES); int xp(PlayerInfo::getAttribute(EXP)); int xpNextLevel(PlayerInfo::getAttribute(EXP_NEEDED)); @@ -438,10 +438,10 @@ void KillStats::validateJacko() } } -void KillStats::processEvent(Mana::Channels channel A_UNUSED, - const Mana::Event &event) +void KillStats::processEvent(Channels channel A_UNUSED, + const Event &event) { - if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) + if (event.getName() == EVENT_UPDATEATTRIBUTE) { int id = event.getInt("id"); if (id == EXP || id == EXP_NEEDED) diff --git a/src/gui/killstats.h b/src/gui/killstats.h index 8562e67a4..9773190de 100644 --- a/src/gui/killstats.h +++ b/src/gui/killstats.h @@ -33,7 +33,7 @@ class Label; class Button; -class KillStats : public Window, gcn::ActionListener, public Mana::Listener +class KillStats : public Window, gcn::ActionListener, public Listener { public: /** @@ -78,8 +78,8 @@ class KillStats : public Window, gcn::ActionListener, public Mana::Listener void addLog(std::string str); - void processEvent(Mana::Channels channel A_UNUSED, - const Mana::Event &event); + void processEvent(Channels channel A_UNUSED, + const Event &event); private: void validateJacko(); diff --git a/src/gui/logindialog.cpp b/src/gui/logindialog.cpp index ef8fd6bf0..cafc4f72c 100644 --- a/src/gui/logindialog.cpp +++ b/src/gui/logindialog.cpp @@ -41,6 +41,7 @@ #include "net/net.h" #include "utils/gettext.h" +#include "utils/paths.h" #include "utils/stringutils.h" #include "debug.h" diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp index 00df97813..aaccd36c8 100644 --- a/src/gui/ministatuswindow.cpp +++ b/src/gui/ministatuswindow.cpp @@ -54,7 +54,7 @@ extern volatile int tick_time; MiniStatusWindow::MiniStatusWindow(): Popup("MiniStatus", "ministatus.xml") { - listen(Mana::CHANNEL_ATTRIBUTES); + listen(CHANNEL_ATTRIBUTES); mHpBar = createBar(0, 100, 20, Theme::PROG_HP, "hp bar", _("health bar")); StatusWindow::updateHPBar(mHpBar); @@ -218,10 +218,10 @@ void MiniStatusWindow::drawIcons(Graphics *graphics) } } -void MiniStatusWindow::processEvent(Mana::Channels channel A_UNUSED, - const Mana::Event &event) +void MiniStatusWindow::processEvent(Channels channel A_UNUSED, + const Event &event) { - if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) + if (event.getName() == EVENT_UPDATEATTRIBUTE) { int id = event.getInt("id"); if (id == HP || id == MAX_HP) @@ -235,7 +235,7 @@ void MiniStatusWindow::processEvent(Mana::Channels channel A_UNUSED, else if (id == MONEY) StatusWindow::updateMoneyBar(mMoneyBar); } - else if (event.getName() == Mana::EVENT_UPDATESTAT) + else if (event.getName() == EVENT_UPDATESTAT) { StatusWindow::updateMPBar(mMpBar); StatusWindow::updateJobBar(mJobBar); diff --git a/src/gui/ministatuswindow.h b/src/gui/ministatuswindow.h index ca18e1b92..eb6ded7dd 100644 --- a/src/gui/ministatuswindow.h +++ b/src/gui/ministatuswindow.h @@ -27,7 +27,6 @@ #include "listener.h" #include "gui/widgets/popup.h" -#include "gui/widgets/window.h" #include <vector> @@ -44,7 +43,7 @@ class TextPopup; */ class MiniStatusWindow : public Popup, public InventoryListener, - public Mana::Listener + public Listener { public: MiniStatusWindow(); @@ -60,7 +59,7 @@ class MiniStatusWindow : public Popup, void drawIcons(Graphics *graphics); - void processEvent(Mana::Channels channel, const Mana::Event &event); + void processEvent(Channels channel, const Event &event); void updateStatus(); diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp index 6bcb62baf..b2ffb312c 100644 --- a/src/gui/npcpostdialog.cpp +++ b/src/gui/npcpostdialog.cpp @@ -128,4 +128,4 @@ void NpcPostDialog::closeAll() for (; it != it_end; ++it) (*it)->close(); -}
\ No newline at end of file +} diff --git a/src/gui/palette.cpp b/src/gui/palette.cpp index fe14cd2d4..3b36fa6ce 100644 --- a/src/gui/palette.cpp +++ b/src/gui/palette.cpp @@ -39,7 +39,8 @@ const gcn::Color Palette::BLACK = gcn::Color(0, 0, 0); Palette::Palettes Palette::mInstances; -const gcn::Color Palette::RAINBOW_COLORS[7] = { +const gcn::Color Palette::RAINBOW_COLORS[7] = +{ gcn::Color(255, 0, 0), gcn::Color(255, 153, 0), gcn::Color(255, 255, 0), @@ -48,6 +49,7 @@ const gcn::Color Palette::RAINBOW_COLORS[7] = { gcn::Color(51, 0, 153), gcn::Color(153, 0, 153) }; + /** Number of Elemets of RAINBOW_COLORS */ const int Palette::RAINBOW_COLOR_COUNT = 7; diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 142acc69c..c987843d3 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -35,6 +35,7 @@ #include "localplayer.h" #include "logger.h" #include "map.h" +#include "maplayer.h" #include "party.h" #include "playerinfo.h" #include "playerrelations.h" diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp index 0e69db026..7e0114cb8 100644 --- a/src/gui/sdlfont.cpp +++ b/src/gui/sdlfont.cpp @@ -27,6 +27,7 @@ #include "graphics.h" #include "logger.h" #include "main.h" +#include "utils/paths.h" #include "resources/image.h" #include "resources/resourcemanager.h" @@ -98,7 +99,7 @@ typedef std::list<SDLTextChunk>::iterator CacheIterator; static int fontCounter; -SDLFont::SDLFont(const std::string &filename, int size, int style) : +SDLFont::SDLFont(std::string filename, int size, int style) : mCreateCounter(0), mDeleteCounter(0) { @@ -117,13 +118,16 @@ SDLFont::SDLFont(const std::string &filename, int size, int style) : } ++fontCounter; + + fixDirSeparators(filename); mFont = TTF_OpenFont(resman->getPath(filename).c_str(), size); if (!mFont) { logger->log("Error finding font " + filename); + std::string backFile = "fonts/dejavusans.ttf"; mFont = TTF_OpenFont(resman->getPath( - "fonts/dejavusans.ttf").c_str(), size); + fixDirSeparators(backFile)).c_str(), size); if (!mFont) { throw GCN_EXCEPTION("SDLSDLFont::SDLSDLFont: " + @@ -148,7 +152,7 @@ SDLFont::~SDLFont() } } -void SDLFont::loadFont(const std::string &filename, int size, int style) +void SDLFont::loadFont(std::string filename, int size, int style) { ResourceManager *resman = ResourceManager::getInstance(); @@ -159,6 +163,7 @@ void SDLFont::loadFont(const std::string &filename, int size, int style) return; } + fixDirSeparators(filename); TTF_Font *font = TTF_OpenFont(resman->getPath(filename).c_str(), size); if (!font) diff --git a/src/gui/sdlfont.h b/src/gui/sdlfont.h index 6fcad34d4..77e3761e7 100644 --- a/src/gui/sdlfont.h +++ b/src/gui/sdlfont.h @@ -53,14 +53,14 @@ class SDLFont : public gcn::Font * @param filename Font filename. * @param size Font size. */ - SDLFont(const std::string &filename, int size, int style = 0); + SDLFont(std::string filename, int size, int style = 0); /** * Destructor. */ ~SDLFont(); - void loadFont(const std::string &filename, int size, int style = 0); + void loadFont(std::string filename, int size, int style = 0); void createSDLTextChunk(SDLTextChunk *chunk); diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 59bdf9660..da61e105b 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -46,9 +46,9 @@ #include "net/net.h" #include "utils/gettext.h" +#include "utils/langs.h" #include "utils/stringutils.h" #include "utils/xml.h" -#include "widgets/dropdown.h" #include <guichan/font.hpp> @@ -283,14 +283,10 @@ ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir): // Do this manually instead of calling reflowLayout so we can enforce a // minimum width. - int width = 0, height = 0; - getLayout().reflow(width, height); - if (width < 400) - { - width = 400; - getLayout().reflow(width, height); - } + int width = 500; + int height = 350; + getLayout().reflow(width, height); setContentSize(width, height); setMinWidth(getWidth()); @@ -309,7 +305,7 @@ ServerDialog::ServerDialog(ServerInfo *serverInfo, const std::string &dir): loadServers(true); - if (mServers.empty()) + if (needUpdateServers()) downloadServerList(); } @@ -488,13 +484,17 @@ void ServerDialog::downloadServerList() } mDownload = new Net::Download(this, listFile, &downloadUpdate); - mDownload->setFile(mDir + "/serverlist.xml"); + mDownload->setFile(mDir + "/" + branding.getStringValue( + "onlineServerFile")); mDownload->start(); + + config.setValue("serverslistupdate", getDateString()); } void ServerDialog::loadServers(bool addNew) { - XML::Document doc(mDir + "/serverlist.xml", false); + XML::Document doc(mDir + "/" + branding.getStringValue( + "onlineServerFile"), false); XmlNodePtr rootNode = doc.rootNode(); if (!rootNode || !xmlNameEqual(rootNode, "serverlist")) @@ -744,3 +744,14 @@ void ServerDialog::updateServer(ServerInfo server, int index) { saveCustomServers(server, index); } + +bool ServerDialog::needUpdateServers() +{ + if (mServers.empty() || config.getStringValue("serverslistupdate") + != getDateString()) + { + return true; + } + + return false; +} diff --git a/src/gui/serverdialog.h b/src/gui/serverdialog.h index c23fb8776..61620364c 100644 --- a/src/gui/serverdialog.h +++ b/src/gui/serverdialog.h @@ -138,12 +138,16 @@ class ServerDialog : public Window, * Called to load a list of available server from an online xml file. */ void downloadServerList(); + void loadServers(bool addNew = true); void loadCustomServers(); + void saveCustomServers(const ServerInfo ¤tServer = ServerInfo(), int index = -1); + bool needUpdateServers(); + static int downloadUpdate(void *ptr, DownloadStatus status, size_t total, size_t remaining); diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp index f0bf4c0ea..a08517fae 100644 --- a/src/gui/setup_players.cpp +++ b/src/gui/setup_players.cpp @@ -84,6 +84,9 @@ Setup_Players::Setup_Players() new SetupItemCheckBox(_("Allow self heal with mouse click"), "", "selfMouseHeal", this, "selfMouseHealEvent"); + new SetupItemCheckBox(_("Group friends in who is online window"), "", + "groupFriends", this, "groupFriendsEvent"); + setDimension(gcn::Rectangle(0, 0, 550, 350)); } diff --git a/src/gui/setup_relations.cpp b/src/gui/setup_relations.cpp index 571856a14..47d53620c 100644 --- a/src/gui/setup_relations.cpp +++ b/src/gui/setup_relations.cpp @@ -50,7 +50,8 @@ #define RELATION_CHOICE_COLUMN 1 #define ROW_HEIGHT 12 -// The following column widths really shouldn't be hardcoded but should scale with the size of the widget... except +// The following column widths really shouldn't be hardcoded +// but should scale with the size of the widget... except // that, right now, the widget doesn't exactly scale either. #define NAME_COLUMN_WIDTH 230 #define RELATION_CHOICE_COLUMN_WIDTH 80 diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 9a5b30ea7..cc3063a68 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -228,7 +228,6 @@ static const char *speechModeToString(Being::Speech mode) case Being::NAME_IN_BUBBLE: return _("Bubbles with names"); } - return ""; } const char *Setup_Video::overlayDetailToString(int detail) @@ -743,4 +742,4 @@ void Setup_Video::action(const gcn::ActionEvent &event) void Setup_Video::externalUpdated() { -}
\ No newline at end of file +} diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index 4ee674325..430705b1d 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -382,8 +382,8 @@ void SkillDialog::loadSkills(const std::string &file) SkillInfo *skill = new SkillInfo; skill->id = 1; - skill->name = "basic"; - skill->dispName = "Skill: basic, Id: 1"; + skill->name = _("basic"); + skill->dispName = _("Skill: basic, Id: 1"); skill->setIcon(""); skill->modifiable = true; skill->visible = true; @@ -428,14 +428,14 @@ void SkillDialog::loadSkills(const std::string &file) if (xmlNameEqual(node, "skill")) { int id = atoi(XML::getProperty(node, "id", "-1").c_str()); - std::string name = XML::getProperty(node, "name", + std::string name = XML::langProperty(node, "name", strprintf(_("Skill %d"), id)); std::string icon = XML::getProperty(node, "icon", ""); SkillInfo *skill = new SkillInfo; skill->id = static_cast<short unsigned>(id); skill->name = name; - skill->dispName = strprintf("Skill: %s, Id: %d", + skill->dispName = strprintf(_("Skill: %s, Id: %d"), name.c_str(), skill->id); skill->setIcon(icon); skill->modifiable = false; diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index 59ace1685..287089790 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -28,6 +28,7 @@ #include "localplayer.h" #include "logger.h" #include "map.h" +#include "maplayer.h" #include "party.h" #include "playerrelations.h" #include "gui/whoisonline.h" diff --git a/src/gui/spellpopup.cpp b/src/gui/spellpopup.cpp index 66d69b197..48037f03e 100644 --- a/src/gui/spellpopup.cpp +++ b/src/gui/spellpopup.cpp @@ -114,8 +114,6 @@ void SpellPopup::view(int x, int y) { if (y > getHeight() + distance) posY = y - getHeight() - distance; - else - y = 0; } setPosition(posX, posY); diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 86964383a..1964b974d 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -126,7 +126,7 @@ StatusWindow::StatusWindow(): Window(player_node ? player_node->getName() : "?", false, nullptr, "status.xml") { - listen(Mana::CHANNEL_ATTRIBUTES); + listen(CHANNEL_ATTRIBUTES); setWindowName("Status"); setupWindow->registerWindowForReset(this); @@ -135,7 +135,13 @@ StatusWindow::StatusWindow(): setSaveVisible(true); setStickyButtonLock(true); setDefaultSize((windowContainer->getWidth() - 480) / 2, - (windowContainer->getHeight() - 500) / 2, 480, 500); + (windowContainer->getHeight() - 500) / 2, 480, 500); + + if (player_node && !player_node->getRaceName().empty()) + { + setCaption(strprintf("%s (%s)", player_node->getName().c_str(), + player_node->getRaceName().c_str())); + } // ---------------------- // Status Part @@ -277,16 +283,16 @@ StatusWindow::StatusWindow(): mLvlLabel->adjustSize(); } -void StatusWindow::processEvent(Mana::Channels channel A_UNUSED, - const Mana::Event &event) +void StatusWindow::processEvent(Channels channel A_UNUSED, + const Event &event) { static bool blocked = false; if (blocked) return; - if (event.getName() == Mana::EVENT_UPDATEATTRIBUTE) + if (event.getName() == EVENT_UPDATEATTRIBUTE) { - switch(event.getInt("id")) + switch (event.getInt("id")) { case HP: case MAX_HP: updateHPBar(mHpBar, true); @@ -343,7 +349,7 @@ void StatusWindow::processEvent(Mana::Channels channel A_UNUSED, break; } } - else if (event.getName() == Mana::EVENT_UPDATESTAT) + else if (event.getName() == EVENT_UPDATESTAT) { int id = event.getInt("id"); if (id == Net::getPlayerHandler()->getJobLocation()) diff --git a/src/gui/statuswindow.h b/src/gui/statuswindow.h index 8e110a354..7f6bd2d18 100644 --- a/src/gui/statuswindow.h +++ b/src/gui/statuswindow.h @@ -44,7 +44,7 @@ class VertContainer; */ class StatusWindow : public Window, public gcn::ActionListener, - public Mana::Listener + public Listener { public: /** @@ -52,7 +52,7 @@ class StatusWindow : public Window, */ StatusWindow(); - void processEvent(Mana::Channels channel, const Mana::Event &event); + void processEvent(Channels channel, const Event &event); void setPointsNeeded(int id, int needed); diff --git a/src/gui/textdialog.cpp b/src/gui/textdialog.cpp index b30c9eb82..d7d3d5eeb 100644 --- a/src/gui/textdialog.cpp +++ b/src/gui/textdialog.cpp @@ -126,4 +126,4 @@ void TextDialog::close() { keyboard.setEnabled(mEnabledKeyboard); scheduleDelete(); -}
\ No newline at end of file +} diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp index 28bd8467c..3aaf93557 100644 --- a/src/gui/updaterwindow.cpp +++ b/src/gui/updaterwindow.cpp @@ -42,6 +42,7 @@ #include "resources/resourcemanager.h" #include "utils/gettext.h" +#include "utils/paths.h" #include "utils/stringutils.h" #include "utils/xml.h" diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 7ff2c8850..d4c188bfb 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -31,6 +31,7 @@ #include "keyboardconfig.h" #include "localplayer.h" #include "map.h" +#include "maplayer.h" #include "textmanager.h" #include "gui/beingpopup.h" @@ -878,7 +879,7 @@ bool Viewport::isPopupMenuVisible() void Viewport::moveCameraToActor(int actorId, int x, int y) { - if (!player_node) + if (!player_node || !actorSpriteManager) return; Actor *actor = actorSpriteManager->findBeing(actorId); diff --git a/src/gui/viewport.h b/src/gui/viewport.h index f3035b5df..ccb8124ba 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -90,7 +90,9 @@ class Viewport : public WindowContainer, public gcn::MouseListener, void logic(); /** - * Toggles whether the path debug graphics are shown. normal, debug with all images and grid, debug with out big images and with out grid. + * Toggles whether the path debug graphics are shown. normal, + * debug with all images and grid, debug with out big images + * and with out grid. */ void toggleDebugPath(); diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index 205a1aae1..7e4f02426 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -85,7 +85,8 @@ WhoIsOnline::WhoIsOnline(): mMemoryBuffer(nullptr), mCurlError(new char[CURL_ERROR_SIZE]), mAllowUpdate(true), - mShowLevel(false) + mShowLevel(false), + mGroupFriends(true) { mCurlError[0] = 0; setWindowName("WhoIsOnline"); @@ -124,12 +125,15 @@ WhoIsOnline::WhoIsOnline(): download(); config.addListener("updateOnlineList", this); + config.addListener("groupFriends", this); mUpdateOnlineList = config.getBoolValue("updateOnlineList"); + mGroupFriends = config.getBoolValue("groupFriends"); } WhoIsOnline::~WhoIsOnline() { config.removeListener("updateOnlineList", this); + config.removeListener("groupFriends", this); if (mThread && SDL_GetThreadID(mThread)) SDL_WaitThread(mThread, nullptr); @@ -138,7 +142,7 @@ WhoIsOnline::~WhoIsOnline() mMemoryBuffer = nullptr; // Remove possibly leftover temporary download - delete[] mCurlError; + delete []mCurlError; std::set<OnlinePlayer*>::iterator itd = mOnlinePlayers.begin(); std::set<OnlinePlayer*>::iterator itd_end = mOnlinePlayers.end(); @@ -226,7 +230,7 @@ void WhoIsOnline::updateWindow(std::vector<OnlinePlayer*> &friends, if (addedFromSection == true && !disregard.empty()) { mBrowserBox->addRow("---"); - addedFromSection = false; +// addedFromSection = false; } for (int i = 0; i < static_cast<int>(disregard.size()); i++) { @@ -282,7 +286,10 @@ void WhoIsOnline::loadList(std::vector<OnlinePlayer*> &list) case PlayerRelation::FRIEND: player->setText("2"); - friends.push_back(player); + if (mGroupFriends) + friends.push_back(player); + else + neutral.push_back(player); break; case PlayerRelation::DISREGARDED: @@ -425,7 +432,10 @@ void WhoIsOnline::loadWebList() case PlayerRelation::FRIEND: player->setText("2"); - friends.push_back(player); + if (mGroupFriends) + friends.push_back(player); + else + neutral.push_back(player); break; case PlayerRelation::DISREGARDED: @@ -716,12 +726,13 @@ void WhoIsOnline::optionChanged(const std::string &name) { if (name == "updateOnlineList") mUpdateOnlineList = config.getBoolValue("updateOnlineList"); + else if (name == "groupFriends") + mGroupFriends = config.getBoolValue("groupFriends"); } void OnlinePlayer::setText(std::string color) { - mText = strprintf("@@%s|##%s%s ", mNick.c_str(), - color.c_str(), mNick.c_str()); + mText = ""; if (mStatus != 255 && actorSpriteManager) { @@ -753,10 +764,13 @@ void OnlinePlayer::setText(std::string color) // TRANSLATORS: this inactive status writed in player nick mText += _("I"); } + if (mStatus & Being::FLAG_GM && color == "0") + color = "2"; } if (mVersion > 0) mText += strprintf(" - %d", mVersion); - mText += strprintf("@@"); + mText = strprintf("@@%s|##%s%s %s@@", mNick.c_str(), + color.c_str(), mNick.c_str(), mText.c_str()); } diff --git a/src/gui/whoisonline.h b/src/gui/whoisonline.h index dad51e857..1607286a9 100644 --- a/src/gui/whoisonline.h +++ b/src/gui/whoisonline.h @@ -201,6 +201,7 @@ private: bool mAllowUpdate; bool mShowLevel; bool mUpdateOnlineList; + bool mGroupFriends; }; extern WhoIsOnline *whoIsOnline; diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 1bf897301..822e71805 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -26,6 +26,7 @@ #include "graphics.h" #include "guild.h" #include "localplayer.h" +#include "maplayer.h" #include "gui/chatwindow.h" #include "gui/gui.h" @@ -402,4 +403,4 @@ void AvatarListBox::optionChanged(const std::string &value) mShowGender = config.getBoolValue("showgender"); else if (value == "showlevel") mShowLevel = config.getBoolValue("showlevel"); -}
\ No newline at end of file +} diff --git a/src/gui/widgets/battletab.h b/src/gui/widgets/battletab.h index 8d85e739e..2a034a166 100644 --- a/src/gui/widgets/battletab.h +++ b/src/gui/widgets/battletab.h @@ -43,6 +43,3 @@ class BattleTab : public ChatTab extern BattleTab *battleChatTab; #endif - - - diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp index 6d5dfc9dd..018e35030 100644 --- a/src/gui/widgets/chattab.cpp +++ b/src/gui/widgets/chattab.cpp @@ -467,4 +467,4 @@ void ChatTab::addNewRow(std::string &line) addRow(line); } mScrollArea->logic(); -}
\ No newline at end of file +} diff --git a/src/gui/widgets/container.cpp b/src/gui/widgets/container.cpp index 80028a62f..106112956 100644 --- a/src/gui/widgets/container.cpp +++ b/src/gui/widgets/container.cpp @@ -47,4 +47,4 @@ bool Container::safeRemove(gcn::Widget* widget) } } return false; -}
\ No newline at end of file +} diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index a769678ca..5896042fa 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -102,4 +102,3 @@ class DropDown : public gcn::DropDown }; #endif // end DROPDOWN_H - diff --git a/src/gui/widgets/inventoryfilter.cpp b/src/gui/widgets/inventoryfilter.cpp index 216c2bea0..515682cb6 100644 --- a/src/gui/widgets/inventoryfilter.cpp +++ b/src/gui/widgets/inventoryfilter.cpp @@ -58,4 +58,4 @@ void InventoryFilter::action(const gcn::ActionEvent &event) { (*iter)->action(event); } -}
\ No newline at end of file +} diff --git a/src/gui/widgets/layout.h b/src/gui/widgets/layout.h index 046d09b59..3c42554b6 100644 --- a/src/gui/widgets/layout.h +++ b/src/gui/widgets/layout.h @@ -37,8 +37,8 @@ class LayoutCell; class ContainerPlacer { public: - ContainerPlacer(gcn::Container *c = nullptr, LayoutCell *l = nullptr): - mContainer(c), mCell(l) + ContainerPlacer(gcn::Container *c = nullptr, LayoutCell *lc = nullptr): + mContainer(c), mCell(lc) {} /** diff --git a/src/gui/widgets/setupitem.cpp b/src/gui/widgets/setupitem.cpp index 059b05ba2..56ce0a25a 100644 --- a/src/gui/widgets/setupitem.cpp +++ b/src/gui/widgets/setupitem.cpp @@ -455,7 +455,6 @@ void SetupItemIntTextField::apply(std::string eventName) } - SetupItemLabel::SetupItemLabel(std::string text, std::string description, SetupTabScroll *parent, bool separator) : SetupItem(text, description, "", parent, "", "", true), diff --git a/src/gui/widgets/setuptab.cpp b/src/gui/widgets/setuptab.cpp index b3863c134..d4ae46eb8 100644 --- a/src/gui/widgets/setuptab.cpp +++ b/src/gui/widgets/setuptab.cpp @@ -31,4 +31,4 @@ SetupTab::SetupTab() void SetupTab::externalUpdated() { -}
\ No newline at end of file +} diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 71e373d70..ab6400149 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -191,4 +191,4 @@ void ShopListBox::mouseExited(gcn::MouseEvent& mouseEvent A_UNUSED) return; mItemPopup->hide(); -}
\ No newline at end of file +} diff --git a/src/gui/widgets/slider.cpp b/src/gui/widgets/slider.cpp index ed667e194..c6b57858c 100644 --- a/src/gui/widgets/slider.cpp +++ b/src/gui/widgets/slider.cpp @@ -298,4 +298,3 @@ void Slider::mouseExited(gcn::MouseEvent& event A_UNUSED) { mHasMouse = false; } - diff --git a/src/gui/widgets/tablemodel.cpp b/src/gui/widgets/tablemodel.cpp index 5216fb89c..bc5d2ead6 100644 --- a/src/gui/widgets/tablemodel.cpp +++ b/src/gui/widgets/tablemodel.cpp @@ -173,4 +173,3 @@ int StaticTableModel::getHeight() const { return mColumns * mHeight; } - diff --git a/src/gui/widgets/textbox.cpp b/src/gui/widgets/textbox.cpp index a4bc3bc09..575036612 100644 --- a/src/gui/widgets/textbox.cpp +++ b/src/gui/widgets/textbox.cpp @@ -116,14 +116,14 @@ void TextBox::setTextWrapped(const std::string &text, int minDimension) mMinWidth = minWidth; wrappedStream.clear(); wrappedStream.str(""); - spacePos = 0; +// spacePos = 0; lastNewlinePos = 0; newlinePos = text.find("\n", lastNewlinePos); if (newlinePos == std::string::npos) newlinePos = text.size(); line = text.substr(lastNewlinePos, newlinePos - lastNewlinePos); - width = 0; +// width = 0; break; } else diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 4dba2eb57..e207b0613 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -208,29 +208,29 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) } else if (!mMaximum || mText.size() < mMaximum) { - int l; + int len; if (val < 128) - l = 1; // 0xxxxxxx + len = 1; // 0xxxxxxx else if (val < 0x800) - l = 2; // 110xxxxx 10xxxxxx + len = 2; // 110xxxxx 10xxxxxx else if (val < 0x10000) - l = 3; // 1110xxxx 10xxxxxx 10xxxxxx + len = 3; // 1110xxxx 10xxxxxx 10xxxxxx else - l = 4; // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx + len = 4; // 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx char buf[4]; - for (int i = 0; i < l; ++i) + for (int i = 0; i < len; ++ i) { - buf[i] = static_cast<char>(val >> (6 * (l - i - 1))); + buf[i] = static_cast<char>(val >> (6 * (len - i - 1))); if (i > 0) buf[i] = static_cast<char>((buf[i] & 63) | 128); } - if (l > 1) - buf[0] |= static_cast<char>(255 << (8 - l)); + if (len > 1) + buf[0] |= static_cast<char>(255 << (8 - len)); - mText.insert(mCaretPosition, std::string(buf, buf + l)); - mCaretPosition += l; + mText.insert(mCaretPosition, std::string(buf, buf + len)); + mCaretPosition += len; } } diff --git a/src/gui/widgets/tradetab.h b/src/gui/widgets/tradetab.h index 06add3ee0..44922c31a 100644 --- a/src/gui/widgets/tradetab.h +++ b/src/gui/widgets/tradetab.h @@ -46,6 +46,3 @@ class TradeTab : public ChatTab extern TradeTab *tradeChatTab; #endif - - - |