summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2006-08-26 17:24:43 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2006-08-26 17:24:43 +0000
commit07b6070c25faedd78c2e26825bd700dc294f00cf (patch)
tree6a3053ad2a88ee6f0091fafba6607bc82231f7f6 /src/gui
parent00d7badb647b4293c444c0374985b7f1ea8a1ed1 (diff)
downloadMana-07b6070c25faedd78c2e26825bd700dc294f00cf.tar.gz
Mana-07b6070c25faedd78c2e26825bd700dc294f00cf.tar.bz2
Mana-07b6070c25faedd78c2e26825bd700dc294f00cf.tar.xz
Mana-07b6070c25faedd78c2e26825bd700dc294f00cf.zip
Made the Network class a purely static interface, as there is only one instance.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/buy.cpp4
-rw-r--r--src/gui/buy.h4
-rw-r--r--src/gui/char_select.cpp17
-rw-r--r--src/gui/char_select.h8
-rw-r--r--src/gui/chat.cpp5
-rw-r--r--src/gui/chat.h4
-rw-r--r--src/gui/sell.cpp3
-rw-r--r--src/gui/sell.h4
-rw-r--r--src/gui/trade.cpp3
-rw-r--r--src/gui/trade.h5
10 files changed, 20 insertions, 37 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index e7bfef58..63a6e20e 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -42,8 +42,8 @@
#include "../utils/tostring.h"
-BuyDialog::BuyDialog(Network *network):
- Window("Buy"), mNetwork(network),
+BuyDialog::BuyDialog():
+ Window("Buy"),
mMoney(0), mAmountItems(0), mMaxItems(0)
{
mShopItems = new ShopItems;
diff --git a/src/gui/buy.h b/src/gui/buy.h
index b09b648b..0ddea4c4 100644
--- a/src/gui/buy.h
+++ b/src/gui/buy.h
@@ -30,7 +30,6 @@
#include "../guichanfwd.h"
-class Network;
class ShopItems;
/**
@@ -46,7 +45,7 @@ class BuyDialog : public Window, public gcn::ActionListener
*
* @see Window::Window
*/
- BuyDialog(Network *network);
+ BuyDialog();
/**
* Destructor
@@ -89,7 +88,6 @@ class BuyDialog : public Window, public gcn::ActionListener
std::string getElementAt(int i);
private:
- Network *mNetwork;
gcn::Button *mBuyButton;
gcn::Button *mQuitButton;
gcn::Button *mIncreaseButton;
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index 3db82287..7e0a1a29 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -71,9 +71,8 @@ void CharDeleteConfirm::action(const std::string &eventId, gcn::Widget *widget)
ConfirmDialog::action(eventId, widget);
}
-CharSelectDialog::CharSelectDialog(Network *network,
- LockedArray<LocalPlayer*> *charInfo):
- Window("Select Character"), mNetwork(network),
+CharSelectDialog::CharSelectDialog(LockedArray<LocalPlayer*> *charInfo):
+ Window("Select Character"),
mCharInfo(charInfo), mCharSelected(false)
{
mSelectButton = new Button("Ok", "ok", this);
@@ -147,7 +146,7 @@ void CharSelectDialog::action(const std::string &eventId, gcn::Widget *widget)
{
// Start new character dialog
mCharInfo->lock();
- new CharCreateDialog(this, mCharInfo->getPos(), mNetwork);
+ new CharCreateDialog(this, mCharInfo->getPos());
mCharInfo->unlock();
}
}
@@ -208,7 +207,7 @@ void CharSelectDialog::attemptCharDelete()
msg.writeShort(PAMSG_CHAR_DELETE);
// TODO: Send the selected slot
msg.writeByte(0);
- network->send(Network::ACCOUNT, msg);
+ Network::send(Network::ACCOUNT, msg);
mCharInfo->lock();
}
@@ -218,7 +217,7 @@ void CharSelectDialog::attemptCharSelect()
MessageOut msg;
msg.writeShort(PAMSG_CHAR_SELECT);
msg.writeByte(mCharInfo->getPos());
- network->send(Network::ACCOUNT, msg);
+ Network::send(Network::ACCOUNT, msg);
mCharInfo->lock();
}
@@ -227,8 +226,8 @@ void CharSelectDialog::logic()
updatePlayerInfo();
}
-CharCreateDialog::CharCreateDialog(Window *parent, int slot, Network *network):
- Window("Create Character", true, parent), mNetwork(network), mSlot(slot)
+CharCreateDialog::CharCreateDialog(Window *parent, int slot):
+ Window("Create Character", true, parent), mSlot(slot)
{
mNameField = new TextField("");
mNameLabel = new gcn::Label("Name:");
@@ -336,5 +335,5 @@ void CharCreateDialog::attemptCharCreate()
outMsg.writeShort(10); // INT
outMsg.writeShort(10); // DEX
outMsg.writeShort(10); // LUK
- network->send(Network::ACCOUNT, outMsg);
+ Network::send(Network::ACCOUNT, outMsg);
}
diff --git a/src/gui/char_select.h b/src/gui/char_select.h
index e65f400d..73fc8b2d 100644
--- a/src/gui/char_select.h
+++ b/src/gui/char_select.h
@@ -32,7 +32,6 @@
#include <guichan/actionlistener.hpp>
class LocalPlayer;
-class Network;
class PlayerBox;
/**
@@ -47,8 +46,7 @@ class CharSelectDialog : public Window, public gcn::ActionListener
/**
* Constructor.
*/
- CharSelectDialog(Network *network,
- LockedArray<LocalPlayer*> *charInfo);
+ CharSelectDialog(LockedArray<LocalPlayer*> *charInfo);
void action(const std::string& eventId, gcn::Widget* widget);
@@ -57,7 +55,6 @@ class CharSelectDialog : public Window, public gcn::ActionListener
void logic();
private:
- Network *mNetwork;
LockedArray<LocalPlayer*> *mCharInfo;
gcn::Button *mSelectButton;
@@ -97,14 +94,13 @@ class CharCreateDialog : public Window, public gcn::ActionListener
/**
* Constructor.
*/
- CharCreateDialog(Window *parent, int slot, Network *network);
+ CharCreateDialog(Window *parent, int slot);
void action(const std::string& eventId, gcn::Widget* widget);
std::string getName();
private:
- Network *mNetwork;
gcn::TextField *mNameField;
gcn::Label *mNameLabel;
gcn::Button *mNextHairColorButton;
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index e8bb1cc6..04ac3996 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -40,9 +40,8 @@
#include "../net/network.h"
#include "../net/protocol.h"
-ChatWindow::ChatWindow(Network *network):
+ChatWindow::ChatWindow():
Window(""),
- mNetwork(network),
mTmpVisible(false)
{
setWindowName("Chat");
@@ -253,7 +252,7 @@ ChatWindow::chatSend(const std::string &nick, std::string msg)
MessageOut outMsg;
outMsg.writeShort(PGMSG_SAY);
outMsg.writeString(msg);
- network->send(Network::GAME, outMsg);
+ Network::send(Network::GAME, outMsg);
}
else if (msg.substr(0, IS_ANNOUNCE_LENGTH) == IS_ANNOUNCE)
{
diff --git a/src/gui/chat.h b/src/gui/chat.h
index 20841873..a0a3d1ec 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -35,7 +35,6 @@
#include "../guichanfwd.h"
class BrowserBox;
-class Network;
class ScrollArea;
#define BY_GM 0 // those should be self-explanatory =)
@@ -116,7 +115,7 @@ class ChatWindow : public Window, public gcn::ActionListener,
/**
* Constructor.
*/
- ChatWindow(Network *network);
+ ChatWindow();
/**
* Logic (updates components' size)
@@ -188,7 +187,6 @@ class ChatWindow : public Window, public gcn::ActionListener,
void setVisible(bool visible);
private:
- Network *mNetwork;
bool mTmpVisible;
/** One item in the chat log */
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index e820d42f..3aa7c889 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -44,9 +44,8 @@
#include "../utils/tostring.h"
-SellDialog::SellDialog(Network *network):
+SellDialog::SellDialog():
Window("Sell"),
- mNetwork(network),
mMaxItems(0), mAmountItems(0)
{
mShopItems = new ShopItems();
diff --git a/src/gui/sell.h b/src/gui/sell.h
index 423fea26..be5185bd 100644
--- a/src/gui/sell.h
+++ b/src/gui/sell.h
@@ -31,7 +31,6 @@
#include "../guichanfwd.h"
class Item;
-class Network;
class ShopItems;
@@ -48,7 +47,7 @@ class SellDialog : public Window, public gcn::ActionListener
*
* @see Window::Window
*/
- SellDialog(Network *network);
+ SellDialog();
/**
* Destructor
@@ -76,7 +75,6 @@ class SellDialog : public Window, public gcn::ActionListener
void mouseClick(int x, int y, int buton, int count);
private:
- Network *mNetwork;
gcn::Button *mSellButton;
gcn::Button *mIncreaseButton;
gcn::Button *mDecreaseButton;
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index 73193c88..6b247901 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -45,9 +45,8 @@
#include "../utils/tostring.h"
-TradeWindow::TradeWindow(Network *network):
+TradeWindow::TradeWindow():
Window("Trade: You"),
- mNetwork(network),
mMyInventory(new Inventory()),
mPartnerInventory(new Inventory())
{
diff --git a/src/gui/trade.h b/src/gui/trade.h
index eb3c0f97..fe60aac5 100644
--- a/src/gui/trade.h
+++ b/src/gui/trade.h
@@ -35,7 +35,6 @@
class Inventory;
class Item;
class ItemContainer;
-class Network;
class ScrollArea;
/**
@@ -49,7 +48,7 @@ class TradeWindow : public Window, gcn::ActionListener
/**
* Constructor.
*/
- TradeWindow(Network *network);
+ TradeWindow();
/**
* Destructor.
@@ -113,8 +112,6 @@ class TradeWindow : public Window, gcn::ActionListener
void action(const std::string& eventId, gcn::Widget* widget);
private:
- Network *mNetwork;
-
typedef std::auto_ptr<Inventory> InventoryPtr;
InventoryPtr mMyInventory;
InventoryPtr mPartnerInventory;