summaryrefslogtreecommitdiff
path: root/src/net/tmwa
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2010-09-25 03:15:26 +0200
committerThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2010-09-25 03:15:26 +0200
commit661d16e98c62dfff40f481177bf3f1a0c58c2124 (patch)
treea415866c4c94a0a0c53045a47220ca413ae9c5c9 /src/net/tmwa
parent758d80263b1647c712c0e0cdd3dfca9945a1bb7e (diff)
parent7d0738df0d139af3175fcc1fec5b9be4a467f4f4 (diff)
downloadmana-client-661d16e98c62dfff40f481177bf3f1a0c58c2124.tar.gz
mana-client-661d16e98c62dfff40f481177bf3f1a0c58c2124.tar.bz2
mana-client-661d16e98c62dfff40f481177bf3f1a0c58c2124.tar.xz
mana-client-661d16e98c62dfff40f481177bf3f1a0c58c2124.zip
Merge branch '1.0'
Conflicts: src/actorspritemanager.h src/beingmanager.cpp src/game.cpp src/gui/beingpopup.cpp src/gui/chat.cpp src/gui/chat.h src/gui/inventorywindow.h src/gui/itempopup.cpp src/gui/socialwindow.cpp src/gui/statuswindow.cpp src/gui/widgets/chattab.cpp src/gui/widgets/chattab.h src/net/tmwa/inventoryhandler.cpp src/net/tmwa/partyhandler.cpp src/party.cpp src/sound.cpp src/utils/stringutils.cpp src/utils/stringutils.h
Diffstat (limited to 'src/net/tmwa')
-rw-r--r--src/net/tmwa/beinghandler.cpp8
-rw-r--r--src/net/tmwa/charserverhandler.cpp3
-rw-r--r--src/net/tmwa/guildhandler.cpp2
-rw-r--r--src/net/tmwa/inventoryhandler.cpp25
-rw-r--r--src/net/tmwa/inventoryhandler.h2
-rw-r--r--src/net/tmwa/network.cpp2
-rw-r--r--src/net/tmwa/partyhandler.cpp20
-rw-r--r--src/net/tmwa/playerhandler.cpp4
8 files changed, 53 insertions, 13 deletions
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index 543beec2..97967eb9 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -47,6 +47,7 @@ BeingHandler::BeingHandler(bool enableSync):
static const Uint16 _messages[] = {
SMSG_BEING_VISIBLE,
SMSG_BEING_MOVE,
+ SMSG_BEING_SPAWN,
SMSG_BEING_MOVE2,
SMSG_BEING_REMOVE,
SMSG_SKILL_DAMAGE,
@@ -227,6 +228,13 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
dstBeing->setStatusEffectBlock(16, statusEffects & 0xffff);
break;
+ case SMSG_BEING_SPAWN:
+ /*
+ * TODO: This packet might need handling in the future.
+ */
+ // Do nothing.
+ break;
+
case SMSG_BEING_MOVE2:
/*
* A simplified movement packet, used by the
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index 820864ce..1063ee39 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -77,6 +77,9 @@ void CharServerHandler::handleMessage(Net::MessageIn &msg)
msg.skip(2); // Length word
msg.skip(20); // Unused
+ delete_all(mCharacters);
+ mCharacters.clear();
+
// Derive number of characters from message length
const int count = (msg.getLength() - 24) / 106;
diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp
index 67fe5d98..39d49bc7 100644
--- a/src/net/tmwa/guildhandler.cpp
+++ b/src/net/tmwa/guildhandler.cpp
@@ -119,7 +119,7 @@ void GuildHandler::handleMessage(Net::MessageIn &msg)
msg.readInt8(); // Unused
std::string guildName = msg.readString(24);
- logger->log("Guild position info: %d %d %d %s\n", guildId,
+ logger->log("Guild position info: %d %d %d %s", guildId,
emblem, posMode, guildName.c_str());
}
break;
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index 4a46e475..9fac8e8c 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -130,6 +130,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
int index, amount, itemId, equipType, arrow;
int identified, cards[4], itemType;
Inventory *inventory = PlayerInfo::getInventory();
+ PlayerInfo::getEquipment()->setBackend(&mEquips);
switch (msg.getId())
{
@@ -139,8 +140,6 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
{
// Clear inventory - this will be a complete refresh
mEquips.clear();
- PlayerInfo::getEquipment()->setBackend(&mEquips);
-
inventory->clear();
}
else
@@ -242,6 +241,8 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
inventory->setItem(index, itemId, amount);
}
+
+ inventoryWindow->updateButtons();
} break;
case SMSG_PLAYER_INVENTORY_REMOVE:
@@ -252,6 +253,7 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
item->increaseQuantity(-amount);
if (item->getQuantity() == 0)
inventory->removeItemAt(index);
+ inventoryWindow->updateButtons();
}
break;
@@ -263,7 +265,15 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
msg.readInt8(); // type
if (Item *item = inventory->getItem(index))
- item->setQuantity(amount);
+ {
+ if (amount)
+ item->setQuantity(amount);
+ else
+ inventory->removeItemAt(index);
+
+ inventoryWindow->updateButtons();
+ }
+
break;
case SMSG_ITEM_USE_RESPONSE:
@@ -277,7 +287,14 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg)
else
{
if (Item *item = inventory->getItem(index))
- item->setQuantity(amount);
+ {
+ if (amount)
+ item->setQuantity(amount);
+ else
+ inventory->removeItemAt(index);
+
+ inventoryWindow->updateButtons();
+ }
}
break;
diff --git a/src/net/tmwa/inventoryhandler.h b/src/net/tmwa/inventoryhandler.h
index 18d73517..79d3bc65 100644
--- a/src/net/tmwa/inventoryhandler.h
+++ b/src/net/tmwa/inventoryhandler.h
@@ -88,6 +88,8 @@ class EquipBackend : public Equipment::Backend {
{
item->setEquipped(true);
}
+
+ inventoryWindow->updateButtons();
}
private:
diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp
index ddfbbc5d..aff19b11 100644
--- a/src/net/tmwa/network.cpp
+++ b/src/net/tmwa/network.cpp
@@ -326,7 +326,7 @@ MessageIn Network::getNextMessage()
len = readWord(2);
#ifdef DEBUG
- logger->log("Received packet 0x%x of length %d\n", msgId, len);
+ logger->log("Received packet 0x%x of length %d", msgId, len);
#endif
MessageIn msg(mInBuffer, len);
diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp
index 3d7aa263..00b1e621 100644
--- a/src/net/tmwa/partyhandler.cpp
+++ b/src/net/tmwa/partyhandler.cpp
@@ -184,7 +184,7 @@ void PartyHandler::handleMessage(Net::MessageIn &msg)
partyTab->chatLog(_("Experience sharing not possible."), BY_SERVER);
break;
default:
- logger->log("Unknown party exp option: %d\n", exp);
+ logger->log("Unknown party exp option: %d", exp);
}
switch (item)
@@ -208,7 +208,7 @@ void PartyHandler::handleMessage(Net::MessageIn &msg)
partyTab->chatLog(_("Item sharing not possible."), BY_SERVER);
break;
default:
- logger->log("Unknown party item option: %d\n", exp);
+ logger->log("Unknown party item option: %d", exp);
}
break;
}
@@ -322,17 +322,23 @@ void PartyHandler::invite(Being *being)
void PartyHandler::invite(const std::string &name)
{
- if (partyTab)
+ Being *invitee = actorSpriteManager->findBeingByName(name, Being::PLAYER);
+
+ if (invitee)
{
- partyTab->chatLog(_("Inviting like this isn't supported at the moment."),
- BY_SERVER);
+ invite(invitee);
+ partyTab->chatLog(strprintf(_("Invited user %s to party."),
+ invitee->getName().c_str()), BY_SERVER);
+ }
+ else if (partyTab)
+ {
+ partyTab->chatLog(strprintf(_("Inviting failed, because you can't see "
+ "a player called %s."), name.c_str()), BY_SERVER);
}
else
{
SERVER_NOTICE(_("You can only inivte when you are in a party!"))
}
-
- // TODO?
}
void PartyHandler::inviteResponse(const std::string &inviter, bool accept)
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp
index 6a1e8918..ca42a5c9 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -286,6 +286,10 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg)
player_node->setAction(Being::DEAD);
}
}
+
+ if (statusWindow)
+ statusWindow->updateAttrs();
+
break;
case SMSG_PLAYER_STAT_UPDATE_2: