diff --git a/cockatrice/src/tab_game.cpp b/cockatrice/src/tab_game.cpp index 632d4ecd..f920b98e 100644 --- a/cockatrice/src/tab_game.cpp +++ b/cockatrice/src/tab_game.cpp @@ -819,17 +819,6 @@ AbstractClient *TabGame::getClientForPlayer(int playerId) const return clients.first(); } -int TabGame::getPlayerIdByName(const QString &playerName) const -{ - QMapIterator playerIterator(players); - while (playerIterator.hasNext()) { - const Player *const p = playerIterator.next().value(); - if (p->getName() == playerName) - return p->getId(); - } - return -1; -} - void TabGame::sendGameCommand(PendingCommand *pend, int playerId) { AbstractClient *client = getClientForPlayer(playerId); diff --git a/cockatrice/src/tab_game.h b/cockatrice/src/tab_game.h index db82d06d..f511ef69 100644 --- a/cockatrice/src/tab_game.h +++ b/cockatrice/src/tab_game.h @@ -210,7 +210,6 @@ public: bool getSpectatorsSeeEverything() const { return gameInfo.spectators_omniscient(); } Player *getActiveLocalPlayer() const; AbstractClient *getClientForPlayer(int playerId) const; - int getPlayerIdByName(const QString &playerName) const; void setActiveCard(CardItem *_card) { activeCard = _card; } CardItem *getActiveCard() const { return activeCard; } diff --git a/cockatrice/src/user_context_menu.cpp b/cockatrice/src/user_context_menu.cpp index 8898e21f..657dc40b 100644 --- a/cockatrice/src/user_context_menu.cpp +++ b/cockatrice/src/user_context_menu.cpp @@ -182,7 +182,7 @@ void UserContextMenu::showContextMenu(const QPoint &pos, const QString &userName client->sendCommand(client->prepareSessionCommand(cmd)); } else if (actionClicked == aKick) { Command_KickFromGame cmd; - cmd.set_player_id(game->getPlayerIdByName(userName)); + cmd.set_player_id(playerId); game->sendGameCommand(cmd); } else if (actionClicked == aBan) { Command_GetUserInfo cmd;