From ca9f3f98a9d8bd718f11806a33e7a9a2ab284de5 Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Sun, 18 Dec 2005 00:38:30 +0000 Subject: Made the handlers use the countedPtr for Beings as they should. Fixed a segfault when removing a being from the world. --- src/netcomputer.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/netcomputer.cpp') diff --git a/src/netcomputer.cpp b/src/netcomputer.cpp index ff1c93a..c00061f 100644 --- a/src/netcomputer.cpp +++ b/src/netcomputer.cpp @@ -54,13 +54,13 @@ void NetComputer::setAccount(tmwserv::Account *acc) account = acc; } -void NetComputer::setCharacter(tmwserv::Being *ch) +void NetComputer::setCharacter(tmwserv::BeingPtr ch) { tmwserv::State &state = tmwserv::State::instance(); - if (character != NULL) + if (character.get() != NULL) { // Remove being from the world : This is buggy for now. - //state.removeBeing(character); + state.removeBeing(character); } character = ch; state.addBeing(character, character->getMap()); @@ -75,8 +75,8 @@ void NetComputer::unsetAccount() void NetComputer::unsetCharacter() { // remove being from world - //tmwserv::State &state = tmwserv::State::instance(); - //state.removeBeing(character); - character = NULL; + tmwserv::State &state = tmwserv::State::instance(); + state.removeBeing(character); + character = tmwserv::BeingPtr(NULL); } -- cgit