move game_state to its own file

This commit is contained in:
Chris Beck 2014-06-24 15:36:58 -04:00
parent 3d6f2d7821
commit 30a443d12f
8 changed files with 83 additions and 23 deletions

View file

@ -364,6 +364,8 @@
<Unit filename="..\..\src\game_preferences.cpp" />
<Unit filename="..\..\src\game_preferences.hpp" />
<Unit filename="..\..\src\game_preferences_display.cpp" />
<Unit filename="..\..\src\game_state.cpp" />
<Unit filename="..\..\src\game_state.hpp" />
<Unit filename="..\..\src\generators\cavegen.cpp" />
<Unit filename="..\..\src\generators\cavegen.hpp" />
<Unit filename="..\..\src\generators\map_create.cpp" />

View file

@ -20340,6 +20340,14 @@
RelativePath="..\..\src\game_preferences_display.cpp"
>
</File>
<File
RelativePath="..\..\src\game_state.cpp"
>
</File>
<File
RelativePath="..\..\src\game_state.hpp"
>
</File>
<File
RelativePath="..\..\src\generic_event.cpp"
>

View file

@ -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

View file

@ -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

29
src/game_state.cpp Normal file
View file

@ -0,0 +1,29 @@
/*
Copyright (C) 2014 by Chris Beck <render787@gmail.com>
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() {}

40
src/game_state.hpp Normal file
View file

@ -0,0 +1,40 @@
/*
Copyright (C) 2014 by Chris Beck <render787@gmail.com>
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 <boost/scoped_ptr.hpp>
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> pathfind_manager_;
game_state(const config & level, const config & game_config);
~game_state();
};
#endif

View file

@ -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) :

View file

@ -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> 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
{