summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/buy.cpp8
-rw-r--r--src/gui/buysell.cpp6
-rw-r--r--src/gui/char_select.cpp102
-rw-r--r--src/gui/char_server.cpp78
-rw-r--r--src/gui/chat.cpp4
-rw-r--r--src/gui/connection.cpp16
-rw-r--r--src/gui/login.cpp22
-rw-r--r--src/gui/npc.cpp6
-rw-r--r--src/gui/npc_text.cpp4
-rw-r--r--src/gui/popupmenu.cpp14
-rw-r--r--src/gui/requesttrade.cpp8
-rw-r--r--src/gui/sell.cpp8
-rw-r--r--src/gui/skill.cpp4
-rw-r--r--src/gui/status.cpp16
-rw-r--r--src/gui/trade.cpp18
15 files changed, 157 insertions, 157 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index 185709d1..f918d45a 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -237,10 +237,10 @@ void BuyDialog::action(const std::string& eventId)
else if (eventId == "buy" && (m_amountItems > 0 &&
m_amountItems <= m_maxItems)) {
MessageOut outMsg;
- outMsg.writeShort(CMSG_NPC_BUY_REQUEST);
- outMsg.writeShort(8);
- outMsg.writeShort(m_amountItems);
- outMsg.writeShort(shopInventory[selectedItem].id);
+ outMsg.writeInt16(CMSG_NPC_BUY_REQUEST);
+ outMsg.writeInt16(8);
+ outMsg.writeInt16(m_amountItems);
+ outMsg.writeInt16(shopInventory[selectedItem].id);
// update money !
m_money -= m_amountItems * shopInventory[selectedItem].price;
diff --git a/src/gui/buysell.cpp b/src/gui/buysell.cpp
index 1f40e7b5..627d119f 100644
--- a/src/gui/buysell.cpp
+++ b/src/gui/buysell.cpp
@@ -82,9 +82,9 @@ void BuySellDialog::action(const std::string& eventId)
}
if (actionId > -1) {
MessageOut outMsg;
- outMsg.writeShort(CMSG_NPC_BUY_SELL_REQUEST);
- outMsg.writeLong(current_npc);
- outMsg.writeByte(actionId);
+ outMsg.writeInt16(CMSG_NPC_BUY_SELL_REQUEST);
+ outMsg.writeInt32(current_npc);
+ outMsg.writeInt8(actionId);
}
setVisible(false);
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index 46ead1dc..a22a25de 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -195,8 +195,8 @@ void CharSelectDialog::serverCharDelete()
{
// Request character deletion
MessageOut outMsg;
- outMsg.writeShort(0x0068);
- outMsg.writeLong(char_info[0]->id);
+ outMsg.writeInt16(0x0068);
+ outMsg.writeInt32(char_info[0]->id);
outMsg.writeString("a@a.com", 40);
MessageIn msg = get_next_message();
@@ -225,8 +225,8 @@ void CharSelectDialog::serverCharSelect()
{
// Request character selection
MessageOut outMsg;
- outMsg.writeShort(0x0066);
- outMsg.writeByte(0);
+ outMsg.writeInt16(0x0066);
+ outMsg.writeInt8(0);
MessageIn msg = get_next_message();
@@ -235,11 +235,11 @@ void CharSelectDialog::serverCharSelect()
if (msg.getId() == 0x0071)
{
- char_ID = msg.readLong();
+ char_ID = msg.readInt32();
map_path = "maps/" + msg.readString(16);
map_path= map_path.substr(0, map_path.rfind(".")) + ".tmx.gz";
- map_address = msg.readLong();
- map_port = msg.readShort();
+ map_address = msg.readInt32();
+ map_port = msg.readInt16();
player_info = char_info[0];
state = CONNECTING_STATE;
@@ -250,7 +250,7 @@ void CharSelectDialog::serverCharSelect()
}
else if (msg.getId() == 0x006c)
{
- switch (msg.readByte()) {
+ switch (msg.readInt8()) {
case 0:
errorMessage = "Access denied";
break;
@@ -265,7 +265,7 @@ void CharSelectDialog::serverCharSelect()
}
else if (msg.getId() == 0x0081)
{
- switch (msg.readByte()) {
+ switch (msg.readInt8()) {
case 1:
errorMessage = "Map server offline";
break;
@@ -416,17 +416,17 @@ void CharCreateDialog::serverCharCreate()
{
// Send character infos
MessageOut outMsg;
- outMsg.writeShort(0x0067);
+ outMsg.writeInt16(0x0067);
outMsg.writeString(getName(), 24);
- outMsg.writeByte(5);
- outMsg.writeByte(5);
- outMsg.writeByte(5);
- outMsg.writeByte(5);
- outMsg.writeByte(5);
- outMsg.writeByte(5);
- outMsg.writeByte(0);
- outMsg.writeShort(playerBox->hairColor + 1);
- outMsg.writeShort(playerBox->hairStyle + 1);
+ outMsg.writeInt8(5);
+ outMsg.writeInt8(5);
+ outMsg.writeInt8(5);
+ outMsg.writeInt8(5);
+ outMsg.writeInt8(5);
+ outMsg.writeInt8(5);
+ outMsg.writeInt8(0);
+ outMsg.writeInt16(playerBox->hairColor + 1);
+ outMsg.writeInt16(playerBox->hairStyle + 1);
MessageIn msg = get_next_message();
@@ -435,41 +435,41 @@ void CharCreateDialog::serverCharCreate()
char_info = (PLAYER_INFO**)malloc(sizeof(PLAYER_INFO*));
char_info[0] = new PLAYER_INFO;
- char_info[0]->id = msg.readLong();
- char_info[0]->xp = msg.readLong();
- char_info[0]->gp = msg.readLong();
- char_info[0]->jobXp = msg.readLong();
- char_info[0]->jobLvl = msg.readLong();
+ char_info[0]->id = msg.readInt32();
+ char_info[0]->xp = msg.readInt32();
+ char_info[0]->gp = msg.readInt32();
+ char_info[0]->jobXp = msg.readInt32();
+ char_info[0]->jobLvl = msg.readInt32();
msg.skip(8); // unknown
- msg.readLong(); // option
- msg.readLong(); // karma
- msg.readLong(); // manner
+ msg.readInt32(); // option
+ msg.readInt32(); // karma
+ msg.readInt32(); // manner
msg.skip(2); // unknown
- char_info[0]->hp = msg.readShort();
- char_info[0]->maxHp = msg.readShort();
- char_info[0]->mp = msg.readShort();
- char_info[0]->maxMp = msg.readShort();
- msg.readShort(); // speed
- msg.readShort(); // class
- char_info[0]->hairStyle = msg.readShort();
- char_info[0]->weapon = msg.readShort();
- char_info[0]->lvl = msg.readShort();
- msg.readShort(); // skill point
- msg.readShort(); // head bottom
- msg.readShort(); // shield
- msg.readShort(); // head option top
- msg.readShort(); // head option mid
- char_info[0]->hairColor = msg.readShort();
- msg.readShort(); // unknown
+ char_info[0]->hp = msg.readInt16();
+ char_info[0]->maxHp = msg.readInt16();
+ char_info[0]->mp = msg.readInt16();
+ char_info[0]->maxMp = msg.readInt16();
+ msg.readInt16(); // speed
+ msg.readInt16(); // class
+ char_info[0]->hairStyle = msg.readInt16();
+ char_info[0]->weapon = msg.readInt16();
+ char_info[0]->lvl = msg.readInt16();
+ msg.readInt16(); // skill point
+ msg.readInt16(); // head bottom
+ msg.readInt16(); // shield
+ msg.readInt16(); // head option top
+ msg.readInt16(); // head option mid
+ char_info[0]->hairColor = msg.readInt16();
+ msg.readInt16(); // unknown
char_info[0]->name = msg.readString(24);
- char_info[0]->STR = msg.readByte();
- char_info[0]->AGI = msg.readByte();
- char_info[0]->VIT = msg.readByte();
- char_info[0]->INT = msg.readByte();
- char_info[0]->DEX = msg.readByte();
- char_info[0]->LUK = msg.readByte();
- char_info[0]->characterNumber = msg.readByte(); // character number
- msg.readByte(); // unknown
+ char_info[0]->STR = msg.readInt8();
+ char_info[0]->AGI = msg.readInt8();
+ char_info[0]->VIT = msg.readInt8();
+ char_info[0]->INT = msg.readInt8();
+ char_info[0]->DEX = msg.readInt8();
+ char_info[0]->LUK = msg.readInt8();
+ char_info[0]->characterNumber = msg.readInt8(); // character number
+ msg.readInt8(); // unknown
n_character = 1;
}
diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp
index 22ac484b..4135d9c5 100644
--- a/src/gui/char_server.cpp
+++ b/src/gui/char_server.cpp
@@ -160,12 +160,12 @@ void ServerSelectDialog::selectServer(int index)
{
// Send login infos
MessageOut outMsg;
- outMsg.writeShort(0x0065);
- outMsg.writeLong(account_ID);
- outMsg.writeLong(session_ID1);
- outMsg.writeLong(session_ID2);
- outMsg.writeShort(0); // unknown
- outMsg.writeByte(sex);
+ outMsg.writeInt16(0x0065);
+ outMsg.writeInt32(account_ID);
+ outMsg.writeInt32(session_ID1);
+ outMsg.writeInt32(session_ID2);
+ outMsg.writeInt16(0); // unknown
+ outMsg.writeInt8(sex);
// Skipping a mysterious 4 bytes
while ((in_size < 4) || (out_size > 0)) flush();
@@ -189,41 +189,41 @@ void ServerSelectDialog::selectServer(int index)
char_info[i]->totalWeight = 0;
char_info[i]->maxWeight = 0;
char_info[i]->lastAttackTime = 0;
- char_info[i]->id = msg.readLong();
- char_info[i]->xp = msg.readLong();
- char_info[i]->gp = msg.readLong();
- char_info[i]->jobXp = msg.readLong();
- char_info[i]->jobLvl = msg.readLong();
+ char_info[i]->id = msg.readInt32();
+ char_info[i]->xp = msg.readInt32();
+ char_info[i]->gp = msg.readInt32();
+ char_info[i]->jobXp = msg.readInt32();
+ char_info[i]->jobLvl = msg.readInt32();
msg.skip(8); // unknown
- msg.readLong(); // option
- msg.readLong(); // karma
- msg.readLong(); // manner
+ msg.readInt32(); // option
+ msg.readInt32(); // karma
+ msg.readInt32(); // manner
msg.skip(2); // unknown
- char_info[i]->hp = msg.readShort();
- char_info[i]->maxHp = msg.readShort();
- char_info[i]->mp = msg.readShort();
- char_info[i]->maxMp = msg.readShort();
- msg.readShort(); // speed
- msg.readShort(); // class
- char_info[i]->hairStyle = msg.readShort();
- char_info[i]->weapon = msg.readShort();
- char_info[i]->lvl = msg.readShort();
- msg.readShort(); // skill point
- msg.readShort(); // head bottom
- msg.readShort(); // shield
- msg.readShort(); // head option top
- msg.readShort(); // head option mid
- char_info[i]->hairColor = msg.readShort();
- msg.readShort(); // unknown
+ char_info[i]->hp = msg.readInt16();
+ char_info[i]->maxHp = msg.readInt16();
+ char_info[i]->mp = msg.readInt16();
+ char_info[i]->maxMp = msg.readInt16();
+ msg.readInt16(); // speed
+ msg.readInt16(); // class
+ char_info[i]->hairStyle = msg.readInt16();
+ char_info[i]->weapon = msg.readInt16();
+ char_info[i]->lvl = msg.readInt16();
+ msg.readInt16(); // skill point
+ msg.readInt16(); // head bottom
+ msg.readInt16(); // shield
+ msg.readInt16(); // head option top
+ msg.readInt16(); // head option mid
+ char_info[i]->hairColor = msg.readInt16();
+ msg.readInt16(); // unknown
char_info[i]->name = msg.readString(24);
- char_info[i]->STR = msg.readByte();
- char_info[i]->AGI = msg.readByte();
- char_info[i]->VIT = msg.readByte();
- char_info[i]->INT = msg.readByte();
- char_info[i]->DEX = msg.readByte();
- char_info[i]->LUK = msg.readByte();
- char_info[i]->characterNumber = msg.readByte(); // character number
- msg.readByte(); // unknown
+ char_info[i]->STR = msg.readInt8();
+ char_info[i]->AGI = msg.readInt8();
+ char_info[i]->VIT = msg.readInt8();
+ char_info[i]->INT = msg.readInt8();
+ char_info[i]->DEX = msg.readInt8();
+ char_info[i]->LUK = msg.readInt8();
+ char_info[i]->characterNumber = msg.readInt8(); // character number
+ msg.readInt8(); // unknown
}
state = CHAR_SELECT_STATE;
@@ -236,7 +236,7 @@ void ServerSelectDialog::selectServer(int index)
else if (msg.getId() == 0x006c)
{
std::string errorStr;
- switch (msg.readByte()) {
+ switch (msg.readInt8()) {
case 0: errorStr = "Access denied"; break;
case 1: errorStr = "Cannot use this ID"; break;
default: errorStr = "Rejected from server"; break;
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 7e1458c9..20deb1a7 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -251,8 +251,8 @@ ChatWindow::chat_send(std::string nick, std::string msg)
// send processed message
MessageOut outMsg;
- outMsg.writeShort(packetId);
- outMsg.writeShort(msg.length() + 4);
+ outMsg.writeInt16(packetId);
+ outMsg.writeInt16(msg.length() + 4);
outMsg.writeString(msg, msg.length());
}
diff --git a/src/gui/connection.cpp b/src/gui/connection.cpp
index 0e885598..bfa69f23 100644
--- a/src/gui/connection.cpp
+++ b/src/gui/connection.cpp
@@ -104,12 +104,12 @@ void ConnectionDialog::mapLogin()
{
// Send login infos
MessageOut outMsg;
- outMsg.writeShort(0x0072);
- outMsg.writeLong(account_ID);
- outMsg.writeLong(char_ID);
- outMsg.writeLong(session_ID1);
- outMsg.writeLong(session_ID2);
- outMsg.writeByte(sex);
+ outMsg.writeInt16(0x0072);
+ outMsg.writeInt32(account_ID);
+ outMsg.writeInt32(char_ID);
+ outMsg.writeInt32(session_ID1);
+ outMsg.writeInt32(session_ID2);
+ outMsg.writeInt8(sex);
// Skip a mysterious 4 bytes
while ((in_size < 4)|| (out_size > 0)) flush();
@@ -120,7 +120,7 @@ void ConnectionDialog::mapLogin()
if (msg.getId() == SMSG_LOGIN_SUCCESS)
{
unsigned char direction;
- msg.readLong(); // server tick
+ msg.readInt32(); // server tick
msg.readCoordinates(startX, startY, direction);
msg.skip(2); // unknown
logger->log("Protocol: Player start position: (%d, %d), Direction: %d",
@@ -140,7 +140,7 @@ void ConnectionDialog::mapLogin()
// Send "map loaded"
// TODO: be able to reuse the same msg
MessageOut newMsg;
- newMsg.writeShort(0x007d);
+ newMsg.writeInt16(0x007d);
}
void connectionInputHandler(SDL_KeyboardEvent *keyEvent)
diff --git a/src/gui/login.cpp b/src/gui/login.cpp
index 6846059c..4f08216b 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -342,11 +342,11 @@ LoginDialog::attemptLogin(const std::string& user, const std::string& pass)
{
// Send login infos
MessageOut outMsg;
- outMsg.writeShort(0x0064);
- outMsg.writeLong(0); // client version
+ outMsg.writeInt16(0x0064);
+ outMsg.writeInt32(0); // client version
outMsg.writeString(user, 24);
outMsg.writeString(pass, 24);
- outMsg.writeByte(0); // unknown
+ outMsg.writeInt8(0); // unknown
// Receive reply
MessageIn msg = get_next_message();
@@ -365,20 +365,20 @@ LoginDialog::attemptLogin(const std::string& user, const std::string& pass)
n_server = (msg.getLength() - 47) / 32;
server_info = (SERVER_INFO**)malloc(sizeof(SERVER_INFO*) * n_server);
- session_ID1 = msg.readLong();
- account_ID = msg.readLong();
- session_ID2 = msg.readLong();
+ session_ID1 = msg.readInt32();
+ account_ID = msg.readInt32();
+ session_ID2 = msg.readInt32();
msg.skip(30); // unknown
- sex = msg.readByte();
+ sex = msg.readInt8();
for (int i = 0; i < n_server; i++)
{
server_info[i] = new SERVER_INFO;
- server_info[i]->address = msg.readLong();
- server_info[i]->port = msg.readShort();
+ server_info[i]->address = msg.readInt32();
+ server_info[i]->port = msg.readInt16();
server_info[i]->name = msg.readString(20);
- server_info[i]->online_users = msg.readLong();
+ server_info[i]->online_users = msg.readInt32();
msg.skip(2); // unknown
logger->log("Network: Server: %s (%s:%d)",
@@ -392,7 +392,7 @@ LoginDialog::attemptLogin(const std::string& user, const std::string& pass)
}
else if (msg.getId() == 0x006a)
{
- int loginError = msg.readByte();
+ int loginError = msg.readInt8();
logger->log("Login::error code: %i", loginError);
switch (loginError) {
diff --git a/src/gui/npc.cpp b/src/gui/npc.cpp
index 16641916..68856705 100644
--- a/src/gui/npc.cpp
+++ b/src/gui/npc.cpp
@@ -129,9 +129,9 @@ NpcListDialog::action(const std::string& eventId)
if (choice)
{
MessageOut outMsg;
- outMsg.writeShort(CMSG_NPC_LIST_CHOICE);
- outMsg.writeLong(current_npc);
- outMsg.writeByte(choice);
+ outMsg.writeInt16(CMSG_NPC_LIST_CHOICE);
+ outMsg.writeInt32(current_npc);
+ outMsg.writeInt8(choice);
setVisible(false);
reset();
current_npc = 0;
diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp
index 2e0b0837..5f5ea9cb 100644
--- a/src/gui/npc_text.cpp
+++ b/src/gui/npc_text.cpp
@@ -83,8 +83,8 @@ NpcTextDialog::action(const std::string& eventId)
if (eventId == "ok")
{
MessageOut outMsg;
- outMsg.writeShort(CMSG_NPC_NEXT_REQUEST);
- outMsg.writeLong(current_npc);
+ outMsg.writeInt16(CMSG_NPC_NEXT_REQUEST);
+ outMsg.writeInt32(current_npc);
setText("");
setVisible(false);
current_npc = 0;
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 6bb57f60..e6d3b402 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -135,9 +135,9 @@ void PopupMenu::handleLink(const std::string& link)
current_npc == 0)
{
MessageOut outMsg;
- outMsg.writeShort(CMSG_NPC_TALK);
- outMsg.writeLong(mBeing->getId());
- outMsg.writeByte(0);
+ outMsg.writeInt16(CMSG_NPC_TALK);
+ outMsg.writeInt32(mBeing->getId());
+ outMsg.writeInt8(0);
current_npc = mBeing->getId();
}
@@ -147,8 +147,8 @@ void PopupMenu::handleLink(const std::string& link)
mBeing->getType() == Being::PLAYER)
{
MessageOut outMsg;
- outMsg.writeShort(CMSG_TRADE_REQUEST);
- outMsg.writeLong(mBeing->getId());
+ outMsg.writeInt16(CMSG_TRADE_REQUEST);
+ outMsg.writeInt32(mBeing->getId());
//tradePartner.flush();
//tradePartner << "Trade: You and " << being->name<< "";
tradePartnerName = mBeing->getName();
@@ -183,8 +183,8 @@ void PopupMenu::handleLink(const std::string& link)
else if ((link == "pickup") && mFloorItem != NULL)
{
MessageOut outMsg;
- outMsg.writeShort(CMSG_ITEM_PICKUP);
- outMsg.writeLong(mFloorItem->getId());
+ outMsg.writeInt16(CMSG_ITEM_PICKUP);
+ outMsg.writeInt32(mFloorItem->getId());
}
// Look To action
diff --git a/src/gui/requesttrade.cpp b/src/gui/requesttrade.cpp
index e4423c59..6c7ef2ce 100644
--- a/src/gui/requesttrade.cpp
+++ b/src/gui/requesttrade.cpp
@@ -87,16 +87,16 @@ RequestTradeDialog::~RequestTradeDialog()
void RequestTradeDialog::action(const std::string& eventId)
{
int choice = 4; // 4 means trade canceled
-
+
if (eventId == "accept") {
choice = 3; // ok to trade
}
else if (eventId == "cancel") {
requestTradeDialogOpen = false;
}
-
+
MessageOut outMsg;
- outMsg.writeShort(CMSG_TRADE_RESPONSE);
- outMsg.writeByte(choice);
+ outMsg.writeInt16(CMSG_TRADE_RESPONSE);
+ outMsg.writeInt8(choice);
scheduleDelete();
}
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index 73880861..a147fa44 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -232,10 +232,10 @@ void SellDialog::action(const std::string& eventId)
assert(m_amountItems > 0 && m_amountItems <= m_maxItems);
MessageOut outMsg;
- outMsg.writeShort(CMSG_NPC_SELL_REQUEST);
- outMsg.writeShort(8);
- outMsg.writeShort(shopInventory[selectedItem].index);
- outMsg.writeShort(m_amountItems);
+ outMsg.writeInt16(CMSG_NPC_SELL_REQUEST);
+ outMsg.writeInt16(8);
+ outMsg.writeInt16(shopInventory[selectedItem].index);
+ outMsg.writeInt16(m_amountItems);
m_maxItems -= m_amountItems;
m_amountItems = 0;
diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp
index b65fcfd9..c2e09819 100644
--- a/src/gui/skill.cpp
+++ b/src/gui/skill.cpp
@@ -133,8 +133,8 @@ void SkillDialog::action(const std::string& eventId)
if (player_info->skillPoint > 0 && selectedSkill >= 0)
{
MessageOut outMsg;
- outMsg.writeShort(CMSG_SKILL_LEVELUP_REQUEST);
- outMsg.writeShort(skillList[selectedSkill]->id);
+ outMsg.writeInt16(CMSG_SKILL_LEVELUP_REQUEST);
+ outMsg.writeInt16(skillList[selectedSkill]->id);
}
}
else if (eventId == "skill")
diff --git a/src/gui/status.cpp b/src/gui/status.cpp
index f5302e95..0c20b6fc 100644
--- a/src/gui/status.cpp
+++ b/src/gui/status.cpp
@@ -454,32 +454,32 @@ void StatusWindow::action(const std::string& eventId)
if (eventId.length() == 3)
{
MessageOut outMsg;
- outMsg.writeShort(CMSG_STAT_UPDATE_REQUEST);
+ outMsg.writeInt16(CMSG_STAT_UPDATE_REQUEST);
if (eventId == "STR")
{
- outMsg.writeShort(0x000d);
+ outMsg.writeInt16(0x000d);
}
if (eventId == "AGI")
{
- outMsg.writeShort(0x000e);
+ outMsg.writeInt16(0x000e);
}
if (eventId == "VIT")
{
- outMsg.writeShort(0x000f);
+ outMsg.writeInt16(0x000f);
}
if (eventId == "INT")
{
- outMsg.writeShort(0x0010);
+ outMsg.writeInt16(0x0010);
}
if (eventId == "DEX")
{
- outMsg.writeShort(0x0011);
+ outMsg.writeInt16(0x0011);
}
if (eventId == "LUK")
{
- outMsg.writeShort(0x0012);
+ outMsg.writeInt16(0x0012);
}
- outMsg.writeByte(1);
+ outMsg.writeInt8(1);
}
}
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index 19aaab9e..818b8b61 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -242,9 +242,9 @@ void TradeWindow::receivedOk(bool own)
void TradeWindow::tradeItem(Item *item, int quantity)
{
MessageOut outMsg;
- outMsg.writeShort(CMSG_TRADE_ITEM_ADD_REQUEST);
- outMsg.writeShort(item->getInvIndex());
- outMsg.writeLong(quantity);
+ outMsg.writeInt16(CMSG_TRADE_ITEM_ADD_REQUEST);
+ outMsg.writeInt16(item->getInvIndex());
+ outMsg.writeInt32(quantity);
}
void TradeWindow::mouseClick(int x, int y, int button, int count)
@@ -314,7 +314,7 @@ void TradeWindow::action(const std::string &eventId)
else if (eventId == "cancel")
{
MessageOut outMsg;
- outMsg.writeShort(CMSG_TRADE_CANCEL_REQUEST);
+ outMsg.writeInt16(CMSG_TRADE_CANCEL_REQUEST);
}
else if (eventId == "ok")
{
@@ -327,19 +327,19 @@ void TradeWindow::action(const std::string &eventId)
moneyField->setText(tempMoney[1].str());
MessageOut outMsg;
- outMsg.writeShort(CMSG_TRADE_ITEM_ADD_REQUEST);
- outMsg.writeShort(0);
- outMsg.writeLong(tempInt);
+ outMsg.writeInt16(CMSG_TRADE_ITEM_ADD_REQUEST);
+ outMsg.writeInt16(0);
+ outMsg.writeInt32(tempInt);
} else {
moneyField->setText("");
}
moneyField->setEnabled(false);
MessageOut outMsg;
- outMsg.writeShort(CMSG_TRADE_ADD_COMPLETE);
+ outMsg.writeInt16(CMSG_TRADE_ADD_COMPLETE);
}
else if (eventId == "trade")
{
MessageOut outMsg;
- outMsg.writeShort(CMSG_TRADE_OK);
+ outMsg.writeInt16(CMSG_TRADE_OK);
}
}