summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-03-27 19:44:23 +0100
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-03-27 20:18:11 +0100
commit712ca58c011123505c807266dcc8d9d84ca1aa44 (patch)
tree27c0dfe49f21bffe25007f70475be3223d3fa851 /src/gui
parentff5e1957dd4fde40e41e4c5e4b9e04e1f36e5ef2 (diff)
downloadmana-712ca58c011123505c807266dcc8d9d84ca1aa44.tar.gz
mana-712ca58c011123505c807266dcc8d9d84ca1aa44.tar.bz2
mana-712ca58c011123505c807266dcc8d9d84ca1aa44.tar.xz
mana-712ca58c011123505c807266dcc8d9d84ca1aa44.zip
Made eAthena's Network class statically accessible
Now the instance doesn't need to be passed into the MessageOut class anymore. Expect a lot of cleanup in the next commit.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/buy.cpp3
-rw-r--r--src/gui/buysell.cpp3
-rw-r--r--src/gui/char_select.cpp9
-rw-r--r--src/gui/npc_text.cpp6
-rw-r--r--src/gui/npcintegerdialog.cpp3
-rw-r--r--src/gui/npclistdialog.cpp3
-rw-r--r--src/gui/npcstringdialog.cpp3
-rw-r--r--src/gui/popupmenu.cpp3
-rw-r--r--src/gui/sell.cpp4
-rw-r--r--src/gui/storagewindow.cpp9
-rw-r--r--src/gui/trade.cpp18
-rw-r--r--src/gui/widgets/chattab.cpp7
-rw-r--r--src/gui/widgets/whispertab.cpp3
13 files changed, 24 insertions, 50 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index 6df2ae25..003e730e 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -199,8 +199,7 @@ void BuyDialog::action(const gcn::ActionEvent &event)
Net::GameServer::Player::tradeWithNPC
(mShopItems->at(selectedItem)->getId(), mAmountItems);
#else
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_NPC_BUY_REQUEST);
+ MessageOut outMsg(CMSG_NPC_BUY_REQUEST);
outMsg.writeInt16(8);
outMsg.writeInt16(mAmountItems);
outMsg.writeInt16(mShopItems->at(selectedItem)->getId());
diff --git a/src/gui/buysell.cpp b/src/gui/buysell.cpp
index b9a6a1dc..f45a5adb 100644
--- a/src/gui/buysell.cpp
+++ b/src/gui/buysell.cpp
@@ -97,8 +97,7 @@ void BuySellDialog::action(const gcn::ActionEvent &event)
}
#ifdef EATHENA_SUPPORT
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_NPC_BUY_SELL_REQUEST);
+ MessageOut outMsg(CMSG_NPC_BUY_SELL_REQUEST);
outMsg.writeInt32(current_npc);
outMsg.writeInt8(action);
#endif
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index 4ab3d9ef..b6cd47d4 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -348,8 +348,7 @@ void CharSelectDialog::attemptCharDelete()
Net::AccountServer::Account::deleteCharacter(mCharInfo->getPos());
#else
// Request character deletion
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(0x0068);
+ MessageOut outMsg(0x0068);
outMsg.writeInt32(mCharInfo->getEntry()->mCharId);
outMsg.writeString("a@a.com", 40);
#endif
@@ -362,8 +361,7 @@ void CharSelectDialog::attemptCharSelect()
Net::AccountServer::Account::selectCharacter(mCharInfo->getPos());
#else
// Request character selection
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(0x0066);
+ MessageOut outMsg(0x0066);
outMsg.writeInt8(mCharInfo->getPos());
#endif
mCharInfo->lock();
@@ -693,8 +691,7 @@ int CharCreateDialog::getDistributedPoints()
void CharCreateDialog::attemptCharCreate()
{
// Send character infos
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(0x0067);
+ MessageOut outMsg(0x0067);
outMsg.writeString(getName(), 24);
outMsg.writeInt8(5);
outMsg.writeInt8(5);
diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp
index 9fa57be8..bf7b60ed 100644
--- a/src/gui/npc_text.cpp
+++ b/src/gui/npc_text.cpp
@@ -136,8 +136,7 @@ void NpcTextDialog::nextDialog(int npcID)
#ifdef TMWSERV_SUPPORT
Net::GameServer::Player::talkToNPC(npcID, false);
#else
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_NPC_NEXT_REQUEST);
+ MessageOut outMsg(CMSG_NPC_NEXT_REQUEST);
outMsg.writeInt32(npcID);
#endif
}
@@ -145,8 +144,7 @@ void NpcTextDialog::nextDialog(int npcID)
void NpcTextDialog::closeDialog(int npcID)
{
#ifdef EATHENA_SUPPORT
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_NPC_CLOSE);
+ MessageOut outMsg(CMSG_NPC_CLOSE);
outMsg.writeInt32(npcID);
#endif
}
diff --git a/src/gui/npcintegerdialog.cpp b/src/gui/npcintegerdialog.cpp
index a7ae2748..4dae8d83 100644
--- a/src/gui/npcintegerdialog.cpp
+++ b/src/gui/npcintegerdialog.cpp
@@ -127,8 +127,7 @@ void NpcIntegerDialog::action(const gcn::ActionEvent &event)
NPC::isTalking = false;
#ifdef EATHENA_SUPPORT
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_NPC_INT_RESPONSE);
+ MessageOut outMsg(CMSG_NPC_INT_RESPONSE);
outMsg.writeInt32(current_npc);
outMsg.writeInt32(mValueField->getValue());
#endif
diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp
index ff91c9fc..6df0979f 100644
--- a/src/gui/npclistdialog.cpp
+++ b/src/gui/npclistdialog.cpp
@@ -143,8 +143,7 @@ void NpcListDialog::action(const gcn::ActionEvent &event)
#ifdef TMWSERV_SUPPORT
Net::GameServer::Player::selectFromNPC(current_npc, choice);
#else
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_NPC_LIST_CHOICE);
+ MessageOut outMsg(CMSG_NPC_LIST_CHOICE);
outMsg.writeInt32(current_npc);
outMsg.writeInt8(choice);
#endif
diff --git a/src/gui/npcstringdialog.cpp b/src/gui/npcstringdialog.cpp
index c84de015..7297d7e8 100644
--- a/src/gui/npcstringdialog.cpp
+++ b/src/gui/npcstringdialog.cpp
@@ -95,8 +95,7 @@ void NpcStringDialog::action(const gcn::ActionEvent &event)
mValueField->setText("");
#ifdef EATHENA_SUPPORT
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_NPC_STR_RESPONSE);
+ MessageOut outMsg(CMSG_NPC_STR_RESPONSE);
outMsg.writeInt16(text.length() + 9);
outMsg.writeInt32(current_npc);
outMsg.writeString(text, text.length());
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 5b5b2b8c..1f36ef45 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -297,8 +297,7 @@ void PopupMenu::handleLink(const std::string &link)
being &&
being->getType() == Being::PLAYER)
{
- MessageOut outMsg(player_node->getNetwork());
- outMsg.writeInt16(CMSG_PARTY_INVITE);
+ MessageOut outMsg(CMSG_PARTY_INVITE);
outMsg.writeInt32(being->getId());
}
#endif
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index e7671110..648bff08 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -207,15 +207,13 @@ void SellDialog::action(const gcn::ActionEvent &event)
(mShopItems->at(selectedItem)->getId(), mAmountItems);
#else
// Attempt sell
- MessageOut outMsg(mNetwork);
-
ShopItem *item = mShopItems->at(selectedItem);
int sellCount;
mPlayerMoney +=
mAmountItems * mShopItems->at(selectedItem)->getPrice();
mMaxItems -= mAmountItems;
while (mAmountItems > 0) {
- outMsg.writeInt16(CMSG_NPC_SELL_REQUEST);
+ MessageOut outMsg(CMSG_NPC_SELL_REQUEST);
outMsg.writeInt16(8);
outMsg.writeInt16(item->getCurrentInvIndex());
// This order is important, item->getCurrentInvIndex() would return
diff --git a/src/gui/storagewindow.cpp b/src/gui/storagewindow.cpp
index 1289a4e7..847886cb 100644
--- a/src/gui/storagewindow.cpp
+++ b/src/gui/storagewindow.cpp
@@ -190,22 +190,19 @@ Item* StorageWindow::getSelectedItem() const
void StorageWindow::addStore(Item* item, int ammount)
{
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_MOVE_TO_STORAGE);
+ MessageOut outMsg(CMSG_MOVE_TO_STORAGE);
outMsg.writeInt16(item->getInvIndex());
outMsg.writeInt32(ammount);
}
void StorageWindow::removeStore(Item* item, int ammount)
{
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CSMG_MOVE_FROM_STORAGE);
+ MessageOut outMsg(CSMG_MOVE_FROM_STORAGE);
outMsg.writeInt16(item->getInvIndex());
outMsg.writeInt32(ammount);
}
void StorageWindow::close()
{
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_CLOSE_STORAGE);
+ MessageOut outMsg(CMSG_CLOSE_STORAGE);
}
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index 4ecdede8..6cba1c41 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -252,8 +252,7 @@ void TradeWindow::tradeItem(Item *item, int quantity)
// function. Detect the actual server version, and re-enable this
// for that version only.
//addItem(item->getId(), true, quantity, item->isEquipment());
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_TRADE_ITEM_ADD_REQUEST);
+ MessageOut outMsg(CMSG_TRADE_ITEM_ADD_REQUEST);
outMsg.writeInt16(item->getInvIndex());
outMsg.writeInt32(quantity);
#endif
@@ -329,8 +328,7 @@ void TradeWindow::action(const gcn::ActionEvent &event)
#ifdef TMWSERV_SUPPORT
Net::GameServer::Player::acceptTrade(false);
#else
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_TRADE_CANCEL_REQUEST);
+ MessageOut outMsg(CMSG_TRADE_CANCEL_REQUEST);
#endif
}
#ifdef EATHENA_SUPPORT
@@ -342,8 +340,7 @@ void TradeWindow::action(const gcn::ActionEvent &event)
{
mMoneyField->setText(toString(tempInt));
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_TRADE_ITEM_ADD_REQUEST);
+ MessageOut outMsg(CMSG_TRADE_ITEM_ADD_REQUEST);
outMsg.writeInt16(0);
outMsg.writeInt32(tempInt);
}
@@ -352,8 +349,7 @@ void TradeWindow::action(const gcn::ActionEvent &event)
mMoneyField->setText("");
}
mMoneyField->setEnabled(false);
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_TRADE_ADD_COMPLETE);
+ MessageOut outMsg(CMSG_TRADE_ADD_COMPLETE);
}
#endif
else if (event.getId() == "trade")
@@ -362,8 +358,7 @@ void TradeWindow::action(const gcn::ActionEvent &event)
Net::GameServer::Player::acceptTrade(true);
setStatus(PROPOSING);
#else
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_TRADE_OK);
+ MessageOut outMsg(CMSG_TRADE_OK);
#endif
}
#ifdef TMWSERV_SUPPORT
@@ -382,7 +377,6 @@ void TradeWindow::close()
#ifdef TMWSERV_SUPPORT
Net::GameServer::Player::acceptTrade(false);
#else
- MessageOut outMsg(mNetwork);
- outMsg.writeInt16(CMSG_TRADE_CANCEL_REQUEST);
+ MessageOut outMsg(CMSG_TRADE_CANCEL_REQUEST);
#endif
}
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index 715aaf20..c4b2196b 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -239,9 +239,7 @@ void ChatTab::chatInput(std::string &msg)
chatLog(_("Trying to send a blank party message."), BY_SERVER, true);
return;
}
- MessageOut outMsg(chatWindow->mNetwork);
-
- outMsg.writeInt16(CMSG_PARTY_MESSAGE);
+ MessageOut outMsg(CMSG_PARTY_MESSAGE);
outMsg.writeInt16(length + 4);
outMsg.writeString(msg, length);
return;
@@ -306,8 +304,7 @@ void ChatTab::handleInput(const std::string &msg) {
#else
std::string mes = player_node->getName() + " : " + msg;
- MessageOut outMsg(chatWindow->mNetwork);
- outMsg.writeInt16(CMSG_CHAT_MESSAGE);
+ MessageOut outMsg(CMSG_CHAT_MESSAGE);
// Added + 1 in order to let eAthena parse admin commands correctly
outMsg.writeInt16(mes.length() + 4 + 1);
outMsg.writeString(mes, mes.length() + 1);
diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp
index 0ae042df..1621e965 100644
--- a/src/gui/widgets/whispertab.cpp
+++ b/src/gui/widgets/whispertab.cpp
@@ -57,8 +57,7 @@ void WhisperTab::handleInput(const std::string &msg) {
#ifdef TMWSERV_SUPPORT
Net::ChatServer::privMsg(mNick, msg);
#else
- MessageOut outMsg(chatWindow->mNetwork);
- outMsg.writeInt16(CMSG_CHAT_WHISPER);
+ MessageOut outMsg(CMSG_CHAT_WHISPER);
outMsg.writeInt16(msg.length() + 28);
outMsg.writeString(mNick, 24);
outMsg.writeString(msg, msg.length());