/
replay_controller.hpp
105 lines (81 loc) · 2.73 KB
/
replay_controller.hpp
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
Copyright (C) 2006 - 2014 by Joerg Hinrichs <joerg.hinrichs@alice-dsl.de>
wesnoth playlevel Copyright (C) 2003 by David White <dave@whitevine.net>
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.
See the COPYING file for more details.
*/
#ifndef REPLAY_CONTROLLER_H_INCLUDED
#define REPLAY_CONTROLLER_H_INCLUDED
#include "game_end_exceptions.hpp"
#include "gamestatus.hpp"
#include "play_controller.hpp"
#include <vector>
class video;
class replay_controller : public play_controller
{
public:
replay_controller(const config& level, game_state& state_of_game,
const int ticks, const config& game_config, CVideo& video);
virtual ~replay_controller();
virtual bool can_execute_command(const hotkey::hotkey_command& command, int index=-1) const;
//event handlers
virtual void preferences();
virtual void show_statistics();
void play_replay();
void reset_replay();
void stop_replay();
void replay_next_turn();
void replay_next_side();
void process_oos(const std::string& msg) const;
void replay_show_everything();
void replay_show_each();
void replay_show_team1();
void replay_skip_animation();
virtual void force_end_turn() {}
virtual void force_end_level(LEVEL_RESULT) {}
virtual void check_end_level() {}
virtual void on_not_observer() {}
std::vector<team> teams_start_;
bool manage_noninteractively();
protected:
virtual void init_gui();
private:
void init();
virtual void play_turn();
virtual void play_side(bool save);
void update_teams();
void update_gui();
void init_replay_display();
void rebuild_replay_theme();
void handle_generic_event(const std::string& /*name*/);
void reset_replay_ui();
void update_replay_ui();
void replay_ui_playback_should_start();
void replay_ui_playback_should_stop();
gui::button* play_button();
gui::button* stop_button();
gui::button* reset_button();
gui::button* play_turn_button();
gui::button* play_side_button();
bool replay_ui_has_all_buttons() {
return play_button() && stop_button() && reset_button() &&
play_turn_button() && play_side_button();
}
game_state gamestate_start_;
unit_map units_start_;
tod_manager tod_manager_start_;
unsigned int current_turn_;
bool is_playing_;
bool show_everything_;
unsigned int show_team_;
};
LEVEL_RESULT play_replay_level(const config& terrain_config,
const config* level, CVideo& video,
game_state& state_of_game, bool is_unit_test = false);
#endif