diff --git a/projectfiles/CodeBlocks/wesnoth.cbp b/projectfiles/CodeBlocks/wesnoth.cbp index 78883f373893..9aad4f7ef8ef 100644 --- a/projectfiles/CodeBlocks/wesnoth.cbp +++ b/projectfiles/CodeBlocks/wesnoth.cbp @@ -364,6 +364,8 @@ + + diff --git a/projectfiles/VC9/wesnoth.vcproj b/projectfiles/VC9/wesnoth.vcproj index a0f1c5bef0ec..9ed465d02db5 100644 --- a/projectfiles/VC9/wesnoth.vcproj +++ b/projectfiles/VC9/wesnoth.vcproj @@ -20340,6 +20340,14 @@ RelativePath="..\..\src\game_preferences_display.cpp" > + + + + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1fae30564ad4..0eda2b0c7b06 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -755,6 +755,7 @@ set(wesnoth-main_SRC game_events/wmi_container.cpp game_preferences.cpp game_preferences_display.cpp + game_state.cpp generic_event.cpp gui/auxiliary/canvas.cpp gui/auxiliary/log.cpp diff --git a/src/SConscript b/src/SConscript index 22c111fa4e3f..27a8c55f4e3b 100644 --- a/src/SConscript +++ b/src/SConscript @@ -287,6 +287,7 @@ wesnoth_sources = Split(""" game_events/pump.cpp game_events/wmi_container.cpp game_preferences.cpp + game_state.cpp gui/auxiliary/canvas.cpp gui/auxiliary/event/dispatcher.cpp gui/auxiliary/event/distributor.cpp diff --git a/src/game_state.cpp b/src/game_state.cpp new file mode 100644 index 000000000000..48d9e3dd124d --- /dev/null +++ b/src/game_state.cpp @@ -0,0 +1,29 @@ +/* + Copyright (C) 2014 by Chris Beck + 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. +*/ + +#include "game_state.hpp" + +#include "pathfind/teleport.hpp" + + +game_state::game_state(const config & level, const config & game_config) : + level_(level), + gamedata_(level_), + board_(game_config,level_), + tod_manager_(level_), + pathfind_manager_() +{} + +game_state::~game_state() {} + diff --git a/src/game_state.hpp b/src/game_state.hpp new file mode 100644 index 000000000000..a6e93d1b1646 --- /dev/null +++ b/src/game_state.hpp @@ -0,0 +1,40 @@ +/* + Copyright (C) 2014 by Chris Beck + 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 INCL_GAME_STATE_HPP_ +#define INCL_GAME_STATE_HPP_ + +class config; + +#include "game_board.hpp" +#include "game_data.hpp" +#include "tod_manager.hpp" + +#include + +namespace pathfind { class manager; } + +struct game_state { + const config& level_; + game_data gamedata_; + game_board board_; + tod_manager tod_manager_; + boost::scoped_ptr pathfind_manager_; + + game_state(const config & level, const config & game_config); + + ~game_state(); +}; + +#endif diff --git a/src/play_controller.cpp b/src/play_controller.cpp index a7825a39186b..7aeb7cb9799e 100644 --- a/src/play_controller.cpp +++ b/src/play_controller.cpp @@ -93,16 +93,6 @@ static void clear_resources() } -game_state::game_state(const config & level, const config & game_config) : - level_(level), - gamedata_(level_), - board_(game_config,level_), - tod_manager_(level_), - pathfind_manager_() -{} - -game_state::~game_state() {} - play_controller::play_controller(const config& level, saved_game& state_of_game, const int ticks, const config& game_config, CVideo& video, bool skip_replay) : diff --git a/src/play_controller.hpp b/src/play_controller.hpp index 57fc5e0306ef..8a057445e52b 100644 --- a/src/play_controller.hpp +++ b/src/play_controller.hpp @@ -18,8 +18,7 @@ #include "controller_base.hpp" #include "game_end_exceptions.hpp" -#include "game_board.hpp" -#include "game_data.hpp" +#include "game_state.hpp" #include "help.hpp" #include "menu_events.hpp" #include "mouse_events.hpp" @@ -71,17 +70,7 @@ namespace wb { } // namespace wb // Holds gamestate related objects -struct game_state { - const config& level_; - game_data gamedata_; - game_board board_; - tod_manager tod_manager_; - boost::scoped_ptr pathfind_manager_; - - game_state(const config & level, const config & game_config); - - ~game_state(); -}; +struct game_state; class play_controller : public controller_base, public events::observer, public savegame::savegame_config {