-
-
Notifications
You must be signed in to change notification settings - Fork 988
/
game_launcher.hpp
137 lines (106 loc) · 3.85 KB
/
game_launcher.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/*
Copyright (C) 2003 - 2014 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 GAME_LAUNCHER_H_INCLUDED
#define GAME_LAUNCHER_H_INCLUDED
#include "global.hpp"
#include "editor/editor_main.hpp" // for EXIT_STATUS
#include "events.hpp" // for event_context
#include "font.hpp" // for manager
#include "game_display.hpp" // for game_display
#include "game_errors.hpp" // for load_game_exception, etc
#include "game_preferences.hpp" // for manager
#include "hotkey/hotkey_manager.hpp" // for manager
#include "image.hpp" // for manager
#include "saved_game.hpp" // for saved_game
#include "scoped_resource.hpp" // for scoped_ptr
#include "sound.hpp" // for music_thinker
#include "thread.hpp" // for manager
#include "video.hpp" // for CVideo, resize_monitor
#include <string> // for string
#include <vector> // for vector
class commandline_options;
class config;
struct jump_to_campaign_info
{
public:
jump_to_campaign_info(bool jump,int difficulty, std::string campaign_id,std::string scenario_id)
: jump_(jump)
, difficulty_(difficulty)
, campaign_id_(campaign_id)
, scenario_id_(scenario_id)
{
}
bool jump_;
int difficulty_;
std::string campaign_id_,scenario_id_;
};
class game_launcher
{
public:
game_launcher(const commandline_options& cmdline_opts, const char* appname);
~game_launcher();
game_display& disp();
bool init_video();
bool init_language();
bool init_joystick();
bool play_test();
bool play_screenshot_mode();
bool play_render_image_mode();
int unit_test();
bool is_loading() const;
void clear_loaded_game() { game::load_game_exception::game.clear(); }
bool load_game();
void set_tutorial();
std::string jump_to_campaign_id() const;
bool new_campaign();
bool goto_campaign();
bool goto_multiplayer();
bool goto_editor();
bool jump_to_editor() const { return jump_to_editor_; }
bool play_multiplayer();
bool play_multiplayer_commandline();
bool change_language();
void show_preferences();
enum RELOAD_GAME_DATA { RELOAD_DATA, NO_RELOAD_DATA };
void launch_game(RELOAD_GAME_DATA reload=RELOAD_DATA);
void play_replay();
editor::EXIT_STATUS start_editor() { return start_editor(""); }
void start_wesnothd();
const commandline_options & opts() const { return cmdline_opts_; }
private:
game_launcher(const game_launcher&);
void operator=(const game_launcher&);
void mark_completed_campaigns(std::vector<config>& campaigns);
editor::EXIT_STATUS start_editor(const std::string& filename);
const commandline_options& cmdline_opts_;
util::scoped_ptr<game_display> disp_;
CVideo video_;
//this should get destroyed *after* the video, since we want
//to clean up threads after the display disappears.
const threading::manager thread_manager;
const font::manager font_manager_;
const preferences::manager prefs_manager_;
const image::manager image_manager_;
const events::event_context main_event_context_;
const hotkey::manager hotkey_manager_;
sound::music_thinker music_thinker_;
resize_monitor resize_monitor_;
std::string test_scenario_;
std::string screenshot_map_, screenshot_filename_;
saved_game state_;
bool play_replay_;
std::string multiplayer_server_;
bool jump_to_multiplayer_;
jump_to_campaign_info jump_to_campaign_;
bool jump_to_editor_;
};
#endif