Don't include config.hpp when possible

Instead, try to forward-declare it only.
This commit is contained in:
Celtic Minstrel 2016-02-23 15:40:49 -05:00
parent 0484fdd414
commit baed863df0
27 changed files with 40 additions and 28 deletions

View file

@ -16,6 +16,7 @@
#include "addon/manager.hpp"
#include "game_config.hpp"
#include "config.hpp"
#include "gettext.hpp"
#include "image.hpp"
#include "log.hpp"

View file

@ -15,14 +15,15 @@
#ifndef ADDON_INFO_HPP_INCLUDED
#define ADDON_INFO_HPP_INCLUDED
#include "config.hpp"
#include "version.hpp"
#include "addon/validation.hpp"
#include <set>
#include <map>
struct addon_info;
class config;
typedef std::map<std::string, addon_info> addons_list;
struct addon_info

View file

@ -13,6 +13,7 @@
*/
#include "addon/state.hpp"
#include "config.hpp"
#include "addon/manager.hpp"
#include "font.hpp"

View file

@ -16,6 +16,7 @@
#define ADDON_STATE_HPP_INCLUDED
#include "addon/info.hpp"
#include <map>
/** Defines various add-on installation statuses. */
enum ADDON_STATUS {

View file

@ -16,10 +16,10 @@
#define COMMON_PALETTES_H_INCLUDED
#include "display.hpp"
#include "config.hpp"
#include "gui/widgets/widget.hpp"
struct SDL_Rect;
class config;
namespace editor {

View file

@ -16,7 +16,6 @@
#define EDITOR_TOOLKIT_H_INCLUDED
#include "config.hpp"
#include "editor/map/context_manager.hpp"
#include "editor/palette/palette_manager.hpp"
#include "editor/toolkit/brush.hpp"
@ -24,6 +23,8 @@
#include <boost/scoped_ptr.hpp>
class config;
namespace editor {

View file

@ -15,6 +15,7 @@
#include "global.hpp"
#include "game_classification.hpp"
#include "game_config.hpp"
#include "config.hpp"
#include "util.hpp"
#include "serialization/string_utils.hpp"
#include "log.hpp"

View file

@ -15,9 +15,11 @@
#ifndef GAME_CLASSIFICATION_HPP_INCLUDED
#define GAME_CLASSIFICATION_HPP_INCLUDED
#include "config.hpp"
#include "make_enum.hpp"
#include "savegame_config.hpp"
#include <vector>
class config;
/// The default difficulty setting for campaigns.
extern const std::string DEFAULT_DIFFICULTY;

View file

@ -49,3 +49,10 @@ void end_level_data::read(const config& cfg)
proceed_to_next_level = cfg["proceed_to_next_level"].to_bool(true);
is_victory = cfg["is_victory"].to_bool(true);
}
config end_level_data::to_config() const
{
config r;
write(r);
return r;
}

View file

@ -24,13 +24,14 @@
#include "lua_jailbreak_exception.hpp"
#include "config.hpp"
#include "make_enum.hpp"
#include <string>
#include <exception>
#include <boost/optional.hpp>
class config;
MAKE_ENUM(LEVEL_RESULT,
(VICTORY, "victory")
(DEFEAT, "defeat")
@ -103,12 +104,7 @@ struct end_level_data
void read(const config& cfg);
config to_config() const
{
config r;
write(r);
return r;
}
config to_config() const;
};
inline void throw_quit_game_exception()
{

View file

@ -19,7 +19,6 @@
#include "../widgets/generator.hpp"
#include "gui/widgets/pane.hpp"
class config;
#include "config.hpp" // needed for config::const_child_itors
namespace gui2

View file

@ -17,7 +17,6 @@
#include "gui/dialogs/dialog.hpp"
#include "config.hpp"
#include "game_initialization/create_engine.hpp"
namespace gui2

View file

@ -17,7 +17,7 @@
#include "gui/dialogs/dialog.hpp"
#include "config.hpp"
class config;
namespace gui2
{

View file

@ -16,7 +16,6 @@
#define GUI_DIALOGS_EDITOR_EDIT_SCENARIO_HPP_INCLUDED
#include "gui/dialogs/dialog.hpp"
#include "config.hpp"
namespace gui2
{

View file

@ -16,7 +16,6 @@
#define GUI_DIALOGS_EDITOR_EDIT_SIDE_HPP_INCLUDED
#include "gui/dialogs/dialog.hpp"
#include "config.hpp"
#include "team.hpp"
namespace gui2

View file

@ -16,7 +16,6 @@
#define GUI_DIALOGS_LOBBY_PLAYER_INFO_HPP_INCLUDED
#include "gui/dialogs/dialog.hpp"
#include "config.hpp"
#include "chat_events.hpp"
#include "gui/dialogs/lobby/lobby_info.hpp"

View file

@ -90,6 +90,8 @@ void show_unit_description(CVideo& video, const unit_type &t)
help::show_unit_help(video, t.id(), t.show_variations_in_help(), hide_help);
}
extern config dummy_cfg;
help_manager::help_manager(const config *cfg) //, gamemap *_map)
{
game_cfg = cfg == NULL ? &dummy_cfg : cfg;

View file

@ -32,7 +32,6 @@
#ifndef HELP_IMPL_INCLUDED
#define HELP_IMPL_INCLUDED
#include "config.hpp" // for config
#include "exceptions.hpp" // for error
#include "font.hpp" // for line_width, relative_size
@ -44,6 +43,7 @@
#include <boost/shared_ptr.hpp>
#include <SDL.h> // for SDL_Color, SDL_Surface
class config;
class unit_type;
class terrain_type_data;
typedef boost::shared_ptr<terrain_type_data> tdata_cache;
@ -322,7 +322,6 @@ extern int last_num_encountered_units;
extern int last_num_encountered_terrains;
extern bool last_debug_state;
extern config dummy_cfg;
extern std::vector<std::string> empty_string_vector;
extern const int max_section_level;
extern const int title_size;

View file

@ -16,6 +16,7 @@
#include "log.hpp"
#include "hotkey_item.hpp"
#include "hotkey_command.hpp"
#include "config.hpp"
#define GETTEXT_DOMAIN "wesnoth-lib"

View file

@ -16,7 +16,6 @@
#ifndef HOTKEY_ITEM_HPP_INCLUDED
#define HOTKEY_ITEM_HPP_INCLUDED
#include "config.hpp"
#include "SDL_events.h"
#include "SDL.h"
#include <boost/shared_ptr.hpp>
@ -26,6 +25,8 @@
#include "sdl/keyboard.hpp"
#endif
class config;
namespace hotkey {
/* forward declarations */

View file

@ -31,7 +31,8 @@
#include <boost/asio.hpp>
#include <boost/optional.hpp>
#include "exceptions.hpp"
#include "config.hpp"
class config;
namespace network_asio {

View file

@ -20,7 +20,6 @@
#ifndef REPLAY_H_INCLUDED
#define REPLAY_H_INCLUDED
#include "config.hpp"
#include "map_location.hpp"
#include <deque>
@ -31,6 +30,7 @@ class game_display;
class terrain_label;
class unit_map;
class play_controller;
class config;
struct time_of_day;
class chat_msg {

View file

@ -14,9 +14,9 @@
#ifndef REPLAY_HELPER_H_INCLUDED
#define REPLAY_HELPER_H_INCLUDED
#include "config.hpp"
#include <vector>
#include <string>
class config;
struct map_location;
struct time_of_day;

View file

@ -17,7 +17,6 @@
#include <cstddef>
#include <string>
#include "config.hpp" // forward declaration of the nested type config::attribute_value is not possible
#include "lua_types.hpp" // the luatype typedef
#include "unit_ptr.hpp"

View file

@ -18,7 +18,6 @@
#include "serialization/validator.hpp"
#include "tools/schema/tag.hpp"
#include "config.hpp"
#include "config_cache.hpp"
#include "serialization/parser.hpp"
@ -31,6 +30,8 @@
#include <string>
#include <stack>
class config;
/** @file
* One of the realizations of serialization/validator.hpp abstract validator.
*/

View file

@ -15,7 +15,7 @@
#ifndef SYNCED_CHECKUP_H_INCLUDED
#define SYNCED_CHECKUP_H_INCLUDED
#include "config.hpp"
class config;
struct map_location;
/**
A class to check whether the results that were calculated in the replay match the results calculated during the original game.

View file

@ -16,9 +16,11 @@
#include <map>
#include <exception>
#include "config.hpp"
#include "utils/boost_function_guarded.hpp"
class config;
class synced_command {
public:
/*