fixed issue #66: game creators can't kick spectators; unfortunately, this fix is client-side

This commit is contained in:
Max-Wilhelm Bruker 2012-07-17 19:06:12 +02:00
parent a1e35ccda5
commit 28b18575f2
3 changed files with 1 additions and 13 deletions

View file

@ -819,17 +819,6 @@ AbstractClient *TabGame::getClientForPlayer(int playerId) const
return clients.first();
}
int TabGame::getPlayerIdByName(const QString &playerName) const
{
QMapIterator<int, Player *> 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);

View file

@ -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; }

View file

@ -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;