diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-11-03 10:18:25 -0700 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-11-03 10:18:25 -0700 |
commit | acd557f9472c711fe92b9c158ec336abf688bf7b (patch) | |
tree | 2295d13589411ee88afe16f4997bea65b4ebba94 /src/gui | |
parent | c60d3a98dbbb20621742bfd82bbaaa6b7085a8ae (diff) | |
download | mana-acd557f9472c711fe92b9c158ec336abf688bf7b.tar.gz mana-acd557f9472c711fe92b9c158ec336abf688bf7b.tar.bz2 mana-acd557f9472c711fe92b9c158ec336abf688bf7b.tar.xz mana-acd557f9472c711fe92b9c158ec336abf688bf7b.zip |
Remove more _SUPPORT ifdefs and do some cleanup
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/buddywindow.h | 2 | ||||
-rw-r--r-- | src/gui/guildwindow.cpp | 10 | ||||
-rw-r--r-- | src/gui/inventorywindow.h | 6 | ||||
-rw-r--r-- | src/gui/itemamount.h | 2 | ||||
-rw-r--r-- | src/gui/playerbox.cpp | 14 | ||||
-rw-r--r-- | src/gui/serverdialog.cpp | 14 | ||||
-rw-r--r-- | src/gui/statuswindow.cpp | 92 | ||||
-rw-r--r-- | src/gui/statuswindow.h | 4 | ||||
-rw-r--r-- | src/gui/storagewindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/storagewindow.h | 6 | ||||
-rw-r--r-- | src/gui/table.h | 2 | ||||
-rw-r--r-- | src/gui/tablemodel.h | 2 | ||||
-rw-r--r-- | src/gui/trade.cpp | 7 | ||||
-rw-r--r-- | src/gui/widgets/radiobutton.h | 2 |
14 files changed, 76 insertions, 89 deletions
diff --git a/src/gui/buddywindow.h b/src/gui/buddywindow.h index fdcfb36b..0057ac1d 100644 --- a/src/gui/buddywindow.h +++ b/src/gui/buddywindow.h @@ -57,4 +57,4 @@ class BuddyWindow : public Window, public gcn::ActionListener std::list<Avatar*> mBuddyList; }; -#endif /* BUDDYWINDOW_H */ +#endif // BUDDYWINDOW_H diff --git a/src/gui/guildwindow.cpp b/src/gui/guildwindow.cpp index 9cebc4e1..83ff12a1 100644 --- a/src/gui/guildwindow.cpp +++ b/src/gui/guildwindow.cpp @@ -132,7 +132,7 @@ void GuildWindow::action(const gcn::ActionEvent &event) short guild = getSelectedGuild(); if (guild) { - Net::ChatServer::Guild::quitGuild(guild); + ManaServ::ChatServer::Guild::quitGuild(guild); localChatTab->chatLog(strprintf(_("Guild %s quit."), mGuildTabs->getSelectedTab()->getCaption().c_str()), BY_SERVER); } @@ -146,7 +146,7 @@ void GuildWindow::action(const gcn::ActionEvent &event) return; } // Process guild name to be created, and unfocus. - Net::ChatServer::Guild::createGuild(name); + ManaServ::ChatServer::Guild::createGuild(name); // Defocus dialog mFocus = false; @@ -160,7 +160,7 @@ void GuildWindow::action(const gcn::ActionEvent &event) short selectedGuild = getSelectedGuild(); // Process invited user to be created and unfocus. - Net::ChatServer::Guild::invitePlayer(name, selectedGuild); + ManaServ::ChatServer::Guild::invitePlayer(name, selectedGuild); // Defocus dialog mFocus = false; @@ -170,7 +170,7 @@ void GuildWindow::action(const gcn::ActionEvent &event) else if (eventId == "yes") { logger->log("Sending invitation acceptance."); - Net::ChatServer::Guild::acceptInvite(invitedGuild); + ManaServ::ChatServer::Guild::acceptInvite(invitedGuild); } } @@ -253,7 +253,7 @@ void GuildWindow::openAcceptDialog(const std::string &inviterName, void GuildWindow::requestMemberList(short guildId) { // Get the list of members for displaying in the guild window. - Net::ChatServer::Guild::getGuildMembers(guildId); + ManaServ::ChatServer::Guild::getGuildMembers(guildId); } void GuildWindow::removeTab(int guildId) diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index fbda5ac7..d7e82bd1 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -26,6 +26,9 @@ #include "inventory.h" +#include "net/inventoryhandler.h" +#include "net/net.h" + #include <guichan/actionlistener.hpp> #include <guichan/keylistener.hpp> #include <guichan/selectionlistener.hpp> @@ -49,7 +52,8 @@ class InventoryWindow : public Window, /** * Constructor. */ - InventoryWindow(int invSize = (INVENTORY_SIZE)); + InventoryWindow(int invSize = Net::getInventoryHandler() + ->getInventorySize()); /** * Destructor. diff --git a/src/gui/itemamount.h b/src/gui/itemamount.h index 72db3444..20d25562 100644 --- a/src/gui/itemamount.h +++ b/src/gui/itemamount.h @@ -101,4 +101,4 @@ class ItemAmountWindow : public Window, bool mEnabledKeyboard; }; -#endif /* ITEM_AMOUNT_WINDOW_H */ +#endif // ITEM_AMOUNT_WINDOW_H diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp index aecca0c6..70af6690 100644 --- a/src/gui/playerbox.cpp +++ b/src/gui/playerbox.cpp @@ -82,21 +82,9 @@ void PlayerBox::draw(gcn::Graphics *graphics) { // Draw character const int bs = getFrameSize(); -//#ifdef MANASERV_SUPPORT const int x = getWidth() / 2 + bs; - const int y = getHeight() - bs - 8; + const int y = getHeight() - bs; mPlayer->draw(static_cast<Graphics*>(graphics), x, y); -/*#else - const int x = getWidth() / 2 - 16 + bs; - const int y = getHeight() / 2 + bs; - for (int i = 0; i < Being::VECTOREND_SPRITE; i++) - { - if (mPlayer->getSprite(i)) - { - mPlayer->getSprite(i)->draw(static_cast<Graphics*>(graphics), x, y); - } - } -#endif*/ } if (config.getValue("guialpha", 0.8) != mAlpha) diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 9051a5f2..16de45a8 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -350,16 +350,12 @@ void ServerDialog::loadServers() { if (xmlStrEqual(server->name, BAD_CAST "server")) { - //check wether the version matches - #ifdef MANASERV_SUPPORT - if (XML::getProperty(server, "type", "unknown") != "MANASERV") - continue; - #endif - - #ifdef EATHENA_SUPPORT - if (XML::getProperty(server, "type", "unknown") != "EATHENA") + //check wether the build matches + if (compareStrI(XML::getProperty(server, "type", "unknown"), + SERVER_BUILD)) + { continue; - #endif + } currentServer.clear(); currentServer.name = XML::getProperty(server, "name", std::string()); diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index de70457d..7d4a612d 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -38,10 +38,6 @@ #include "net/net.h" #include "net/playerhandler.h" -#ifdef EATHENA_SUPPORT -#include "net/ea/protocol.h" -#endif - #include "utils/gettext.h" #include "utils/mathutils.h" #include "utils/stringutils.h" @@ -81,9 +77,7 @@ class ChangeDisplay : public AttrDisplay, gcn::ActionListener int mNeeded; Label *mPoints; -#ifdef MANASERV_SUPPORT Button *mDec; -#endif Button *mInc; }; @@ -131,15 +125,16 @@ StatusWindow::StatusWindow(): // 5, 2 and 6, 2 Job Progress Bar place(1, 2, mMpBar, 4); -#ifdef EATHENA_SUPPORT - mJobLvlLabel = new Label(strprintf(_("Job: %d"), 0)); - mJobLabel = new Label(_("Job:")); - mJobBar = new ProgressBar(0.0f, 80, 15, gcn::Color(220, 135, 203)); + if (Net::getPlayerHandler()->getJobLocation() > 0) + { + mJobLvlLabel = new Label(strprintf(_("Job: %d"), 0)); + mJobLabel = new Label(_("Job:")); + mJobBar = new ProgressBar(0.0f, 80, 15, gcn::Color(220, 135, 203)); - place(5, 0, mJobLvlLabel, 3); - place(5, 2, mJobLabel).setPadding(3); - place(6, 2, mJobBar, 5); -#endif + place(5, 0, mJobLvlLabel, 3); + place(5, 2, mJobLabel).setPadding(3); + place(6, 2, mJobBar, 5); + } // ---------------------- // Stats Part @@ -163,10 +158,12 @@ StatusWindow::StatusWindow(): mCharacterPointsLabel = new Label("C"); place(0, 6, mCharacterPointsLabel, 5); -#ifdef MANASERV_SUPPORT - mCorrectionPointsLabel = new Label("C"); - place(0, 7, mCorrectionPointsLabel, 5); -#endif + + if (Net::getPlayerHandler()->canCorrectAttributes()) + { + mCorrectionPointsLabel = new Label("C"); + place(0, 7, mCorrectionPointsLabel, 5); + } loadWindowState(); @@ -176,17 +173,15 @@ StatusWindow::StatusWindow(): update(MONEY); update(CHAR_POINTS); // This also updates all attributes (none atm) update(LEVEL); -#ifdef EATHENA_SUPPORT - update(JOB); -#endif + int job = Net::getPlayerHandler()->getJobLocation(); + if (job > 0) + { + update(job); + } } std::string StatusWindow::update(int id) { - /*/ TODO get rid of this - if (!player_node) - return "";*/ - if (miniStatusWindow) miniStatusWindow->update(id); @@ -217,29 +212,28 @@ std::string StatusWindow::update(int id) return _("Money"); } -#ifdef EATHENA_SUPPORT - else if (id == JOB) + else if (id == Net::getPlayerHandler()->getJobLocation()) { mJobLvlLabel->setCaption(strprintf(_("Job: %d"), - player_node->getAttributeBase(JOB))); + player_node->getAttributeBase(id))); mJobLvlLabel->adjustSize(); - updateProgressBar(mJobBar, JOB, false); + updateProgressBar(mJobBar, id, false); return _("Job"); } -#endif else if (id == CHAR_POINTS) { mCharacterPointsLabel->setCaption(strprintf(_("Character points: %d"), player_node->getCharacterPoints())); mCharacterPointsLabel->adjustSize(); -#ifdef MANASERV_SUPPORT - mCorrectionPointsLabel->setCaption(strprintf(_("Correction points: %d"), - player_node->getCorrectionPoints())); - mCorrectionPointsLabel->adjustSize(); -#endif + if (Net::getPlayerHandler()->canCorrectAttributes()) + { + mCorrectionPointsLabel->setCaption(strprintf(_("Correction points: %d"), + player_node->getCorrectionPoints())); + mCorrectionPointsLabel->adjustSize(); + } for (Attrs::iterator it = mAttrs.begin(); it != mAttrs.end(); it++) { @@ -490,12 +484,17 @@ ChangeDisplay::ChangeDisplay(int id, const std::string &name): place(6, 0, mInc); place(7, 0, mPoints); -#ifdef MANASERV_SUPPORT - mDec = new Button(_("-"), "dec", this); - mDec->setWidth(mInc->getWidth()); + if (Net::getPlayerHandler()->canCorrectAttributes()) + { + mDec = new Button(_("-"), "dec", this); + mDec->setWidth(mInc->getWidth()); - place(3, 0, mDec); -#endif + place(3, 0, mDec); + } + else + { + mDec = 0; + } update(); } @@ -504,9 +503,8 @@ std::string ChangeDisplay::update() { mPoints->setCaption(toString(mNeeded)); -#ifdef MANASERV_SUPPORT - mDec->setEnabled(player_node->getCorrectionPoints()); -#endif + if (mDec) + mDec->setEnabled(player_node->getCorrectionPoints()); mInc->setEnabled(player_node->getCharacterPoints() >= mNeeded); return AttrDisplay::update(); @@ -521,8 +519,8 @@ void ChangeDisplay::setPointsNeeded(int needed) void ChangeDisplay::action(const gcn::ActionEvent &event) { -#ifdef MANASERV_SUPPORT - if (event.getSource() == mDec) + if (Net::getPlayerHandler()->canCorrectAttributes() && + event.getSource() == mDec) { int newcorpoints = player_node->getCorrectionPoints() - 1; player_node->setCorrectionPoints(newcorpoints); @@ -533,9 +531,7 @@ void ChangeDisplay::action(const gcn::ActionEvent &event) int newmod = player_node->getAttributeEffective(mId) - 1; player_node->setAttributeEffective(mId, newmod); Net::getPlayerHandler()->decreaseAttribute(mId); - } else -#endif - if (event.getSource() == mInc) + } else if (event.getSource() == mInc) { int newpoints = player_node->getCharacterPoints() - 1; player_node->setCharacterPoints(newpoints); diff --git a/src/gui/statuswindow.h b/src/gui/statuswindow.h index 0706a17e..84c74ee7 100644 --- a/src/gui/statuswindow.h +++ b/src/gui/statuswindow.h @@ -79,10 +79,8 @@ class StatusWindow : public Window gcn::Label *mHpLabel, *mMpLabel, *mXpLabel; ProgressBar *mHpBar, *mMpBar, *mXpBar; -#ifdef EATHENA_SUPPORT gcn::Label *mJobLvlLabel, *mJobLabel; ProgressBar *mJobBar; -#endif VertContainer *mAttrCont; ScrollArea *mAttrScroll; @@ -90,9 +88,7 @@ class StatusWindow : public Window ScrollArea *mDAttrScroll; gcn::Label *mCharacterPointsLabel; -#ifdef MANASERV_SUPPORT gcn::Label *mCorrectionPointsLabel; -#endif typedef std::map<int, AttrDisplay*> Attrs; Attrs mAttrs; diff --git a/src/gui/storagewindow.cpp b/src/gui/storagewindow.cpp index f0d00ee7..b0ffa3ff 100644 --- a/src/gui/storagewindow.cpp +++ b/src/gui/storagewindow.cpp @@ -38,8 +38,8 @@ #include "localplayer.h" #include "units.h" +#include "net/inventoryhandler.h" #include "net/net.h" -#include "net/ea/inventoryhandler.h" #include "resources/iteminfo.h" diff --git a/src/gui/storagewindow.h b/src/gui/storagewindow.h index 452ce735..8c890c27 100644 --- a/src/gui/storagewindow.h +++ b/src/gui/storagewindow.h @@ -26,6 +26,9 @@ #include "inventory.h" +#include "net/inventoryhandler.h" +#include "net/net.h" + #include <guichan/actionlistener.hpp> #include <guichan/selectionlistener.hpp> @@ -46,7 +49,8 @@ class StorageWindow : public Window, gcn::ActionListener, /** * Constructor. */ - StorageWindow(int invSize = (STORAGE_SIZE - 1)); + StorageWindow(int invSize = Net::getInventoryHandler() + ->getStorageSize()); /** * Destructor. diff --git a/src/gui/table.h b/src/gui/table.h index 4f3c29c6..d1f445b3 100644 --- a/src/gui/table.h +++ b/src/gui/table.h @@ -182,4 +182,4 @@ private: }; -#endif /* !defined(TABLE_H) */ +#endif // TABLE_H diff --git a/src/gui/tablemodel.h b/src/gui/tablemodel.h index ffaa0557..129d2089 100644 --- a/src/gui/tablemodel.h +++ b/src/gui/tablemodel.h @@ -143,4 +143,4 @@ protected: std::vector<int> mWidths; }; -#endif /* !defined(TABLE_MODEL_H) */ +#endif // TABLE_MODEL_H diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp index 22eefc14..15a4d7e8 100644 --- a/src/gui/trade.cpp +++ b/src/gui/trade.cpp @@ -38,6 +38,7 @@ #include "gui/widgets/textfield.h" #include "gui/widgets/layout.h" +#include "net/inventoryhandler.h" #include "net/net.h" #include "net/tradehandler.h" @@ -56,8 +57,10 @@ TradeWindow::TradeWindow(): Window(_("Trade: You")), - mMyInventory(new Inventory(INVENTORY_SIZE)), - mPartnerInventory(new Inventory(INVENTORY_SIZE)), + mMyInventory(new Inventory(Net::getInventoryHandler() + ->getInventorySize())), + mPartnerInventory(new Inventory(Net::getInventoryHandler() + ->getInventorySize())), mStatus(PROPOSING) { setWindowName("Trade"); diff --git a/src/gui/widgets/radiobutton.h b/src/gui/widgets/radiobutton.h index 57eb3623..8e61776e 100644 --- a/src/gui/widgets/radiobutton.h +++ b/src/gui/widgets/radiobutton.h @@ -76,4 +76,4 @@ class RadioButton : public gcn::RadioButton static Image *radioCheckedHi; }; -#endif /* RADIOBUTTON_H */ +#endif // RADIOBUTTON_H |