diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-03-27 21:13:02 +0100 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-03-27 21:13:02 +0100 |
commit | 60f10c242fc4f99b0ab0f8d8c6d4b4acde0022cd (patch) | |
tree | 2a3f33bb7af2bf88998a5337e1a739ea12712519 | |
parent | 712ca58c011123505c807266dcc8d9d84ca1aa44 (diff) | |
download | mana-60f10c242fc4f99b0ab0f8d8c6d4b4acde0022cd.tar.gz mana-60f10c242fc4f99b0ab0f8d8c6d4b4acde0022cd.tar.bz2 mana-60f10c242fc4f99b0ab0f8d8c6d4b4acde0022cd.tar.xz mana-60f10c242fc4f99b0ab0f8d8c6d4b4acde0022cd.zip |
Clean up of most of the Network pointers
Now that messages can be sent without requiring a pointer to the
Network instance, a lot of cleanup was possible.
37 files changed, 34 insertions, 285 deletions
diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp index ae9ee787..9c671808 100644 --- a/src/beingmanager.cpp +++ b/src/beingmanager.cpp @@ -59,12 +59,9 @@ class FindBeingFunctor Being::Type type; } beingFinder; -#ifdef EATHENA_SUPPORT -BeingManager::BeingManager(Network *network): - mNetwork(network) +BeingManager::BeingManager() { } -#endif BeingManager::~BeingManager() { @@ -111,7 +108,7 @@ Being *BeingManager::createBeing(int id, Uint16 job) if (job <= 25 || (job >= 4001 && job <= 4049)) being = new Player(id, job, mMap); else if (job >= 46 && job <= 1000) - being = new NPC(id, job, mMap, mNetwork); + being = new NPC(id, job, mMap); else if (job > 1000 && job <= 2000) being = new Monster(id, job, mMap); else diff --git a/src/beingmanager.h b/src/beingmanager.h index 109564fa..891a8ccb 100644 --- a/src/beingmanager.h +++ b/src/beingmanager.h @@ -26,9 +26,6 @@ class LocalPlayer; class Map; -#ifdef EATHENA_SUPPORT -class Network; -#endif typedef std::list<Being*> Beings; typedef Beings::iterator BeingIterator; @@ -36,9 +33,7 @@ typedef Beings::iterator BeingIterator; class BeingManager { public: -#ifdef EATHENA_SUPPORT - BeingManager(Network *network); -#endif + BeingManager(); ~BeingManager(); @@ -130,9 +125,6 @@ class BeingManager protected: Beings mBeings; Map *mMap; -#ifdef EATHENA_SUPPORT - Network *mNetwork; -#endif }; extern BeingManager *beingManager; diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index 73e41554..a2de2c63 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -43,12 +43,7 @@ #include "utils/stringutils.h" #include "utils/strprintf.h" -#ifdef TMWSERV_SUPPORT CommandHandler::CommandHandler() -#else -CommandHandler::CommandHandler(Network *network): - mNetwork(network) -#endif {} void CommandHandler::handleCommand(const std::string &command) diff --git a/src/commandhandler.h b/src/commandhandler.h index 2adf4e1b..43ce172f 100644 --- a/src/commandhandler.h +++ b/src/commandhandler.h @@ -24,10 +24,6 @@ #include <string> -#ifdef EATHENA_SUPPORT -class Network; -#endif - /** * A class to parse and handle user commands */ @@ -37,11 +33,7 @@ class CommandHandler /** * Constructor */ -#ifdef TMWSERV_SUPPORT CommandHandler(); -#else - CommandHandler(Network *network); -#endif /** * Destructor @@ -143,10 +135,6 @@ class CommandHandler * Handle a present command. */ void handlePresent(const std::string &args); - -#ifdef EATHENA_SUPPORT - Network *mNetwork; -#endif }; extern CommandHandler *commandHandler; diff --git a/src/engine.cpp b/src/engine.cpp index 13563e66..d13fbf3f 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -44,14 +44,8 @@ #include "utils/stringutils.h" -#ifdef TMWSERV_SUPPORT Engine::Engine(): mCurrentMap(NULL) -#else -Engine::Engine(Network *network): - mCurrentMap(NULL), - mNetwork(network) -#endif { } diff --git a/src/engine.h b/src/engine.h index 60b1f6c8..eafce3b9 100644 --- a/src/engine.h +++ b/src/engine.h @@ -25,9 +25,6 @@ #include <string> class Map; -#ifdef EATHENA_SUPPORT -class Network; -#endif /** * Game engine. Actually hardly does anything anymore except keeping track of @@ -39,11 +36,7 @@ class Engine /** * Constructor. */ -#ifdef EATHENA_SUPPORT - Engine(Network *network); -#else Engine(); -#endif /** * Destructor. @@ -69,9 +62,6 @@ class Engine private: Map *mCurrentMap; -#ifdef EATHENA_SUPPORT - Network *mNetwork; -#endif std::string mMapName; }; diff --git a/src/game.cpp b/src/game.cpp index 5b389c3f..856a5c11 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -239,14 +239,9 @@ int get_elapsed_time(int start_time) /** * Create all the various globally accessible gui windows */ -#ifdef TMWSERV_SUPPORT -void createGuiWindows() -#else -void createGuiWindows(Network *network) -#endif +static void createGuiWindows() { // Create dialogs -#ifdef TMWSERV_SUPPORT chatWindow = new ChatWindow; buyDialog = new BuyDialog; sellDialog = new SellDialog; @@ -255,6 +250,7 @@ void createGuiWindows(Network *network) npcIntegerDialog = new NpcIntegerDialog; npcListDialog = new NpcListDialog; npcStringDialog = new NpcStringDialog; +#ifdef TMWSERV_SUPPORT npcPostDialog = new NpcPostDialog; magicDialog = new MagicDialog; equipmentWindow = new EquipmentWindow(player_node->mEquipment.get()); @@ -262,17 +258,9 @@ void createGuiWindows(Network *network) guildWindow = new GuildWindow; partyWindow = new PartyWindow; #else - chatWindow = new ChatWindow(network); - buyDialog = new BuyDialog(network); - sellDialog = new SellDialog(network); - buySellDialog = new BuySellDialog(network); - tradeWindow = new TradeWindow(network); + buySellDialog = new BuySellDialog; equipmentWindow = new EquipmentWindow; - npcTextDialog = new NpcTextDialog(network); - npcIntegerDialog = new NpcIntegerDialog(network); - npcListDialog = new NpcListDialog(network); - npcStringDialog = new NpcStringDialog(network); - storageWindow = new StorageWindow(network); + storageWindow = new StorageWindow; #endif menuWindow = new MenuWindow; statusWindow = new StatusWindow(player_node); @@ -328,7 +316,7 @@ void createGuiWindows(Network *network) /** * Destroy all the globally accessible gui windows */ -void destroyGuiWindows() +static void destroyGuiWindows() { logger->setChatWindow(NULL); delete localChatTab; // Need to do this first, so it can remove itself @@ -392,20 +380,11 @@ Game::Game(Network *network): { done = false; -#ifdef TMWSERV_SUPPORT createGuiWindows(); engine = new Engine; beingManager = new BeingManager; commandHandler = new CommandHandler; -#else - createGuiWindows(network); - engine = new Engine(network); - - beingManager = new BeingManager(network); - commandHandler = new CommandHandler(network); -#endif - floorItemManager = new FloorItemManager; channelManager = new ChannelManager; effectManager = new EffectManager; @@ -425,8 +404,7 @@ Game::Game(Network *network): // Initialize beings beingManager->setPlayer(player_node); #ifdef EATHENA_SUPPORT - player_node->setNetwork(network); - playerParty = new Party(network); + playerParty = new Party; #endif Joystick::init(); diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index 003e730e..6d336e4c 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -46,15 +46,8 @@ #include "utils/gettext.h" #include "utils/strprintf.h" -#ifdef TMWSERV_SUPPORT BuyDialog::BuyDialog(): -#else -BuyDialog::BuyDialog(Network *network): -#endif Window(_("Buy")), -#ifndef TMWSERV_SUPPORT - mNetwork(network), -#endif mMoney(0), mAmountItems(0), mMaxItems(0) { setWindowName("Buy"); diff --git a/src/gui/buy.h b/src/gui/buy.h index 200394b9..1e022652 100644 --- a/src/gui/buy.h +++ b/src/gui/buy.h @@ -29,9 +29,6 @@ #include "../guichanfwd.h" -#ifndef TMWSERV_SUPPORT -class Network; -#endif class ShopItems; class ShopListBox; class ListBox; @@ -50,11 +47,7 @@ class BuyDialog : public Window, public gcn::ActionListener, * * @see Window::Window */ -#ifdef TMWSERV_SUPPORT BuyDialog(); -#else - BuyDialog(Network *network); -#endif /** * Destructor @@ -116,9 +109,6 @@ class BuyDialog : public Window, public gcn::ActionListener, */ void close(); private: -#ifdef EATHENA_SUPPORT - Network *mNetwork; -#endif gcn::Button *mBuyButton; gcn::Button *mQuitButton; gcn::Button *mAddMaxButton; diff --git a/src/gui/buysell.cpp b/src/gui/buysell.cpp index f45a5adb..8fffd3d5 100644 --- a/src/gui/buysell.cpp +++ b/src/gui/buysell.cpp @@ -31,8 +31,8 @@ #include "../utils/gettext.h" -BuySellDialog::BuySellDialog(Network *network): - Window(_("Shop")), mNetwork(network) +BuySellDialog::BuySellDialog(): + Window(_("Shop")) { setWindowName("BuySell"); Button *buyButton = 0; diff --git a/src/gui/buysell.h b/src/gui/buysell.h index 4b137554..ff956e09 100644 --- a/src/gui/buysell.h +++ b/src/gui/buysell.h @@ -26,8 +26,6 @@ #include "window.h" -class Network; - /** * A dialog to choose between buying or selling at a shop. * @@ -42,7 +40,7 @@ class BuySellDialog : public Window, public gcn::ActionListener * * @see Window::Window */ - BuySellDialog(Network *network); + BuySellDialog(); /** * Check for current NPC @@ -55,9 +53,6 @@ class BuySellDialog : public Window, public gcn::ActionListener * Called when receiving actions from the widgets. */ void action(const gcn::ActionEvent &event); - - private: - Network *mNetwork; }; extern BuySellDialog *buySellDialog; diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index b6cd47d4..a0f7230e 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -100,12 +100,13 @@ void CharDeleteConfirm::action(const gcn::ActionEvent &event) CharSelectDialog::CharSelectDialog(LockedArray<LocalPlayer*> *charInfo, LoginData *loginData): Window(_("Account and Character Management")), - mCharInfo(charInfo), mCharSelected(false), mLoginData(loginData) + mCharInfo(charInfo), + mCharSelected(false), + mLoginData(loginData) #else -CharSelectDialog::CharSelectDialog(Network *network, - LockedArray<LocalPlayer*> *charInfo, +CharSelectDialog::CharSelectDialog(LockedArray<LocalPlayer*> *charInfo, Gender gender): - Window(_("Select Character")), mNetwork(network), + Window(_("Select Character")), mCharInfo(charInfo), mCharSelected(false), mGender(gender) @@ -261,8 +262,7 @@ void CharSelectDialog::action(const gcn::ActionEvent &event) { // Start new character dialog CharCreateDialog *charCreateDialog = - new CharCreateDialog(this, mCharInfo->getPos(), - mNetwork, mGender); + new CharCreateDialog(this, mCharInfo->getPos(), mGender); charServerHandler.setCharCreateDialog(charCreateDialog); } } @@ -398,13 +398,10 @@ bool CharSelectDialog::selectByName(const std::string &name) #ifdef TMWSERV_SUPPORT CharCreateDialog::CharCreateDialog(Window *parent, int slot): #else -CharCreateDialog::CharCreateDialog(Window *parent, int slot, Network *network, +CharCreateDialog::CharCreateDialog(Window *parent, int slot, Gender gender): #endif Window(_("Create Character"), true, parent), -#ifndef TMWSERV_SUPPORT - mNetwork(network), -#endif mSlot(slot) { mPlayer = new Player(0, 0, NULL); diff --git a/src/gui/char_select.h b/src/gui/char_select.h index b29953d3..cf770010 100644 --- a/src/gui/char_select.h +++ b/src/gui/char_select.h @@ -32,8 +32,6 @@ #ifdef TMWSERV_SUPPORT #include "../logindata.h" -#else -class Network; #endif class LocalPlayer; @@ -56,8 +54,7 @@ class CharSelectDialog : public Window, public gcn::ActionListener CharSelectDialog(LockedArray<LocalPlayer*> *charInfo, LoginData *loginData); #else - CharSelectDialog(Network *network, - LockedArray<LocalPlayer*> *charInfo, + CharSelectDialog(LockedArray<LocalPlayer*> *charInfo, Gender gender); #endif @@ -70,9 +67,6 @@ class CharSelectDialog : public Window, public gcn::ActionListener bool selectByName(const std::string &name); private: -#ifdef EATHENA_SUPPORT - Network *mNetwork; -#endif LockedArray<LocalPlayer*> *mCharInfo; gcn::Button *mSelectButton; @@ -129,8 +123,7 @@ class CharCreateDialog : public Window, public gcn::ActionListener #ifdef TMWSERV_SUPPORT CharCreateDialog(Window *parent, int slot); #else - CharCreateDialog(Window *parent, int slot, Network *network, - Gender gender); + CharCreateDialog(Window *parent, int slot, Gender gender); #endif /** @@ -162,9 +155,6 @@ class CharCreateDialog : public Window, public gcn::ActionListener */ void attemptCharCreate(); -#ifdef EATHENA_SUPPORT - Network *mNetwork; -#endif gcn::TextField *mNameField; gcn::Label *mNameLabel; gcn::Button *mNextHairColorButton; diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 5b07980b..987de11e 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -40,13 +40,8 @@ #include <guichan/focushandler.hpp> -#ifdef TMWSERV_SUPPORT ChatWindow::ChatWindow(): - Window("Chat"), -#else -ChatWindow::ChatWindow(Network * network): - Window(""), mNetwork(network), -#endif + Window(_("Chat")), mTmpVisible(false) { setWindowName("Chat"); diff --git a/src/gui/chat.h b/src/gui/chat.h index ac4e491e..54270055 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.h @@ -40,9 +40,6 @@ class Recorder; class ScrollArea; class TabbedArea; class ItemLinkHandler; -#ifdef EATHENA_SUPPORT -class Network; -#endif class Tab; class WhisperTab; @@ -69,11 +66,7 @@ class ChatWindow : public Window, /** * Constructor. */ -#ifdef TMWSERV_SUPPORT ChatWindow(); -#else - ChatWindow(Network *network); -#endif /** * Destructor: used to write back values to the config file @@ -190,7 +183,6 @@ class ChatWindow : public Window, void adjustTabSize(); #ifdef EATHENA_SUPPORT - Network *mNetwork; char mPartyPrefix; /**< Messages beginning with the prefix are sent to the party */ #endif diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp index bf7b60ed..31f48486 100644 --- a/src/gui/npc_text.cpp +++ b/src/gui/npc_text.cpp @@ -37,15 +37,8 @@ #include "../utils/gettext.h" -#ifdef TMWSERV_SUPPORT NpcTextDialog::NpcTextDialog() -#else -NpcTextDialog::NpcTextDialog(Network *network) -#endif : Window(_("NPC")) -#ifdef EATHENA_SUPPORT - , mNetwork(network) -#endif , mState(NPC_TEXT_STATE_WAITING) { setWindowName("NPCText"); diff --git a/src/gui/npc_text.h b/src/gui/npc_text.h index 16c1d5fd..231ac684 100644 --- a/src/gui/npc_text.h +++ b/src/gui/npc_text.h @@ -30,9 +30,6 @@ #include "../npc.h" -#ifdef EATHENA_SUPPORT -class Network; -#endif class TextBox; /** @@ -48,11 +45,7 @@ class NpcTextDialog : public Window, public gcn::ActionListener * * @see Window::Window */ -#ifdef TMWSERV_SUPPORT NpcTextDialog(); -#else - NpcTextDialog(Network *network); -#endif /** * Called when receiving actions from the widgets. @@ -101,9 +94,6 @@ class NpcTextDialog : public Window, public gcn::ActionListener void widgetResized(const gcn::Event &event); private: -#ifdef EATHENA_SUPPORT - Network *mNetwork; -#endif gcn::ScrollArea *mScrollArea; TextBox *mTextBox; gcn::Button *mButton; diff --git a/src/gui/npcintegerdialog.cpp b/src/gui/npcintegerdialog.cpp index 4dae8d83..4d2ae1ce 100644 --- a/src/gui/npcintegerdialog.cpp +++ b/src/gui/npcintegerdialog.cpp @@ -36,15 +36,8 @@ #include "../utils/gettext.h" #include "../utils/strprintf.h" -#ifdef TMWSERV_SUPPORT NpcIntegerDialog::NpcIntegerDialog() -#else -NpcIntegerDialog::NpcIntegerDialog(Network *network) -#endif : Window(_("NPC Number Request")) -#ifdef EATHENA_SUPPORT - , mNetwork(network) -#endif { setWindowName("NPCInteger"); mValueField = new IntTextField; diff --git a/src/gui/npcintegerdialog.h b/src/gui/npcintegerdialog.h index df74c904..bb3a8e20 100644 --- a/src/gui/npcintegerdialog.h +++ b/src/gui/npcintegerdialog.h @@ -26,9 +26,6 @@ #include "window.h" -#ifdef EATHENA_SUPPORT -class Network; -#endif class IntTextField; /** @@ -44,11 +41,7 @@ class NpcIntegerDialog : public Window, public gcn::ActionListener * * @see Window::Window */ -#ifdef TMWSERV_SUPPORT NpcIntegerDialog(); -#else - NpcIntegerDialog(Network *network); -#endif /** * Called when receiving actions from the widgets. @@ -93,9 +86,6 @@ class NpcIntegerDialog : public Window, public gcn::ActionListener void setVisible(bool visible); private: -#ifdef EATHENA_SUPPORT - Network *mNetwork; -#endif gcn::Button *mDecButton; gcn::Button *mIncButton; IntTextField *mValueField; diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp index 6df0979f..efac8954 100644 --- a/src/gui/npclistdialog.cpp +++ b/src/gui/npclistdialog.cpp @@ -41,15 +41,8 @@ #include "../utils/gettext.h" #include "../utils/strprintf.h" -#ifdef TMWSERV_SUPPORT NpcListDialog::NpcListDialog() -#else -NpcListDialog::NpcListDialog(Network *network) -#endif : Window("NPC") -#ifdef EATHENA_SUPPORT - , mNetwork(network) -#endif { setWindowName("NPCList"); setResizable(true); diff --git a/src/gui/npclistdialog.h b/src/gui/npclistdialog.h index 6c1e02e3..fa297304 100644 --- a/src/gui/npclistdialog.h +++ b/src/gui/npclistdialog.h @@ -29,10 +29,6 @@ #include <vector> -#ifdef EATHENA_SUPPORT -class Network; -#endif - /** * The npc list dialog. * @@ -47,11 +43,7 @@ class NpcListDialog : public Window, public gcn::ActionListener, * * @see Window::Window */ -#ifdef TMWSERV_SUPPORT NpcListDialog(); -#else - NpcListDialog(Network *network); -#endif /** * Called when receiving actions from the widgets. @@ -94,9 +86,6 @@ class NpcListDialog : public Window, public gcn::ActionListener, void requestFocus(); private: -#ifdef EATHENA_SUPPORT - Network *mNetwork; -#endif gcn::ListBox *mItemList; std::vector<std::string> mItems; diff --git a/src/gui/npcstringdialog.cpp b/src/gui/npcstringdialog.cpp index 7297d7e8..e5137d9c 100644 --- a/src/gui/npcstringdialog.cpp +++ b/src/gui/npcstringdialog.cpp @@ -36,15 +36,8 @@ #include "../utils/gettext.h" #include "../utils/strprintf.h" -#ifdef TMWSERV_SUPPORT NpcStringDialog::NpcStringDialog() -#else -NpcStringDialog::NpcStringDialog(Network *network) -#endif : Window(_("NPC Text Request")) -#ifdef EATHENA_SUPPORT - , mNetwork(network) -#endif { setWindowName("NPCString"); mValueField = new TextField(""); diff --git a/src/gui/npcstringdialog.h b/src/gui/npcstringdialog.h index 94cd59b2..37d46cc0 100644 --- a/src/gui/npcstringdialog.h +++ b/src/gui/npcstringdialog.h @@ -26,10 +26,6 @@ #include <guichan/actionlistener.hpp> -#ifdef EATHENA_SUPPORT -class Network; -#endif - /** * The npc integer input dialog. * @@ -43,11 +39,7 @@ class NpcStringDialog : public Window, public gcn::ActionListener * * @see Window::Window */ -#ifdef TMWSERV_SUPPORT NpcStringDialog(); -#else - NpcStringDialog(Network *network); -#endif /** * Called when receiving actions from the widgets. @@ -79,9 +71,6 @@ class NpcStringDialog : public Window, public gcn::ActionListener void setVisible(bool visible); private: -#ifdef EATHENA_SUPPORT - Network *mNetwork; -#endif gcn::TextField *mValueField; std::string mDefault; }; diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index 648bff08..1e1155a7 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -46,14 +46,8 @@ #include "utils/gettext.h" #include "utils/strprintf.h" -#ifdef TMWSERV_SUPPORT SellDialog::SellDialog(): Window(_("Sell")), -#else -SellDialog::SellDialog(Network *network): - Window(_("Sell")), - mNetwork(network), -#endif mMaxItems(0), mAmountItems(0) { setWindowName("Sell"); diff --git a/src/gui/sell.h b/src/gui/sell.h index b6388a1f..b3e59b4f 100644 --- a/src/gui/sell.h +++ b/src/gui/sell.h @@ -30,9 +30,6 @@ #include "window.h" class Item; -#ifdef EATHENA_SUPPORT -class Network; -#endif class ShopItems; class ShopListBox; @@ -49,11 +46,7 @@ class SellDialog : public Window, gcn::ActionListener, gcn::SelectionListener * * @see Window::Window */ -#ifdef TMWSERV_SUPPORT SellDialog(); -#else - SellDialog(Network *network); -#endif /** * Destructor @@ -111,9 +104,6 @@ class SellDialog : public Window, gcn::ActionListener, gcn::SelectionListener */ void updateButtonsAndLabels(); -#ifdef EATHENA_SUPPORT - Network *mNetwork; -#endif gcn::Button *mSellButton; gcn::Button *mQuitButton; gcn::Button *mAddMaxButton; diff --git a/src/gui/storagewindow.cpp b/src/gui/storagewindow.cpp index 847886cb..690758ed 100644 --- a/src/gui/storagewindow.cpp +++ b/src/gui/storagewindow.cpp @@ -51,9 +51,8 @@ #include "../utils/gettext.h" #include "../utils/strprintf.h" -StorageWindow::StorageWindow(Network *network, int invSize): +StorageWindow::StorageWindow(int invSize): Window(_("Storage")), - mNetwork(network), mMaxSlots(invSize), mItemDesc(false) { diff --git a/src/gui/storagewindow.h b/src/gui/storagewindow.h index cc0df2af..de0937b5 100644 --- a/src/gui/storagewindow.h +++ b/src/gui/storagewindow.h @@ -31,7 +31,6 @@ class Item; class ItemContainer; -class Network; class ProgressBar; class TextBox; @@ -47,7 +46,7 @@ class StorageWindow : public Window, gcn::ActionListener, /** * Constructor. */ - StorageWindow(Network *network, int invSize = (STORAGE_SIZE - 1)); + StorageWindow(int invSize = (STORAGE_SIZE - 1)); /** * Destructor. @@ -88,7 +87,6 @@ class StorageWindow : public Window, gcn::ActionListener, void close(); private: - Network *mNetwork; ItemContainer *mItems; int mSlots; diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp index 6cba1c41..6926eb82 100644 --- a/src/gui/trade.cpp +++ b/src/gui/trade.cpp @@ -51,14 +51,9 @@ #include "../utils/stringutils.h" #include "../utils/strprintf.h" -#ifdef TMWSERV_SUPPORT TradeWindow::TradeWindow(): -#else -TradeWindow::TradeWindow(Network *network): -#endif Window(_("Trade: You")), #ifdef EATHENA_SUPPORT - mNetwork(network), mMyInventory(new Inventory(INVENTORY_SIZE, 2)), mPartnerInventory(new Inventory(INVENTORY_SIZE, 2)) #else diff --git a/src/gui/trade.h b/src/gui/trade.h index 4c215ba6..e2767c5b 100644 --- a/src/gui/trade.h +++ b/src/gui/trade.h @@ -34,9 +34,6 @@ class Inventory; class Item; class ItemContainer; -#ifdef EATHENA_SUPPORT -class Network; -#endif class ScrollArea; /** @@ -50,11 +47,7 @@ class TradeWindow : public Window, gcn::ActionListener, gcn::SelectionListener /** * Constructor. */ -#ifdef TMWSERV_SUPPORT TradeWindow(); -#else - TradeWindow(Network *network); -#endif /** * Destructor. @@ -139,10 +132,6 @@ class TradeWindow : public Window, gcn::ActionListener, gcn::SelectionListener void setStatus(Status); #endif -#ifdef EATHENA_SUPPORT - Network *mNetwork; -#endif - typedef const std::auto_ptr<Inventory> InventoryPtr; InventoryPtr mMyInventory; InventoryPtr mPartnerInventory; diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 8b2d6907..68f9e4bc 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -96,7 +96,6 @@ LocalPlayer::LocalPlayer(int id, int job, Map *map): mStatPoint(0), mSkillPoint(0), mStatsPointsToAttribute(0), mEquipment(new Equipment), - mNetwork(0), mXp(0), mInStorage(false), mTargetTime(-1), diff --git a/src/localplayer.h b/src/localplayer.h index 77e9ac02..bff38796 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -33,9 +33,6 @@ class ImageSet; class Inventory; class Item; class Map; -#ifdef EATHENA_SUPPORT -class Network; -#endif #ifdef TMWSERV_SUPPORT @@ -155,10 +152,6 @@ class LocalPlayer : public Player virtual void setName(const std::string &name); -#ifdef EATHENA_SUPPORT - void setNetwork(Network *network) { mNetwork = network; } - Network *getNetwork() {return mNetwork; } -#endif virtual void logic(); /** @@ -500,7 +493,6 @@ class LocalPlayer : public Player void walk(unsigned char dir); #ifdef EATHENA_SUPPORT - Network *mNetwork; int mXp; /**< Experience points. */ bool mInStorage; /**< Whether storage is currently accessible */ int mTargetTime; /** How long the being has been targeted **/ diff --git a/src/main.cpp b/src/main.cpp index bd17ce9c..ad3063f6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1653,7 +1653,7 @@ int main(int argc, char *argv[]) break; case STATE_CHAR_SELECT: logger->log("State: CHAR_SELECT"); - currentDialog = new CharSelectDialog(network, &charInfo, + currentDialog = new CharSelectDialog(&charInfo, (loginData.sex == 0) ? GENDER_FEMALE : GENDER_MALE); positionDialog(currentDialog, screenWidth, screenHeight); diff --git a/src/net/ea/network.h b/src/net/ea/network.h index 40d563aa..c246ab8e 100644 --- a/src/net/ea/network.h +++ b/src/net/ea/network.h @@ -36,8 +36,6 @@ class MessageHandler; class MessageIn; -class Network; - class Network { public: diff --git a/src/npc.cpp b/src/npc.cpp index 98c3e0eb..359546e2 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -40,14 +40,8 @@ bool NPC::isTalking = false; int current_npc = 0; -#ifdef TMWSERV_SUPPORT NPC::NPC(int id, int job, Map *map): Player(id, job, map) -#else -NPC::NPC(int id, int job, Map *map, Network *network): - Player(id, job, map), - mNetwork(network) -#endif { NPCInfo info = NPCDB::get(job); @@ -126,9 +120,6 @@ void NPC::talk() #ifdef TMWSERV_SUPPORT Net::GameServer::Player::talkToNPC(mId, true); #else - if (!mNetwork) - return; - MessageOut outMsg(CMSG_NPC_TALK); outMsg.writeInt32(mId); outMsg.writeInt8(0); @@ -24,20 +24,13 @@ #include "player.h" -#ifdef EATHENA_SUPPORT -class Network; -#endif class Graphics; class Text; class NPC : public Player { public: -#ifdef TMWSERV_SUPPORT - NPC(int id, int sprite, Map *map); -#else - NPC(int id, int job, Map *map, Network *network); -#endif + NPC(int id, int job, Map *map); ~NPC(); @@ -56,6 +49,7 @@ class NPC : public Player { return 0x83; } // blocked like a monster by walls, monsters and characters ( bin 1000 0011) static bool isTalking; + protected: /** * Gets the way a monster blocks pathfinding for other objects @@ -63,10 +57,8 @@ class NPC : public Player virtual Map::BlockType getBlockType() const { return Map::BLOCKTYPE_CHARACTER; } //blocks like a player character -#ifdef EATHENA_SUPPORT - Network *mNetwork; -#endif void updateCoords(); + private: Text *mName; }; diff --git a/src/party.cpp b/src/party.cpp index 4a7912ee..2295cb81 100644 --- a/src/party.cpp +++ b/src/party.cpp @@ -33,9 +33,8 @@ #include "utils/gettext.h" #include "utils/strprintf.h" -Party::Party(Network *network) : - mNetwork(network), - mInviteListener(network, &mInParty) +Party::Party() : + mInviteListener(&mInParty) { } diff --git a/src/party.h b/src/party.h index d73b4a0f..25af80b3 100644 --- a/src/party.h +++ b/src/party.h @@ -29,12 +29,11 @@ class PartyHandler; class Being; class ChatWindow; -class Network; class Party { public: - Party(Network *network); + Party(); void respond(const std::string &command, const std::string &args); void create(const std::string &party); @@ -43,7 +42,7 @@ class Party void createResponse(bool ok); void inviteResponse(const std::string &nick, int status); void invitedAsk(const std::string &nick, int gender, - const std::string &partyName); + const std::string &partyName); void leftResponse(const std::string &nick); void receiveChat(Being *being, const std::string &msg); @@ -51,7 +50,6 @@ class Party private: std::string mPartyName; - Network *mNetwork; bool mInParty; bool mCreating; /**< Used to give an appropriate response to failure */ @@ -60,12 +58,11 @@ class Party class InviteListener : public gcn::ActionListener { public: - InviteListener(Network *network, bool *inParty) : - mNetwork(network), + InviteListener(bool *inParty) : mInParty(inParty) {} void action(const gcn::ActionEvent &event); - Network *mNetwork; + private: bool *mInParty; }; |