/
storedgame.h
63 lines (51 loc) · 1.15 KB
/
storedgame.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* This file is part of the Springlobby (GPL v2 or later), see COPYING */
#ifndef REPLAY_H_INCLUDED
#define REPLAY_H_INCLUDED
#include "offlinebattle.h"
struct StoredGame {
int id;
int playernum;
bool can_watch;
int duration; //in seconds
int size; //in bytes
time_t date;
std::string date_string;
OfflineBattle battle;
enum Type {
REPLAY,
SAVEGAME
} type;
StoredGame(const size_t idx = 0)
: id(idx)
, playernum(0)
, can_watch(false)
, duration(0)
, size(0)
, date(0)
, type(REPLAY)
{
}
StoredGame(const StoredGame& copy) = delete;
StoredGame(StoredGame&& moved)
{
this->operator=((StoredGame &&) moved);
}
StoredGame& operator=(const StoredGame& copy) = delete;
StoredGame& operator=(StoredGame&& moved)
{
id = moved.id;
playernum = moved.playernum;
can_watch = moved.can_watch;
duration = moved.duration;
size = moved.size;
date = moved.date;
date_string = moved.date_string;
battle.operator=((OfflineBattle &&) moved.battle);
return *this;
}
bool Equals(const StoredGame& other) const
{
return battle.GetPlayBackFilePath() == other.battle.GetPlayBackFilePath();
}
};
#endif