| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
1 |
/* |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
2 |
=========================================================================== |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
3 |
blockattack - Block Attack - Rise of the Blocks |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
4 |
Copyright (C) 2005-2012 Poul Sander |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
5 |
|
| c53e6443 |
sago007 |
2012-04-17 11:04 |
6 |
This program is free software: you can redistribute it and/or modify |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
7 |
it under the terms of the GNU General Public License as published by |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
8 |
the Free Software Foundation, either version 2 of the License, or |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
9 |
(at your option) any later version. |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
10 |
|
| c53e6443 |
sago007 |
2012-04-17 11:04 |
11 |
This program is distributed in the hope that it will be useful, |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
14 |
GNU General Public License for more details. |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
15 |
|
| c53e6443 |
sago007 |
2012-04-17 11:04 |
16 |
You should have received a copy of the GNU General Public License |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
17 |
along with this program. If not, see http://www.gnu.org/licenses/ |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
18 |
|
| c53e6443 |
sago007 |
2012-04-17 11:04 |
19 |
Source information and contacts persons can be found at |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
20 |
http://blockattack.sf.net |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
21 |
=========================================================================== |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
22 |
*/ |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
23 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
24 |
//headerfile for replay.h |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
25 |
/* |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
26 |
replay is used to save a replay, there is saved 10 moves per second, should be |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
27 |
able to give a realistic replay |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
28 |
*/ |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
29 |
|
| 17916a2e |
sago007 |
2010-11-07 11:26 |
30 |
#ifndef REPLAY_H |
| 17916a2e |
sago007 |
2010-11-07 11:26 |
31 |
#define REPLAY_H 1 |
| 17916a2e |
sago007 |
2010-11-07 11:26 |
32 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
33 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
34 |
#include "SDL.h" |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
35 |
#include <stdlib.h> |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
36 |
#include <iostream> |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
37 |
#include <fstream> |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
38 |
#include <vector> |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
39 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
40 |
using namespace std; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
41 |
|
| d12916ab |
sago007 |
2012-04-19 23:30 |
42 |
struct Action |
| d12916ab |
sago007 |
2012-04-19 23:30 |
43 |
{ |
| 79d3c1d3 |
sago007 |
2012-05-05 15:54 |
44 |
Sint32 time; |
| 50258544 |
sago007 |
2012-05-10 19:11 |
45 |
Sint32 action; |
| 6c9b4cd7 |
sago007 |
2012-05-01 19:34 |
46 |
string param; |
| d12916ab |
sago007 |
2012-04-19 23:30 |
47 |
}; |
| d12916ab |
sago007 |
2012-04-19 23:30 |
48 |
|
| c53e6443 |
sago007 |
2012-04-17 11:04 |
49 |
class Replay |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
50 |
{ |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
51 |
private: |
| d12916ab |
sago007 |
2012-04-19 23:30 |
52 |
vector<Action> actions; |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
53 |
//If we are loaded from a file, then we are read only |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
54 |
bool isLoaded; |
| 6c9b4cd7 |
sago007 |
2012-05-01 19:34 |
55 |
//Store player name |
| 6c9b4cd7 |
sago007 |
2012-05-01 19:34 |
56 |
string name; |
| c96f480e |
sago007 |
2009-03-28 18:59 |
57 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
58 |
public: |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
59 |
|
| 6c9b4cd7 |
sago007 |
2012-05-01 19:34 |
60 |
|
| c53e6443 |
sago007 |
2012-04-17 11:04 |
61 |
|
| c53e6443 |
sago007 |
2012-04-17 11:04 |
62 |
Replay(); //Constructor |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
63 |
Replay(const Replay& r); //Copy constructor |
| d12916ab |
sago007 |
2012-04-19 23:30 |
64 |
|
| 6c9b4cd7 |
sago007 |
2012-05-01 19:34 |
65 |
//New replay type 2.0.0+: |
| 6c9b4cd7 |
sago007 |
2012-05-01 19:34 |
66 |
void addAction(int tick, int action, string param); |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
67 |
|
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
68 |
//Ok, I'll ignore this for some time, and just save to file, if however, we ever use a dynamic saving structure, we are fucked |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
69 |
bool saveReplay(string); //Saves a replay |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
70 |
bool saveReplay(string,Replay p2); //saves a replay, plus another replay given as a parameter |
| c53e6443 |
sago007 |
2012-04-17 11:04 |
71 |
bool loadReplay(string); //laods a replay |
| 6c9b4cd7 |
sago007 |
2012-05-01 19:34 |
72 |
bool loadReplay2(string); |
| 6c9b4cd7 |
sago007 |
2012-05-01 19:34 |
73 |
void setName(string name); |
| 79d3c1d3 |
sago007 |
2012-05-05 15:54 |
74 |
string getName() const; |
| 79d3c1d3 |
sago007 |
2012-05-05 15:54 |
75 |
vector<Action> getActions() const; //loads the second part of the replay file, if it exists, returns false otherwise |
| 89c4a3a6 |
sago007 |
2008-08-29 14:32 |
76 |
}; |
| 17916a2e |
sago007 |
2010-11-07 11:26 |
77 |
|
| 17916a2e |
sago007 |
2010-11-07 11:26 |
78 |
#endif |
|
|
1970-01-01 00:00 |
79 |
|