summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Makefile.am2
-rw-r--r--src/game.cpp8
-rw-r--r--src/gui/status.cpp12
-rw-r--r--src/gui/trade.cpp5
-rw-r--r--src/localplayer.cpp3
-rw-r--r--src/net/ea/playerhandler.cpp6
-rw-r--r--src/net/ea/playerhandler.h4
-rw-r--r--src/net/ea/skillhandler.cpp21
-rw-r--r--src/net/ea/skillhandler.h10
-rw-r--r--src/net/ea/tradehandler.cpp6
-rw-r--r--src/net/ea/tradehandler.h4
-rw-r--r--src/net/net.cpp16
-rw-r--r--src/net/skillhandler.h8
-rw-r--r--src/net/tmwserv/playerhandler.cpp4
-rw-r--r--src/net/tmwserv/playerhandler.h4
-rw-r--r--src/net/tmwserv/skillhandler.cpp53
-rw-r--r--src/net/tmwserv/skillhandler.h45
-rw-r--r--src/net/tmwserv/tradehandler.cpp6
-rw-r--r--src/net/tmwserv/tradehandler.h4
20 files changed, 187 insertions, 36 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e7566b20..f6049b1c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -539,6 +539,8 @@ SET(SRCS_TMW
net/tmwserv/playerhandler.cpp
net/tmwserv/playerhandler.h
net/tmwserv/protocol.h
+ net/tmwserv/skillhandler.cpp
+ net/tmwserv/skillhandler.h
net/tmwserv/tradehandler.cpp
net/tmwserv/tradehandler.h
guild.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index d84c792e..7080bcf0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -441,6 +441,8 @@ tmw_SOURCES += \
net/tmwserv/playerhandler.cpp \
net/tmwserv/playerhandler.h \
net/tmwserv/protocol.h \
+ net/tmwserv/skillhandler.cpp \
+ net/tmwserv/skillhandler.h \
net/tmwserv/tradehandler.cpp \
net/tmwserv/tradehandler.h \
guild.cpp \
diff --git a/src/game.cpp b/src/game.cpp
index 768b3c06..a181fc2a 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -366,7 +366,7 @@ Game::Game(Network *network):
mBeingHandler(new BeingHandler(config.getValue("EnableSync", 0) == 1)),
mAdminHandler(new EAthena::AdminHandler),
mEquipmentHandler(new EquipmentHandler),
- mSkillHandler(new SkillHandler),
+ mSkillHandler(new EAthena::SkillHandler),
#endif
mPartyHandler(new PartyHandler),
mBuySellHandler(new BuySellHandler),
@@ -380,11 +380,13 @@ Game::Game(Network *network):
mItemHandler(new ItemHandler),
#ifdef TMWSERV_SUPPORT
mNpcHandler(new TmwServ::NpcHandler),
+ mPlayerHandler(new TmwServ::PlayerHandler),
+ mTradeHandler(new TmwServ::TradeHandler),
#else
mNpcHandler(new EAthena::NpcHandler),
+ mPlayerHandler(new EAthena::PlayerHandler),
+ mTradeHandler(new EAthena::TradeHandler),
#endif
- mPlayerHandler(new PlayerHandler),
- mTradeHandler(new TradeHandler),
mLastTarget(Being::UNKNOWN),
mLogicCounterId(0), mSecondsCounterId(0)
{
diff --git a/src/gui/status.cpp b/src/gui/status.cpp
index 92ae2916..ad50c72f 100644
--- a/src/gui/status.cpp
+++ b/src/gui/status.cpp
@@ -269,17 +269,17 @@ void StatusWindow::action(const gcn::ActionEvent &event)
if (event.getId().length() == 3)
{
if (event.getId() == "STR")
- playerHandler->increaseStat(LocalPlayer::STR);
+ Net::getPlayerHandler()->increaseStat(LocalPlayer::STR);
if (event.getId() == "AGI")
- playerHandler->increaseStat(LocalPlayer::AGI);
+ Net::getPlayerHandler()->increaseStat(LocalPlayer::AGI);
if (event.getId() == "VIT")
- playerHandler->increaseStat(LocalPlayer::VIT);
+ Net::getPlayerHandler()->increaseStat(LocalPlayer::VIT);
if (event.getId() == "INT")
- playerHandler->increaseStat(LocalPlayer::INT);
+ Net::getPlayerHandler()->increaseStat(LocalPlayer::INT);
if (event.getId() == "DEX")
- playerHandler->increaseStat(LocalPlayer::DEX);
+ Net::getPlayerHandler()->increaseStat(LocalPlayer::DEX);
if (event.getId() == "LUK")
- playerHandler->increaseStat(LocalPlayer::LUK);
+ Net::getPlayerHandler()->increaseStat(LocalPlayer::LUK);
}
}
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index 504396c5..f931b81b 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -307,15 +307,14 @@ void TradeWindow::action(const gcn::ActionEvent &event)
{
mMoneyField->setText(toString(tempInt));
- // Net::getTradeHandler()->setMoney(tempInt);
- tradeHandler->setMoney(tempInt);
+ Net::getTradeHandler()->setMoney(tempInt);
}
else
{
mMoneyField->setText("");
}
mMoneyField->setEnabled(false);
- tradeHandler->confirm();
+ Net::getTradeHandler()->confirm();
}
#endif
else if (event.getId() == "trade")
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index d22468c1..8d538f94 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -647,8 +647,7 @@ void LocalPlayer::raiseSkill(Uint16 skillId)
if (mSkillPoint <= 0)
return;
- // Net::getSkillHandler()->up(skillId);
- skillHandler->up(skillId);
+ Net::getSkillHandler()->up(skillId);
}
#endif
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index 29900730..8c9b6f5e 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -148,7 +148,9 @@ static const char *randomDeathMessage()
return gettext(deadMsg[random]);
}
-PlayerHandler *playerHandler;
+Net::PlayerHandler *playerHandler;
+
+namespace EAthena {
PlayerHandler::PlayerHandler()
{
@@ -522,3 +524,5 @@ void PlayerHandler::ingoreAll(bool ignore)
{
// TODO
}
+
+} // namespace EAthena
diff --git a/src/net/ea/playerhandler.h b/src/net/ea/playerhandler.h
index 22f6a132..94ae952f 100644
--- a/src/net/ea/playerhandler.h
+++ b/src/net/ea/playerhandler.h
@@ -26,6 +26,8 @@
#include "net/net.h"
#include "net/playerhandler.h"
+namespace EAthena {
+
class PlayerHandler : public MessageHandler, public Net::PlayerHandler
{
public:
@@ -56,6 +58,6 @@ class PlayerHandler : public MessageHandler, public Net::PlayerHandler
void ingoreAll(bool ignore);
};
-extern PlayerHandler *playerHandler;
+} // namespace EAthena
#endif // NET_EA_PLAYERHANDLER_H
diff --git a/src/net/ea/skillhandler.cpp b/src/net/ea/skillhandler.cpp
index 0475c057..0239a2c8 100644
--- a/src/net/ea/skillhandler.cpp
+++ b/src/net/ea/skillhandler.cpp
@@ -66,7 +66,9 @@
/** should always be zero if failed */
#define SKILL_FAILED 0x00
-SkillHandler *skillHandler;
+Net::SkillHandler *skillHandler;
+
+namespace EAthena {
SkillHandler::SkillHandler()
{
@@ -217,3 +219,20 @@ void SkillHandler::up(int skillId)
MessageOut outMsg(CMSG_SKILL_LEVELUP_REQUEST);
outMsg.writeInt16(skillId);
}
+
+void SkillHandler::use(int skillId, int level, int beingId)
+{
+ // TODO
+}
+
+void SkillHandler::use(int skillId, int level, int x, int y)
+{
+ // TODO
+}
+
+void SkillHandler::use(int skillId, const std::string &map)
+{
+ // TODO
+}
+
+} // namespace EAthena
diff --git a/src/net/ea/skillhandler.h b/src/net/ea/skillhandler.h
index b4e464ed..c1965213 100644
--- a/src/net/ea/skillhandler.h
+++ b/src/net/ea/skillhandler.h
@@ -26,6 +26,8 @@
#include "net/net.h"
#include "net/skillhandler.h"
+namespace EAthena {
+
class SkillHandler : public MessageHandler, public Net::SkillHandler
{
public:
@@ -34,8 +36,14 @@ class SkillHandler : public MessageHandler, public Net::SkillHandler
void handleMessage(MessageIn &msg);
void up(int skillId);
+
+ void use(int skillId, int level, int beingId);
+
+ void use(int skillId, int level, int x, int y);
+
+ void use(int skillId, const std::string &map);
};
-extern SkillHandler *skillHandler;
+} // namespace EAthena
#endif // NET_EA_SKILLHANDLER_H
diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp
index b7f8e369..1bf7e303 100644
--- a/src/net/ea/tradehandler.cpp
+++ b/src/net/ea/tradehandler.cpp
@@ -53,7 +53,9 @@ namespace {
} listener;
}
-TradeHandler *tradeHandler;
+Net::TradeHandler *tradeHandler;
+
+namespace EAthena {
TradeHandler::TradeHandler()
{
@@ -271,3 +273,5 @@ void TradeHandler::cancel()
{
MessageOut outMsg(CMSG_TRADE_CANCEL_REQUEST);
}
+
+} // namespace EAthena
diff --git a/src/net/ea/tradehandler.h b/src/net/ea/tradehandler.h
index 451939f9..1d94b849 100644
--- a/src/net/ea/tradehandler.h
+++ b/src/net/ea/tradehandler.h
@@ -26,6 +26,8 @@
#include "net/net.h"
#include "net/tradehandler.h"
+namespace EAthena {
+
class TradeHandler : public MessageHandler, public Net::TradeHandler
{
public:
@@ -50,6 +52,6 @@ class TradeHandler : public MessageHandler, public Net::TradeHandler
void cancel();
};
-extern TradeHandler *tradeHandler;
+} // namespace EAthena
#endif // NET_EA_TRADEHANDLER_H
diff --git a/src/net/net.cpp b/src/net/net.cpp
index 255b6ab9..b2fe7225 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -40,25 +40,26 @@
#include "net/tmwserv/inventoryhandler.h"
#include "net/tmwserv/maphandler.h"
#include "net/tmwserv/npchandler.h"
+#include "net/tmwserv/playerhandler.h"
+#include "net/tmwserv/skillhandler.h"
+#include "net/tmwserv/tradehandler.h"
#include "net/ea/adminhandler.h"
#include "net/ea/inventoryhandler.h"
#include "net/ea/maphandler.h"
#include "net/ea/npchandler.h"
-
-#ifdef TMWSERV_SUPPORT
-#include "net/tmwserv/playerhandler.h"
-#include "net/tmwserv/tradehandler.h"
-#else
#include "net/ea/playerhandler.h"
+#include "net/ea/skillhandler.h"
#include "net/ea/tradehandler.h"
-#endif
extern Net::AdminHandler *adminHandler;
extern Net::ChatHandler *chatHandler;
extern Net::InventoryHandler *inventoryHandler;
extern Net::MapHandler *mapHandler;
extern Net::NpcHandler *npcHandler;
+extern Net::PlayerHandler *playerHandler;
+extern Net::SkillHandler *skillHandler;
+extern Net::TradeHandler *tradeHandler;
Net::AdminHandler *Net::getAdminHandler()
{
@@ -122,8 +123,7 @@ Net::PlayerHandler *Net::getPlayerHandler()
Net::SkillHandler *Net::getSkillHandler()
{
- // TODO
- return 0;
+ return skillHandler;
}
Net::TradeHandler *Net::getTradeHandler()
diff --git a/src/net/skillhandler.h b/src/net/skillhandler.h
index d0e6cd23..9db6ac5b 100644
--- a/src/net/skillhandler.h
+++ b/src/net/skillhandler.h
@@ -28,13 +28,13 @@ namespace Net {
class SkillHandler
{
public:
- virtual void up(int skillId) {}
+ virtual void up(int skillId) = 0;
- virtual void use(int skillId, int level, int beingId) {}
+ virtual void use(int skillId, int level, int beingId) = 0;
- virtual void use(int skillId, int level, int x, int y) {}
+ virtual void use(int skillId, int level, int x, int y) = 0;
- virtual void use(int skillId, const std::string &map) {}
+ virtual void use(int skillId, const std::string &map) = 0;
};
}
diff --git a/src/net/tmwserv/playerhandler.cpp b/src/net/tmwserv/playerhandler.cpp
index a02c9a29..f13484eb 100644
--- a/src/net/tmwserv/playerhandler.cpp
+++ b/src/net/tmwserv/playerhandler.cpp
@@ -95,6 +95,8 @@ namespace {
Net::PlayerHandler *playerHandler;
+namespace TmwServ {
+
PlayerHandler::PlayerHandler()
{
static const Uint16 _messages[] = {
@@ -391,3 +393,5 @@ void PlayerHandler::ingoreAll(bool ignore)
{
// TODO
}
+
+} // namespace TmwServ
diff --git a/src/net/tmwserv/playerhandler.h b/src/net/tmwserv/playerhandler.h
index 17b1f684..5524415e 100644
--- a/src/net/tmwserv/playerhandler.h
+++ b/src/net/tmwserv/playerhandler.h
@@ -25,6 +25,8 @@
#include "net/messagehandler.h"
#include "net/playerhandler.h"
+namespace TmwServ {
+
class PlayerHandler : public MessageHandler, public Net::PlayerHandler
{
public:
@@ -58,6 +60,6 @@ class PlayerHandler : public MessageHandler, public Net::PlayerHandler
void handleMapChangeMessage(MessageIn &msg);
};
-extern Net::PlayerHandler *playerHandler;
+} // namespace TmwServ
#endif
diff --git a/src/net/tmwserv/skillhandler.cpp b/src/net/tmwserv/skillhandler.cpp
new file mode 100644
index 00000000..e35b896a
--- /dev/null
+++ b/src/net/tmwserv/skillhandler.cpp
@@ -0,0 +1,53 @@
+/*
+ * The Mana World
+ * Copyright (C) 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "net/tmwserv/skillhandler.h"
+
+Net::SkillHandler *skillHandler;
+
+namespace TmwServ {
+
+SkillHandler::SkillHandler()
+{
+ skillHandler = this;
+}
+
+void SkillHandler::up(int skillId)
+{
+ // TODO
+}
+
+void SkillHandler::use(int skillId, int level, int beingId)
+{
+ // TODO
+}
+
+void SkillHandler::use(int skillId, int level, int x, int y)
+{
+ // TODO
+}
+
+void SkillHandler::use(int skillId, const std::string &map)
+{
+ // TODO
+}
+
+} // namespace TmwServ
diff --git a/src/net/tmwserv/skillhandler.h b/src/net/tmwserv/skillhandler.h
new file mode 100644
index 00000000..8c459c4f
--- /dev/null
+++ b/src/net/tmwserv/skillhandler.h
@@ -0,0 +1,45 @@
+/*
+ * The Mana World
+ * Copyright (C) 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef NET_TMWSERV_SKILLHANDLER_H
+#define NET_TMWSERV_SKILLHANDLER_H
+
+#include "net/skillhandler.h"
+
+namespace TmwServ {
+
+class SkillHandler : public Net::SkillHandler
+{
+ public:
+ SkillHandler();
+
+ void up(int skillId);
+
+ void use(int skillId, int level, int beingId);
+
+ void use(int skillId, int level, int x, int y);
+
+ void use(int skillId, const std::string &map);
+};
+
+} // namespace TmwServ
+
+#endif
diff --git a/src/net/tmwserv/tradehandler.cpp b/src/net/tmwserv/tradehandler.cpp
index 07ed81e6..17a45a19 100644
--- a/src/net/tmwserv/tradehandler.cpp
+++ b/src/net/tmwserv/tradehandler.cpp
@@ -56,6 +56,8 @@ namespace {
Net::TradeHandler *tradeHandler;
+namespace TmwServ {
+
TradeHandler::TradeHandler():
mAcceptTradeRequests(true)
{
@@ -142,8 +144,6 @@ void TradeHandler::handleMessage(MessageIn &msg)
void TradeHandler::request(Being *being)
{
- extern std::string tradePartnerName;
- extern int tradePartnerID;
tradePartnerName = being->getName();
tradePartnerID = being->getId();
Net::GameServer::Player::requestTrade(tradePartnerID);
@@ -185,3 +185,5 @@ void TradeHandler::cancel()
{
Net::GameServer::Player::acceptTrade(false);
}
+
+} // namespace TmwServ
diff --git a/src/net/tmwserv/tradehandler.h b/src/net/tmwserv/tradehandler.h
index 1abb30e3..dc9e070a 100644
--- a/src/net/tmwserv/tradehandler.h
+++ b/src/net/tmwserv/tradehandler.h
@@ -25,6 +25,8 @@
#include "net/messagehandler.h"
#include "net/tradehandler.h"
+namespace TmwServ {
+
class TradeHandler : public MessageHandler, public Net::TradeHandler
{
public:
@@ -67,6 +69,6 @@ class TradeHandler : public MessageHandler, public Net::TradeHandler
bool mAcceptTradeRequests;
};
-extern Net::TradeHandler *tradeHandler;
+} // namespace TmwServ
#endif