mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-29 01:53:54 -07:00
reworked protocol; only server code for now
This commit is contained in:
parent
da6a1a0dbd
commit
a8c45fda1a
13 changed files with 669 additions and 534 deletions
66
servatrice/src/player.h
Normal file
66
servatrice/src/player.h
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
#ifndef PLAYER_H
|
||||
#define PLAYER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
|
||||
class ServerSocket;
|
||||
class ServerGame;
|
||||
class PlayerZone;
|
||||
class Counter;
|
||||
class Arrow;
|
||||
|
||||
enum PlayerStatusEnum { StatusNormal, StatusSubmitDeck, StatusReadyStart, StatusPlaying };
|
||||
|
||||
class Player : public QObject {
|
||||
Q_OBJECT
|
||||
private:
|
||||
ServerGame *game;
|
||||
ServerSocket *socket;
|
||||
QMap<QString, PlayerZone *> zones;
|
||||
QMap<int, Counter *> counters;
|
||||
QMap<int, Arrow *> arrows;
|
||||
int playerId;
|
||||
QString playerName;
|
||||
bool spectator;
|
||||
int nextCardId;
|
||||
void clearZones();
|
||||
PlayerStatusEnum PlayerStatus;
|
||||
public:
|
||||
// Pfusch
|
||||
QList<QString> DeckList;
|
||||
QList<QString> SideboardList;
|
||||
// Pfusch Ende
|
||||
|
||||
Player(ServerGame *_game, int _playerId, const QString &_playerName, bool _spectator);
|
||||
void setSocket(ServerSocket *_socket) { socket = _socket; }
|
||||
|
||||
void setStatus(PlayerStatusEnum _status) { PlayerStatus = _status; }
|
||||
void setPlayerId(int _id) { playerId = _id; }
|
||||
PlayerStatusEnum getStatus() { return PlayerStatus; }
|
||||
int getPlayerId() const { return playerId; }
|
||||
bool getSpectator() const { return spectator; }
|
||||
QString getPlayerName() const { return playerName; }
|
||||
const QMap<QString, PlayerZone *> &getZones() const { return zones; }
|
||||
const QMap<int, Counter *> &getCounters() const { return counters; }
|
||||
const QMap<int, Arrow *> &getArrows() const { return arrows; }
|
||||
|
||||
int newCardId();
|
||||
int newCounterId() const;
|
||||
int newArrowId() const;
|
||||
|
||||
void addZone(PlayerZone *zone);
|
||||
void addArrow(Arrow *arrow);
|
||||
bool deleteArrow(int arrowId);
|
||||
void addCounter(Counter *counter);
|
||||
bool deleteCounter(int counterId);
|
||||
|
||||
void setupZones();
|
||||
|
||||
void privateEvent(const QString &line);
|
||||
void publicEvent(const QString &line, Player *player = 0);
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue