From e07e2a6db902f2ce0095b65708a98fa4dbf40aa0 Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Tue, 3 Nov 2009 12:06:48 -0700 Subject: Simplify ManaServ netcode some more --- src/net/manaserv/npchandler.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/net/manaserv/npchandler.cpp') diff --git a/src/net/manaserv/npchandler.cpp b/src/net/manaserv/npchandler.cpp index 7384d18e..4c4aa53f 100644 --- a/src/net/manaserv/npchandler.cpp +++ b/src/net/manaserv/npchandler.cpp @@ -26,9 +26,6 @@ #include "net/manaserv/messageout.h" #include "net/manaserv/protocol.h" -#include "net/manaserv/gameserver/internal.h" -#include "net/manaserv/gameserver/player.h" - #include "beingmanager.h" #include "npc.h" @@ -39,6 +36,8 @@ Net::NpcHandler *npcHandler; namespace ManaServ { +extern Connection *gameServerConnection; + NpcHandler::NpcHandler() { static const Uint16 _messages[] = { @@ -114,21 +113,22 @@ void NpcHandler::talk(int npcId) { MessageOut msg(PGMSG_NPC_TALK); msg.writeInt16(npcId); - GameServer::connection->send(msg); + gameServerConnection->send(msg); } void NpcHandler::nextDialog(int npcId) { MessageOut msg(PGMSG_NPC_TALK_NEXT); msg.writeInt16(npcId); - GameServer::connection->send(msg); + gameServerConnection->send(msg); } void NpcHandler::closeDialog(int npcId) { MessageOut msg(PGMSG_NPC_TALK_NEXT); msg.writeInt16(npcId); - GameServer::connection->send(msg); + gameServerConnection->send(msg); + npcDialog->setVisible(false); npcDialog->setText(""); } @@ -138,7 +138,7 @@ void NpcHandler::listInput(int npcId, int value) MessageOut msg(PGMSG_NPC_SELECT); msg.writeInt16(npcId); msg.writeInt8(value); - GameServer::connection->send(msg); + gameServerConnection->send(msg); } void NpcHandler::integerInput(int npcId, int value) @@ -146,7 +146,7 @@ void NpcHandler::integerInput(int npcId, int value) MessageOut msg(PGMSG_NPC_NUMBER); msg.writeInt16(npcId); msg.writeInt32(value); - GameServer::connection->send(msg); + gameServerConnection->send(msg); } void NpcHandler::stringInput(int npcId, const std::string &value) @@ -154,7 +154,7 @@ void NpcHandler::stringInput(int npcId, const std::string &value) MessageOut msg(PGMSG_NPC_STRING); msg.writeInt16(npcId); msg.writeString(value); - GameServer::connection->send(msg); + gameServerConnection->send(msg); } void NpcHandler::sendLetter(int npcId, const std::string &recipient, @@ -163,7 +163,7 @@ void NpcHandler::sendLetter(int npcId, const std::string &recipient, MessageOut msg(PGMSG_NPC_POST_SEND); msg.writeString(recipient); msg.writeString(text); - GameServer::connection->send(msg); + gameServerConnection->send(msg); } void NpcHandler::startShopping(int beingId) @@ -186,7 +186,7 @@ void NpcHandler::buyItem(int beingId, int itemId, int amount) MessageOut msg(PGMSG_NPC_BUYSELL); msg.writeInt16(itemId); msg.writeInt16(amount); - GameServer::connection->send(msg); + gameServerConnection->send(msg); } void NpcHandler::sellItem(int beingId, int itemId, int amount) @@ -194,7 +194,7 @@ void NpcHandler::sellItem(int beingId, int itemId, int amount) MessageOut msg(PGMSG_NPC_BUYSELL); msg.writeInt16(itemId); msg.writeInt16(amount); - GameServer::connection->send(msg); + gameServerConnection->send(msg); } void NpcHandler::endShopping(int beingId) -- cgit v1.2.3-70-g09d2