diff options
Diffstat (limited to 'src/netcomputer.cpp')
-rw-r--r-- | src/netcomputer.cpp | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/netcomputer.cpp b/src/netcomputer.cpp index 1c736f47..7a06ba34 100644 --- a/src/netcomputer.cpp +++ b/src/netcomputer.cpp @@ -24,22 +24,16 @@ #include "netcomputer.h" #include "chatchannelmanager.h" +#include "connectionhandler.h" #include "packet.h" #include "state.h" NetComputer::NetComputer(ConnectionHandler *handler, ENetPeer *peer): handler(handler), - peer(peer), - mAccountPtr(NULL), - mCharacterPtr(NULL) + peer(peer) { } -NetComputer::~NetComputer() -{ - unsetAccount(); -} - void NetComputer::disconnect(const std::string &reason) { // Somehow notify the netsession listener about the disconnect after @@ -57,12 +51,12 @@ void NetComputer::send(const Packet *p) enet_peer_send(peer, 0, packet); } -void NetComputer::setAccount(tmwserv::AccountPtr acc) +void ClientComputer::setAccount(tmwserv::AccountPtr acc) { mAccountPtr = acc; } -void NetComputer::setCharacter(tmwserv::BeingPtr ch) +void ClientComputer::setCharacter(tmwserv::BeingPtr ch) { tmwserv::State &state = tmwserv::State::instance(); if (mCharacterPtr.get() != NULL) @@ -74,13 +68,13 @@ void NetComputer::setCharacter(tmwserv::BeingPtr ch) state.addBeing(mCharacterPtr, mCharacterPtr->getMapId()); } -void NetComputer::unsetAccount() +void ClientComputer::unsetAccount() { unsetCharacter(); mAccountPtr = tmwserv::AccountPtr(NULL); } -void NetComputer::unsetCharacter() +void ClientComputer::unsetCharacter() { // remove being from world tmwserv::State &state = tmwserv::State::instance(); @@ -89,3 +83,14 @@ void NetComputer::unsetCharacter() mCharacterPtr = tmwserv::BeingPtr(NULL); } +ClientComputer::ClientComputer(ClientConnectionHandler *handler, ENetPeer *peer): + NetComputer(handler, peer), + mAccountPtr(NULL), + mCharacterPtr(NULL) +{ +} + +ClientComputer::~ClientComputer() +{ + unsetAccount(); +} |