mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-14 19:18:55 -07:00
Clang-format (#3028)
* 1/3 Add .clang-format file and travis compilation check * 2/3 Run clang-format * 3/3 Fix compilation problems due to include reordering * 3bis/3 AfterControlStatement: false
This commit is contained in:
parent
8dbdd24c8e
commit
b29bd9e070
272 changed files with 13378 additions and 9535 deletions
|
|
@ -20,16 +20,16 @@
|
|||
#ifndef SERVERGAME_H
|
||||
#define SERVERGAME_H
|
||||
|
||||
#include <QStringList>
|
||||
#include <QObject>
|
||||
#include <QMutex>
|
||||
#include <QSet>
|
||||
#include <QDateTime>
|
||||
#include <QMap>
|
||||
#include "server_response_containers.h"
|
||||
#include "pb/event_leave.pb.h"
|
||||
#include "pb/response.pb.h"
|
||||
#include "pb/serverinfo_game.pb.h"
|
||||
#include "pb/event_leave.pb.h"
|
||||
#include "server_response_containers.h"
|
||||
#include <QDateTime>
|
||||
#include <QMap>
|
||||
#include <QMutex>
|
||||
#include <QObject>
|
||||
#include <QSet>
|
||||
#include <QStringList>
|
||||
|
||||
class QTimer;
|
||||
class GameEventContainer;
|
||||
|
|
@ -42,7 +42,8 @@ class ServerInfo_Game;
|
|||
class Server_AbstractUserInterface;
|
||||
class Event_GameStateChanged;
|
||||
|
||||
class Server_Game : public QObject {
|
||||
class Server_Game : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
Server_Room *room;
|
||||
|
|
@ -71,8 +72,11 @@ private:
|
|||
QTimer *pingClock;
|
||||
QList<GameReplay *> replayList;
|
||||
GameReplay *currentReplay;
|
||||
|
||||
void createGameStateChangedEvent(Event_GameStateChanged *event, Server_Player *playerWhosAsking, bool omniscient, bool withUserInfo);
|
||||
|
||||
void createGameStateChangedEvent(Event_GameStateChanged *event,
|
||||
Server_Player *playerWhosAsking,
|
||||
bool omniscient,
|
||||
bool withUserInfo);
|
||||
void sendGameStateToPlayers();
|
||||
void storeGameInformation();
|
||||
signals:
|
||||
|
|
@ -81,48 +85,117 @@ signals:
|
|||
private slots:
|
||||
void pingClockTimeout();
|
||||
void doStartGameIfReady();
|
||||
|
||||
public:
|
||||
mutable QMutex gameMutex;
|
||||
Server_Game(const ServerInfo_User &_creatorInfo, int _gameId, const QString &_description, const QString &_password, int _maxPlayers, const QList<int> &_gameTypes, bool _onlyBuddies, bool _onlyRegistered, bool _spectatorsAllowed, bool _spectatorsNeedPassword, bool _spectatorsCanTalk, bool _spectatorsSeeEverything, Server_Room *parent);
|
||||
Server_Game(const ServerInfo_User &_creatorInfo,
|
||||
int _gameId,
|
||||
const QString &_description,
|
||||
const QString &_password,
|
||||
int _maxPlayers,
|
||||
const QList<int> &_gameTypes,
|
||||
bool _onlyBuddies,
|
||||
bool _onlyRegistered,
|
||||
bool _spectatorsAllowed,
|
||||
bool _spectatorsNeedPassword,
|
||||
bool _spectatorsCanTalk,
|
||||
bool _spectatorsSeeEverything,
|
||||
Server_Room *parent);
|
||||
~Server_Game();
|
||||
Server_Room *getRoom() const { return room; }
|
||||
Server_Room *getRoom() const
|
||||
{
|
||||
return room;
|
||||
}
|
||||
void getInfo(ServerInfo_Game &result) const;
|
||||
int getHostId() const { return hostId; }
|
||||
ServerInfo_User *getCreatorInfo() const { return creatorInfo; }
|
||||
bool getGameStarted() const { return gameStarted; }
|
||||
int getHostId() const
|
||||
{
|
||||
return hostId;
|
||||
}
|
||||
ServerInfo_User *getCreatorInfo() const
|
||||
{
|
||||
return creatorInfo;
|
||||
}
|
||||
bool getGameStarted() const
|
||||
{
|
||||
return gameStarted;
|
||||
}
|
||||
int getPlayerCount() const;
|
||||
int getSpectatorCount() const;
|
||||
const QMap<int, Server_Player *> &getPlayers() const { return players; }
|
||||
int getGameId() const { return gameId; }
|
||||
QString getDescription() const { return description; }
|
||||
QString getPassword() const { return password; }
|
||||
int getMaxPlayers() const { return maxPlayers; }
|
||||
bool getSpectatorsAllowed() const { return spectatorsAllowed; }
|
||||
bool getSpectatorsNeedPassword() const { return spectatorsNeedPassword; }
|
||||
bool getSpectatorsCanTalk() const { return spectatorsCanTalk; }
|
||||
bool getSpectatorsSeeEverything() const { return spectatorsSeeEverything; }
|
||||
Response::ResponseCode checkJoin(ServerInfo_User *user, const QString &_password, bool spectator, bool overrideRestrictions);
|
||||
const QMap<int, Server_Player *> &getPlayers() const
|
||||
{
|
||||
return players;
|
||||
}
|
||||
int getGameId() const
|
||||
{
|
||||
return gameId;
|
||||
}
|
||||
QString getDescription() const
|
||||
{
|
||||
return description;
|
||||
}
|
||||
QString getPassword() const
|
||||
{
|
||||
return password;
|
||||
}
|
||||
int getMaxPlayers() const
|
||||
{
|
||||
return maxPlayers;
|
||||
}
|
||||
bool getSpectatorsAllowed() const
|
||||
{
|
||||
return spectatorsAllowed;
|
||||
}
|
||||
bool getSpectatorsNeedPassword() const
|
||||
{
|
||||
return spectatorsNeedPassword;
|
||||
}
|
||||
bool getSpectatorsCanTalk() const
|
||||
{
|
||||
return spectatorsCanTalk;
|
||||
}
|
||||
bool getSpectatorsSeeEverything() const
|
||||
{
|
||||
return spectatorsSeeEverything;
|
||||
}
|
||||
Response::ResponseCode
|
||||
checkJoin(ServerInfo_User *user, const QString &_password, bool spectator, bool overrideRestrictions);
|
||||
bool containsUser(const QString &userName) const;
|
||||
void addPlayer(Server_AbstractUserInterface *userInterface, ResponseContainer &rc, bool spectator, bool broadcastUpdate = true);
|
||||
void addPlayer(Server_AbstractUserInterface *userInterface,
|
||||
ResponseContainer &rc,
|
||||
bool spectator,
|
||||
bool broadcastUpdate = true);
|
||||
void removePlayer(Server_Player *player, Event_Leave::LeaveReason reason);
|
||||
void removeArrowsRelatedToPlayer(GameEventStorage &ges, Server_Player *player);
|
||||
void unattachCards(GameEventStorage &ges, Server_Player *player);
|
||||
bool kickPlayer(int playerId);
|
||||
void startGameIfReady();
|
||||
void stopGameIfFinished();
|
||||
int getActivePlayer() const { return activePlayer; }
|
||||
int getActivePhase() const { return activePhase; }
|
||||
int getActivePlayer() const
|
||||
{
|
||||
return activePlayer;
|
||||
}
|
||||
int getActivePhase() const
|
||||
{
|
||||
return activePhase;
|
||||
}
|
||||
void setActivePlayer(int _activePlayer);
|
||||
void setActivePhase(int _activePhase);
|
||||
void nextTurn();
|
||||
int getSecondsElapsed() const { return secondsElapsed; }
|
||||
int getSecondsElapsed() const
|
||||
{
|
||||
return secondsElapsed;
|
||||
}
|
||||
|
||||
void createGameJoinedEvent(Server_Player *player, ResponseContainer &rc, bool resuming);
|
||||
|
||||
GameEventContainer *prepareGameEvent(const ::google::protobuf::Message &gameEvent, int playerId, GameEventContext *context = 0);
|
||||
|
||||
GameEventContainer *
|
||||
prepareGameEvent(const ::google::protobuf::Message &gameEvent, int playerId, GameEventContext *context = 0);
|
||||
GameEventContext prepareGameEventContext(const ::google::protobuf::Message &gameEventContext);
|
||||
|
||||
void sendGameEventContainer(GameEventContainer *cont, GameEventStorageItem::EventRecipients recipients = GameEventStorageItem::SendToPrivate | GameEventStorageItem::SendToOthers, int privatePlayerId = -1);
|
||||
|
||||
void sendGameEventContainer(GameEventContainer *cont,
|
||||
GameEventStorageItem::EventRecipients recipients = GameEventStorageItem::SendToPrivate |
|
||||
GameEventStorageItem::SendToOthers,
|
||||
int privatePlayerId = -1);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue