From d187c54000b40dcebb742a89f9962a6f12921a62 Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Mon, 12 Dec 2005 22:17:35 +0000 Subject: Use setCharacter() and unsetcharacter() to deal with addBeing() and removeBeing() in the world (which are buggy). Add check when character's name already exists. Added Character list packet support. --- src/netcomputer.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/netcomputer.cpp') diff --git a/src/netcomputer.cpp b/src/netcomputer.cpp index 663d74a8..ff1c93a1 100644 --- a/src/netcomputer.cpp +++ b/src/netcomputer.cpp @@ -22,6 +22,7 @@ */ #include "netcomputer.h" +#include "state.h" #include #include @@ -55,5 +56,27 @@ void NetComputer::setAccount(tmwserv::Account *acc) void NetComputer::setCharacter(tmwserv::Being *ch) { + tmwserv::State &state = tmwserv::State::instance(); + if (character != NULL) + { + // Remove being from the world : This is buggy for now. + //state.removeBeing(character); + } character = ch; + state.addBeing(character, character->getMap()); } + +void NetComputer::unsetAccount() +{ + unsetCharacter(); + account = NULL; +} + +void NetComputer::unsetCharacter() +{ + // remove being from world + //tmwserv::State &state = tmwserv::State::instance(); + //state.removeBeing(character); + character = NULL; +} + -- cgit v1.2.3-70-g09d2