mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-05 21:13:55 -07:00
Merge branch 'master' of git://github.com/mbruker/Cockatrice
This commit is contained in:
commit
1409c50fbe
10 changed files with 46 additions and 37 deletions
|
|
@ -22,9 +22,7 @@ LocalServerInterface *LocalServer::newConnection()
|
|||
}
|
||||
|
||||
LocalServer_DatabaseInterface::LocalServer_DatabaseInterface(LocalServer *_localServer)
|
||||
: Server_DatabaseInterface(_localServer),
|
||||
nextGameId(0),
|
||||
nextReplayId(0)
|
||||
: Server_DatabaseInterface(_localServer), localServer(_localServer)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,14 +20,13 @@ class LocalServer_DatabaseInterface : public Server_DatabaseInterface {
|
|||
Q_OBJECT
|
||||
private:
|
||||
LocalServer *localServer;
|
||||
int nextGameId, nextReplayId;
|
||||
protected:
|
||||
ServerInfo_User getUserData(const QString &name, bool withId = false);
|
||||
public:
|
||||
LocalServer_DatabaseInterface(LocalServer *_localServer);
|
||||
AuthenticationResult checkUserPassword(Server_ProtocolHandler *handler, const QString &user, const QString &password, QString &reasonStr, int &secondsLeft);
|
||||
int getNextGameId() { return ++nextGameId; }
|
||||
int getNextReplayId() { return ++nextReplayId; }
|
||||
int getNextGameId() { return localServer->getNextLocalGameId(); }
|
||||
int getNextReplayId() { return -1; }
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue