bool Character::enter(std::string dir) { Door* exit = location->getExit(dir); if (exit == NULL) { return false; } else { Room* newLocation = exit->getConnectedRoom(location); if (newLocation != NULL) { location->removeActor(this); location = newLocation; location->addActor(this); if (g->player->getLocation() == location) { addFlag("playerishere"); } else if(checkFlag("playerishere")){ removeFlag("playerishere"); } triggerEnter(newLocation); return true; } else { g->push(exit->getLockedMessage()); return true; } } }