diff options
| author | Yohann Ferreira <bertram@cegetel.net> | 2005-12-18 00:58:24 +0000 |
|---|---|---|
| committer | Yohann Ferreira <bertram@cegetel.net> | 2005-12-18 00:58:24 +0000 |
| commit | f83ed8b03c85fb485e0a85439f36c555ca1910ee (patch) | |
| tree | 59dcfd81e73603582a698a294e6fee925d629b5b /src/netcomputer.cpp | |
| parent | 5b13f9cb7d2c86e8c6b95f953c3afdb808016375 (diff) | |
| download | manaserv-f83ed8b03c85fb485e0a85439f36c555ca1910ee.tar.gz manaserv-f83ed8b03c85fb485e0a85439f36c555ca1910ee.tar.xz manaserv-f83ed8b03c85fb485e0a85439f36c555ca1910ee.zip | |
Made use of AccountPtr instead of Account*.
Diffstat (limited to 'src/netcomputer.cpp')
| -rw-r--r-- | src/netcomputer.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/netcomputer.cpp b/src/netcomputer.cpp index c00061f..2bf04db 100644 --- a/src/netcomputer.cpp +++ b/src/netcomputer.cpp @@ -29,13 +29,14 @@ NetComputer::NetComputer(ConnectionHandler *handler, TCPsocket sock): handler(handler), socket(sock), - account(NULL), - character(NULL) + accountPtr(NULL), + characterPtr(NULL) { } NetComputer::~NetComputer() { + unsetAccount(); } void NetComputer::disconnect(const std::string &reason) @@ -49,34 +50,34 @@ void NetComputer::send(const Packet *p) SDLNet_TCP_Send(socket, p->data, p->length); } -void NetComputer::setAccount(tmwserv::Account *acc) +void NetComputer::setAccount(tmwserv::AccountPtr acc) { - account = acc; + accountPtr = acc; } void NetComputer::setCharacter(tmwserv::BeingPtr ch) { tmwserv::State &state = tmwserv::State::instance(); - if (character.get() != NULL) + if (characterPtr.get() != NULL) { - // Remove being from the world : This is buggy for now. - state.removeBeing(character); + // Remove being from the world. + state.removeBeing(characterPtr); } - character = ch; - state.addBeing(character, character->getMap()); + characterPtr = ch; + state.addBeing(characterPtr, characterPtr->getMap()); } void NetComputer::unsetAccount() { unsetCharacter(); - account = NULL; + accountPtr = tmwserv::AccountPtr(NULL); } void NetComputer::unsetCharacter() { // remove being from world tmwserv::State &state = tmwserv::State::instance(); - state.removeBeing(character); - character = tmwserv::BeingPtr(NULL); + state.removeBeing(characterPtr); + characterPtr = tmwserv::BeingPtr(NULL); } |
