Cavoke  1.1.0
A Platform for creating and hosting multiplayer turn-based board games
Loading...
Searching...
No Matches
player.cpp
1#include "player.h"
2
3Player::Player() = default;
4
5Player::Player(int _player_id, User _user)
6 : player_id(_player_id), user(std::move(_user)) {
7}
8
9void Player::read(const QJsonObject &json) {
10 if (json.contains(PLAYER_ID) &&
11 json[PLAYER_ID].isDouble()) { // FIXME: wat?
12 player_id = json[PLAYER_ID].toInt();
13 }
14 if (json.contains(USER) && json[USER].isObject()) {
15 user = User();
16 user.read(json[USER].toObject());
17 }
18}
19
20void Player::write(QJsonObject &json) {
21 assert(false); // Should not be used
22}
Definition: user.h:6