clenaup more includes

this changes some class member types to scoped pointer so that we can
remove an include from the header.
This commit is contained in:
gfgtdf 2016-01-16 23:32:30 +01:00
parent a05a40ab14
commit 2369d3f9ae
18 changed files with 36 additions and 36 deletions

View file

@ -38,7 +38,6 @@
#include "image.hpp"
#include "log.hpp"
#include "marked-up_text.hpp"
#include "video.hpp"
#include "wml_separators.hpp"
#include "wml_exception.hpp"

View file

@ -18,13 +18,13 @@
#include "filesystem.hpp"
#include "gettext.hpp"
#include "game_config.hpp"
#include "game_display.hpp"
#include "log.hpp"
#include "marked-up_text.hpp"
#include "show_dialog.hpp"
#include "utils/sha1.hpp"
#include "serialization/binary_or_text.hpp"
#include "serialization/parser.hpp"
#include "serialization/string_utils.hpp"
#include "version.hpp"
#include <boost/foreach.hpp>

View file

@ -21,7 +21,7 @@
#include "sdl/compat.hpp"
#if SDL_VERSION_ATLEAST(2,0,0)
#include "video.hpp"
#include "video.hpp" //SDL_GetAppState()
#else
#include "SDL_active.h"
#endif

View file

@ -17,7 +17,6 @@
#include "config_assign.hpp"
#include "game_config_manager.hpp"
#include "game_launcher.hpp"
#include "video.hpp"
#include "game_preferences.hpp"
#include "generators/map_generator.hpp"
#include "gui/dialogs/campaign_difficulty.hpp"

View file

@ -18,6 +18,7 @@
#include "dialogs.hpp"
#include "formula_string_utils.hpp"
#include "saved_game.hpp"
#include "game_config.hpp"
#include "game_config_manager.hpp"
#include "gettext.hpp"
#include "log.hpp"

View file

@ -14,7 +14,6 @@
#ifndef MP_GAME_UTILS_HPP_INCLUDED
#define MP_GAME_UTILS_HPP_INCLUDED
#include "game_display.hpp"
#include "mp_game_settings.hpp"
#include "network.hpp"

View file

@ -17,8 +17,6 @@
#include <string>
#include "config.hpp"
#include "video.hpp"
#include "video.hpp"
#include "gui/widgets/widget.hpp"
#include "gui/widgets/window.hpp"
#include "widgets/scrollpane.hpp"

View file

@ -42,9 +42,11 @@
#include "playcampaign.hpp"
#include "settings.hpp"
#include "scripting/plugins/context.hpp"
#include "sdl/rect.hpp"
#include "sound.hpp"
#include "statistics.hpp"
#include "unit_id.hpp"
#include "video.hpp"
#include "game_config_manager.hpp"
#include <boost/bind.hpp>

View file

@ -15,7 +15,6 @@
#include "global.hpp"
#include "gettext.hpp"
#include "game_display.hpp"
#include "game_preferences.hpp"
#include "construct_dialog.hpp"
#include "settings.hpp"

View file

@ -21,7 +21,6 @@
#include "ai/configuration.hpp"
#include "dialogs.hpp"
#include "display_chat_manager.hpp"
#include "game_display.hpp"
#include "game_preferences.hpp"
#include "gettext.hpp"
#include "log.hpp"

View file

@ -19,7 +19,7 @@
#include "game_config_manager.hpp"
#include "game_preferences.hpp"
#include "gui/dialogs/transient_message.hpp"
#include "video.hpp"
#include "image.hpp"
#include "log.hpp"
#include "marked-up_text.hpp"
#include "mp_game_utils.hpp"
@ -28,10 +28,12 @@
#include "saved_game.hpp"
#include "mp_ui_alerts.hpp"
#include "scripting/plugins/context.hpp"
#include "sdl/rect.hpp"
#include "unit_types.hpp"
#include "wml_exception.hpp"
#include "wml_separators.hpp"
#include "formula_string_utils.hpp"
#include "video.hpp"
#include <boost/bind.hpp>
#include <boost/foreach.hpp>

View file

@ -56,6 +56,7 @@
#include "statistics.hpp"
#include "tstring.hpp" // for operator==, operator!=
#include "util.hpp" // for lexical_cast_default
#include "video.hpp" // for CVideo, resize_monitor
#include "wml_exception.hpp" // for twml_exception
#include <algorithm> // for copy, max, min, stable_sort
@ -106,7 +107,7 @@ static lg::log_domain log_enginerefac("enginerefac");
game_launcher::game_launcher(const commandline_options& cmdline_opts, const char *appname) :
cmdline_opts_(cmdline_opts),
video_(),
video_(new CVideo()),
thread_manager(),
font_manager_(),
prefs_manager_(),
@ -114,7 +115,7 @@ game_launcher::game_launcher(const commandline_options& cmdline_opts, const char
main_event_context_(),
hotkey_manager_(),
music_thinker_(),
resize_monitor_(),
resize_monitor_(new resize_monitor()),
test_scenario_("test"),
screenshot_map_(),
screenshot_filename_(),
@ -186,7 +187,7 @@ game_launcher::game_launcher(const commandline_options& cmdline_opts, const char
if (cmdline_opts_.fps)
preferences::set_show_fps(true);
if (cmdline_opts_.fullscreen)
video_.set_fullscreen(true);
video().set_fullscreen(true);
if (cmdline_opts_.load)
game::load_game_exception::game = *cmdline_opts_.load;
if (cmdline_opts_.max_fps) {
@ -289,7 +290,7 @@ game_launcher::game_launcher(const commandline_options& cmdline_opts, const char
}
if (cmdline_opts_.windowed)
video_.set_fullscreen(false);
video().set_fullscreen(false);
if (cmdline_opts_.with_replay)
game::load_game_exception::show_replay = true;
@ -373,22 +374,22 @@ bool game_launcher::init_video()
std::cerr << "--nogui flag is only valid with --multiplayer or --screenshot or --plugin flags\n";
return false;
}
video_.make_fake();
video().make_fake();
game_config::no_delay = true;
return true;
}
// Initialize a new window
video_.init_window();
video().init_window();
// Set window title and icon
video_.set_window_title(game_config::get_default_title_string());
video().set_window_title(game_config::get_default_title_string());
#if !(defined(__APPLE__))
surface icon(image::get_image("icons/icon-game.png", image::UNSCALED));
if(icon != NULL) {
video_.set_window_icon(icon);
video().set_window_icon(icon);
}
#endif
return true;
@ -401,7 +402,7 @@ bool game_launcher::init_video()
std::cerr << "--nogui flag is only valid with --multiplayer or --screenshot or --plugin flags\n";
return false;
}
video_.make_fake();
video().make_fake();
game_config::no_delay = true;
return true;
}
@ -420,7 +421,7 @@ bool game_launcher::init_video()
int bpp = 0;
int video_flags = 0;
bool found_matching = video_.detect_video_settings(resolution, bpp, video_flags);
bool found_matching = video().detect_video_settings(resolution, bpp, video_flags);
if (cmdline_opts_.screenshot) {
bpp = CVideo::DefaultBpp;
@ -428,7 +429,7 @@ bool game_launcher::init_video()
if(!found_matching && (video_flags & SDL_FULLSCREEN)) {
video_flags ^= SDL_FULLSCREEN;
found_matching = video_.detect_video_settings(resolution, bpp, video_flags);
found_matching = video().detect_video_settings(resolution, bpp, video_flags);
if (found_matching) {
std::cerr << "Failed to set " << resolution.first << 'x' << resolution.second << 'x' << bpp << " in fullscreen mode. Using windowed instead.\n";
}
@ -443,8 +444,8 @@ bool game_launcher::init_video()
}
std::cerr << "Setting mode to " << resolution.first << "x" << resolution.second << "x" << bpp << "\n";
const int res = video_.setMode(resolution.first,resolution.second,bpp,video_flags);
video_.setBpp(bpp);
const int res = video().setMode(resolution.first,resolution.second,bpp,video_flags);
video().setBpp(bpp);
if(res == 0) {
std::cerr << "Required video mode, " << resolution.first << "x"
<< resolution.second << "x" << bpp << " is not supported\n";
@ -671,7 +672,7 @@ bool game_launcher::play_screenshot_mode()
::init_textdomains(game_config_manager::get()->game_config());
editor::start(game_config_manager::get()->game_config(), video_,
editor::start(game_config_manager::get()->game_config(), video(),
screenshot_map_, true, screenshot_filename_);
return false;
}
@ -1054,7 +1055,7 @@ bool game_launcher::change_language()
if (!(cmdline_opts_.nogui || cmdline_opts_.headless_unit_test)) {
#if SDL_VERSION_ATLEAST(2, 0, 0)
video_.set_window_title(game_config::get_default_title_string());
video().set_window_title(game_config::get_default_title_string());
#else
SDL_WM_SetCaption(game_config::get_default_title_string().c_str(), NULL);
#endif
@ -1133,7 +1134,7 @@ editor::EXIT_STATUS game_launcher::start_editor(const std::string& filename)
::init_textdomains(game_config_manager::get()->game_config());
editor::EXIT_STATUS res = editor::start(
game_config_manager::get()->game_config(), video_, filename);
game_config_manager::get()->game_config(), video(), filename);
if(res != editor::EXIT_RELOAD_DATA)
return res;

View file

@ -27,13 +27,14 @@
#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;
class CVideo;
class resize_monitor;
struct jump_to_campaign_info
{
@ -56,7 +57,7 @@ public:
game_launcher(const commandline_options& cmdline_opts, const char* appname);
~game_launcher();
CVideo& video() { return video_; }
CVideo& video() { return *video_; }
bool init_video();
bool init_language();
@ -105,8 +106,8 @@ private:
editor::EXIT_STATUS start_editor(const std::string& filename);
const commandline_options& cmdline_opts_;
CVideo video_;
//Never null.
boost::scoped_ptr<CVideo> video_;
//this should get destroyed *after* the video, since we want
//to clean up threads after the display disappears.
@ -118,7 +119,8 @@ private:
const events::event_context main_event_context_;
const hotkey::manager hotkey_manager_;
sound::music_thinker music_thinker_;
resize_monitor resize_monitor_;
//Never null.
boost::scoped_ptr<resize_monitor> resize_monitor_;
std::string test_scenario_;

View file

@ -15,7 +15,6 @@
#include "lua_map_generator.hpp"
#include "config.hpp"
#include "video.hpp"
#include "game_errors.hpp"
#include "scripting/mapgen_lua_kernel.hpp"

View file

@ -26,7 +26,6 @@
#endif
#include "gui/widgets/settings.hpp"
#include "utils/foreach.tpp"
#include "video.hpp"
#include <boost/bind.hpp>

View file

@ -25,8 +25,8 @@
#include "key.hpp" // for CKey
#include "log.hpp" // for log_scope
#include "sdl/rect.hpp"
#include "video.hpp"
class CVideo;
struct SDL_Rect;
namespace help {

View file

@ -46,7 +46,6 @@
#include "scripting/lua_types.hpp" // for getunitKey, dlgclbkKey, etc
#include "serialization/string_utils.hpp"
#include "tstring.hpp"
#include "video.hpp"
#include <boost/bind.hpp>
@ -57,6 +56,8 @@
#include "lua/lauxlib.h" // for luaL_checkinteger, etc
#include "lua/lua.h" // for lua_setfield, etc
class CVideo;
static lg::log_domain log_scripting_lua("scripting/lua");
#define ERR_LUA LOG_STREAM(err, log_scripting_lua)

View file

@ -22,7 +22,7 @@
#include "events.hpp"
#include "interface.hpp"
#include "video.hpp"
#include "video.hpp" //for resize_lock
#include <boost/shared_ptr.hpp>