void NPC::remove() { Sector* sector = _map->getSectorByID(_sectorID); if(sector != NULL) { sector->removeObject(_drawable); delete _drawable; } _sectorID = -1; }
void NPC::updateSectorID() { int newSectorID = _map->getSectorID(_x, _y); if(newSectorID != _sectorID) { Sector* oldSector = _map->getSectorByID(_sectorID); if(oldSector != NULL) { oldSector->removeObject(_drawable); delete _drawable; } _drawable = new DrawableNPC(_scene, this); _map->getSectorByID(newSectorID)->addObject(_drawable); _sectorID = newSectorID; } }