Пример #1
0
void ChatRoomImplementation::removeAllPlayers() {
	Locker locker(_this.get());

	for (int i = 0; i < playerList.size(); i++) {
		ManagedReference<CreatureObject*> player = playerList.get(i);

		Locker clocker(player, _this.get());

		PlayerObject* ghost = player->getPlayerObject();

		ghost->removeChatRoom(_this.get());
	}

	playerList.removeAll();
}
Пример #2
0
void ChatRoomImplementation::removePlayer(CreatureObject* player, bool doLock) {
	Locker locker(player);

	PlayerObject* ghost = player->getPlayerObject();

	ghost->removeChatRoom(_this.get());

	locker.release();

	Locker locker2(_this.get());

	playerList.drop(player->getFirstName());

	ChatOnLeaveRoom* msg = new ChatOnLeaveRoom(_this.get(), player);
	player->sendMessage(msg);
}
Пример #3
0
void ChatRoomImplementation::removePlayer(const String& player) {
	// Pre: player unlocked
	Locker locker(_this.get());

	ManagedReference<CreatureObject*> play = playerList.get(player);
	playerList.drop(player);

	locker.release();

	if (play == NULL)
		return;

	Locker locker2(play);

	PlayerObject* ghost = play->getPlayerObject();

	ghost->removeChatRoom(_this.get());

	ChatOnLeaveRoom* msg = new ChatOnLeaveRoom(_this.get(), play);
	play->sendMessage(msg);
}