summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
Diffstat (limited to 'src/net')
-rw-r--r--src/net/charhandler.h2
-rw-r--r--src/net/ea/beinghandler.cpp6
-rw-r--r--src/net/ea/gamehandler.cpp12
-rw-r--r--src/net/ea/gamehandler.h6
-rw-r--r--src/net/ea/gui/partytab.cpp1
-rw-r--r--src/net/ea/inventoryhandler.cpp2
-rw-r--r--src/net/ea/itemhandler.cpp37
-rw-r--r--src/net/ea/itemhandler.h4
-rw-r--r--src/net/ea/loginhandler.cpp1
-rw-r--r--src/net/ea/playerhandler.cpp1
-rw-r--r--src/net/manaserv/chathandler.cpp2
-rw-r--r--src/net/manaserv/generalhandler.cpp14
-rw-r--r--src/net/manaserv/generalhandler.h4
-rw-r--r--src/net/manaserv/guildhandler.cpp2
-rw-r--r--src/net/manaserv/playerhandler.cpp3
-rw-r--r--src/net/net.cpp1
-rw-r--r--src/net/playerhandler.h1
-rw-r--r--src/net/tmwa/generalhandler.cpp10
-rw-r--r--src/net/tmwa/generalhandler.h4
-rw-r--r--src/net/tmwa/gui/guildtab.cpp1
-rw-r--r--src/net/tmwa/gui/partytab.cpp1
-rw-r--r--src/net/tmwa/itemhandler.cpp7
-rw-r--r--src/net/tmwa/network.cpp4
-rw-r--r--src/net/tmwa/npchandler.cpp2
-rw-r--r--src/net/tmwa/playerhandler.cpp1
25 files changed, 74 insertions, 55 deletions
diff --git a/src/net/charhandler.h b/src/net/charhandler.h
index 492e27e55..cee319719 100644
--- a/src/net/charhandler.h
+++ b/src/net/charhandler.h
@@ -26,8 +26,6 @@
#include "localplayer.h"
#include "playerinfo.h"
-#include "net/logindata.h"
-
#include <iosfwd>
#include <vector>
diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp
index 84bd03bb1..d9e7e7506 100644
--- a/src/net/ea/beinghandler.cpp
+++ b/src/net/ea/beinghandler.cpp
@@ -511,6 +511,12 @@ void BeingHandler::processBeingAction(Net::MessageIn &msg)
}
break;
+ case 0x01: // dead
+ break;
+ // tmw server can send here garbage?
+// if (srcBeing)
+// srcBeing->setAction(Being::DEAD);
+
case 0x02: // Sit
if (srcBeing)
{
diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp
index b7566e271..6d021d6a9 100644
--- a/src/net/ea/gamehandler.cpp
+++ b/src/net/ea/gamehandler.cpp
@@ -43,20 +43,20 @@ GameHandler::GameHandler()
{
mCharID = 0;
- listen(Mana::CHANNEL_GAME);
+ listen(CHANNEL_GAME);
}
-void GameHandler::processEvent(Mana::Channels channel,
- const Mana::Event &event)
+void GameHandler::processEvent(Channels channel,
+ const Event &event)
{
- if (channel == Mana::CHANNEL_GAME)
+ if (channel == CHANNEL_GAME)
{
- if (event.getName() == Mana::EVENT_ENGINESINITALIZED)
+ if (event.getName() == EVENT_ENGINESINITALIZED)
{
if (mMap != "")
Game::instance()->changeMap(mMap);
}
- else if (event.getName() == Mana::EVENT_MAPLOADED)
+ else if (event.getName() == EVENT_MAPLOADED)
{
mapLoadedEvent();
}
diff --git a/src/net/ea/gamehandler.h b/src/net/ea/gamehandler.h
index 248175617..59cb148c4 100644
--- a/src/net/ea/gamehandler.h
+++ b/src/net/ea/gamehandler.h
@@ -32,13 +32,13 @@
namespace Ea
{
-class GameHandler : public Net::GameHandler, public Mana::Listener
+class GameHandler : public Net::GameHandler, public Listener
{
public:
GameHandler();
- virtual void processEvent(Mana::Channels channel,
- const Mana::Event &event);
+ virtual void processEvent(Channels channel,
+ const Event &event);
virtual void who();
diff --git a/src/net/ea/gui/partytab.cpp b/src/net/ea/gui/partytab.cpp
index cf62af459..d5e344ac2 100644
--- a/src/net/ea/gui/partytab.cpp
+++ b/src/net/ea/gui/partytab.cpp
@@ -242,4 +242,3 @@ void PartyTab::saveToLogFile(std::string &msg)
}
} // namespace Ea
-
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp
index 4c4fb760c..d870eff38 100644
--- a/src/net/ea/inventoryhandler.cpp
+++ b/src/net/ea/inventoryhandler.cpp
@@ -330,7 +330,7 @@ void InventoryHandler::processPlayerInventoryAdd(Net::MessageIn &msg)
{
Item *item = inventory->getItem(index);
- if (item && item->getId() == itemId)
+ if (item && item->getId() == itemId)
amount += item->getQuantity();
if (serverVersion < 1 && identified > 1)
diff --git a/src/net/ea/itemhandler.cpp b/src/net/ea/itemhandler.cpp
index e08fe2cd1..7a6ee2743 100644
--- a/src/net/ea/itemhandler.cpp
+++ b/src/net/ea/itemhandler.cpp
@@ -35,28 +35,39 @@ ItemHandler::ItemHandler()
{
}
-void ItemHandler::processItemVisible(Net::MessageIn &msg, bool isDrop)
+void ItemHandler::processItemVisible(Net::MessageIn &msg)
{
int id = msg.readInt32();
int itemId = msg.readInt16();
unsigned char identify = msg.readInt8(); // identify flag
int x = msg.readInt16();
int y = msg.readInt16();
- int amount1 = msg.readInt16();
- int amount2 = msg.readInt16();
+ int amount = msg.readInt16();
+ int subX = msg.readInt8() + 16 - 8;
+ int subY = msg.readInt8() + 32 - 8;
if (actorSpriteManager)
{
- if (!isDrop)
- {
- actorSpriteManager->createItem(id, itemId,
- x, y, amount1, identify);
- }
- else
- {
- actorSpriteManager->createItem(id, itemId,
- x, y, amount2, identify);
- }
+ actorSpriteManager->createItem(id, itemId,
+ x, y, amount, identify, subX, subY);
+ }
+}
+
+void ItemHandler::processItemDropped(Net::MessageIn &msg)
+{
+ int id = msg.readInt32();
+ int itemId = msg.readInt16();
+ unsigned char identify = msg.readInt8(); // identify flag
+ int x = msg.readInt16();
+ int y = msg.readInt16();
+ int subX = msg.readInt8() + 16 - 8;
+ int subY = msg.readInt8() + 32 - 8;
+ int amount = msg.readInt16();
+
+ if (actorSpriteManager)
+ {
+ actorSpriteManager->createItem(id, itemId,
+ x, y, amount, identify, subX, subY);
}
}
diff --git a/src/net/ea/itemhandler.h b/src/net/ea/itemhandler.h
index 1d0747c61..d5c268d2e 100644
--- a/src/net/ea/itemhandler.h
+++ b/src/net/ea/itemhandler.h
@@ -34,9 +34,11 @@ class ItemHandler
public:
ItemHandler();
- void processItemVisible(Net::MessageIn &msg, bool isDrop);
+ void processItemVisible(Net::MessageIn &msg);
void processItemRemove(Net::MessageIn &msg);
+
+ void processItemDropped(Net::MessageIn &msg);
};
} // namespace Ea
diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp
index 291a92906..39a920f03 100644
--- a/src/net/ea/loginhandler.cpp
+++ b/src/net/ea/loginhandler.cpp
@@ -28,6 +28,7 @@
#include "utils/dtor.h"
#include "utils/gettext.h"
+#include "utils/paths.h"
#include "debug.h"
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index 76a7b0dbc..27aa4da80 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -22,6 +22,7 @@
#include "net/ea/playerhandler.h"
+#include "localplayer.h"
#include "logger.h"
#include "party.h"
#include "playerinfo.h"
diff --git a/src/net/manaserv/chathandler.cpp b/src/net/manaserv/chathandler.cpp
index f0a23127c..12451e6f6 100644
--- a/src/net/manaserv/chathandler.cpp
+++ b/src/net/manaserv/chathandler.cpp
@@ -293,7 +293,7 @@ void ChatHandler::handleChannelEvent(Net::MessageIn &msg)
if (channel)
{
- switch(eventId)
+ switch (eventId)
{
case CHAT_EVENT_NEW_PLAYER:
channel->getTab()->chatLog(strprintf(_("%s entered the "
diff --git a/src/net/manaserv/generalhandler.cpp b/src/net/manaserv/generalhandler.cpp
index 584faa368..d95c98d23 100644
--- a/src/net/manaserv/generalhandler.cpp
+++ b/src/net/manaserv/generalhandler.cpp
@@ -93,8 +93,8 @@ GeneralHandler::GeneralHandler():
generalHandler = this;
- listen(Mana::CHANNEL_CLIENT);
- listen(Mana::CHANNEL_GAME);
+ listen(CHANNEL_CLIENT);
+ listen(CHANNEL_GAME);
}
void GeneralHandler::load()
@@ -176,10 +176,10 @@ void GeneralHandler::clearHandlers()
clearNetworkHandlers();
}
-void GeneralHandler::processEvent(Mana::Channels channel,
- const Mana::Event &event)
+void GeneralHandler::processEvent(Channels channel,
+ const Event &event)
{
- if (channel == Mana::CHANNEL_CLIENT)
+ if (channel == CHANNEL_CLIENT)
{
int newState = event.getInt("newState");
@@ -195,9 +195,9 @@ void GeneralHandler::processEvent(Mana::Channels channel,
Attributes::informItemDB();
}
}
- else if (channel == Mana::CHANNEL_GAME)
+ else if (channel == CHANNEL_GAME)
{
- if (event.getName() == Mana::EVENT_GUIWINDOWSLOADED)
+ if (event.getName() == EVENT_GUIWINDOWSLOADED)
{
inventoryWindow->setSplitAllowed(true);
skillDialog->loadSkills("mana-skills.xml");
diff --git a/src/net/manaserv/generalhandler.h b/src/net/manaserv/generalhandler.h
index fcb28c846..6ea5c7845 100644
--- a/src/net/manaserv/generalhandler.h
+++ b/src/net/manaserv/generalhandler.h
@@ -33,7 +33,7 @@
namespace ManaServ
{
-class GeneralHandler : public Net::GeneralHandler, public Mana::Listener
+class GeneralHandler : public Net::GeneralHandler, public Listener
{
public:
GeneralHandler();
@@ -50,7 +50,7 @@ class GeneralHandler : public Net::GeneralHandler, public Mana::Listener
void clearHandlers();
- void processEvent(Mana::Channels channel, const Mana::Event &event);
+ void processEvent(Channels channel, const Event &event);
protected:
MessageHandlerPtr mBeingHandler;
diff --git a/src/net/manaserv/guildhandler.cpp b/src/net/manaserv/guildhandler.cpp
index dfd2ed3cf..aa82d6dcd 100644
--- a/src/net/manaserv/guildhandler.cpp
+++ b/src/net/manaserv/guildhandler.cpp
@@ -153,7 +153,7 @@ void GuildHandler::handleMessage(Net::MessageIn &msg)
Guild *guild = player_node->getGuild(guildId);
if (guild)
{
- switch(eventId)
+ switch (eventId)
{
case GUILD_EVENT_NEW_PLAYER:
member = guild->addMember(name);
diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp
index aa79d4d41..b2609cf02 100644
--- a/src/net/manaserv/playerhandler.cpp
+++ b/src/net/manaserv/playerhandler.cpp
@@ -151,8 +151,7 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg)
PlayerInfo::setAttribute(CORR_POINTS, msg.readInt16());
Particle* effect = particleEngine->addEffect(
paths.getStringValue("particles")
- + paths.getStringValue("levelUpEffectFile")
- , 0, 0);
+ + paths.getStringValue("levelUpEffectFile"), 0, 0);
player_node->controlParticle(effect);
} break;
diff --git a/src/net/net.cpp b/src/net/net.cpp
index 713b6aa7e..75bc35b72 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -202,4 +202,3 @@ ServerInfo::Type getNetworkType()
}
} // namespace Net
-
diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h
index 6ae912102..aa5d2b793 100644
--- a/src/net/playerhandler.h
+++ b/src/net/playerhandler.h
@@ -25,7 +25,6 @@
#include "being.h"
#include "flooritem.h"
-#include "localplayer.h"
namespace Net
{
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index a666fa5f4..77c91e1dd 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -244,12 +244,12 @@ void GeneralHandler::clearHandlers()
mNetwork->clearHandlers();
}
-void GeneralHandler::processEvent(Mana::Channels channel,
- const Mana::Event &event)
+void GeneralHandler::processEvent(Channels channel,
+ const Event &event)
{
- if (channel == Mana::CHANNEL_GAME)
+ if (channel == CHANNEL_GAME)
{
- if (event.getName() == Mana::EVENT_GUIWINDOWSLOADED)
+ if (event.getName() == EVENT_GUIWINDOWSLOADED)
{
if (inventoryWindow)
inventoryWindow->setSplitAllowed(false);
@@ -288,7 +288,7 @@ void GeneralHandler::processEvent(Mana::Channels channel,
statusWindow->addAttribute(ATTACK_SPEED, _("Damage per sec."),
false, "");
}
- else if (event.getName() == Mana::EVENT_GUIWINDOWSUNLOADING)
+ else if (event.getName() == EVENT_GUIWINDOWSUNLOADING)
{
if (socialWindow)
{
diff --git a/src/net/tmwa/generalhandler.h b/src/net/tmwa/generalhandler.h
index b250ddfd4..73f7a0e1b 100644
--- a/src/net/tmwa/generalhandler.h
+++ b/src/net/tmwa/generalhandler.h
@@ -34,7 +34,7 @@ namespace TmwAthena
{
class GeneralHandler : public MessageHandler, public Net::GeneralHandler,
- public Mana::Listener
+ public Listener
{
public:
GeneralHandler();
@@ -53,7 +53,7 @@ class GeneralHandler : public MessageHandler, public Net::GeneralHandler,
void clearHandlers();
- void processEvent(Mana::Channels channel, const Mana::Event &event);
+ void processEvent(Channels channel, const Event &event);
void reloadPartially();
diff --git a/src/net/tmwa/gui/guildtab.cpp b/src/net/tmwa/gui/guildtab.cpp
index af90f5c6b..496ba64f5 100644
--- a/src/net/tmwa/gui/guildtab.cpp
+++ b/src/net/tmwa/gui/guildtab.cpp
@@ -53,4 +53,3 @@ GuildTab::~GuildTab()
}
} // namespace TmwAthena
-
diff --git a/src/net/tmwa/gui/partytab.cpp b/src/net/tmwa/gui/partytab.cpp
index d0738e79c..02bcfd54f 100644
--- a/src/net/tmwa/gui/partytab.cpp
+++ b/src/net/tmwa/gui/partytab.cpp
@@ -56,4 +56,3 @@ PartyTab::~PartyTab()
}
} // namespace TmwAthena
-
diff --git a/src/net/tmwa/itemhandler.cpp b/src/net/tmwa/itemhandler.cpp
index ce03044c7..d84d2f38d 100644
--- a/src/net/tmwa/itemhandler.cpp
+++ b/src/net/tmwa/itemhandler.cpp
@@ -48,9 +48,12 @@ void ItemHandler::handleMessage(Net::MessageIn &msg)
switch (msg.getId())
{
case SMSG_ITEM_VISIBLE:
+ processItemVisible(msg);
+ break;
+
case SMSG_ITEM_DROPPED:
- processItemVisible(msg, msg.getId() == SMSG_ITEM_DROPPED);
- break;
+ processItemDropped(msg);
+ break;
case SMSG_ITEM_REMOVE:
processItemRemove(msg);
diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp
index 31329eafb..6e9e367c0 100644
--- a/src/net/tmwa/network.cpp
+++ b/src/net/tmwa/network.cpp
@@ -133,8 +133,8 @@ Network::~Network()
mMutex = nullptr;
mInstance = nullptr;
- delete[] mInBuffer;
- delete[] mOutBuffer;
+ delete []mInBuffer;
+ delete []mOutBuffer;
SDLNet_Quit();
}
diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp
index d86c64a96..837b83337 100644
--- a/src/net/tmwa/npchandler.cpp
+++ b/src/net/tmwa/npchandler.cpp
@@ -35,6 +35,8 @@
#include "net/ea/eaprotocol.h"
+#include "utils/langs.h"
+
#include "debug.h"
extern Net::NpcHandler *npcHandler;
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp
index 16e833ec9..bfe9eea42 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -23,6 +23,7 @@
#include "net/tmwa/playerhandler.h"
#include "configuration.h"
+#include "client.h"
#include "logger.h"
#include "net/messagein.h"