Skip to content

Commit

Permalink
fixup includes in headers, started as just config, but led to more
Browse files Browse the repository at this point in the history
The changes in config required changes in ai/contexts which
cascaded, also many places were throwing game::game_error without
including its definition except from config.
  • Loading branch information
cbeck88 committed Jun 25, 2014
1 parent 2a703f3 commit 399ec11
Show file tree
Hide file tree
Showing 11 changed files with 97 additions and 57 deletions.
72 changes: 47 additions & 25 deletions src/ai/contexts.cpp
Expand Up @@ -18,31 +18,53 @@
* @file
*/

#include "actions.hpp"
#include "contexts.hpp"
#include "manager.hpp"

#include "composite/aspect.hpp"
#include "composite/engine.hpp"
#include "composite/goal.hpp"

#include "default/ai.hpp"

#include "../actions/attack.hpp"
#include "../formula.hpp"
#include "../formula_function.hpp"
#include "../formula_fwd.hpp"
#include "../game_board.hpp"
#include "../game_display.hpp"
#include "../log.hpp"
#include "../map.hpp"
#include "../mouse_handler_base.hpp"
#include "../recall_list_manager.hpp"
#include "../resources.hpp"
#include "../tod_manager.hpp"
#include "../unit.hpp"

#include <boost/foreach.hpp>
#include "ai/contexts.hpp"

#include "global.hpp"

#include "actions/attack.hpp"

#include "ai/actions.hpp" // for actions
#include "ai/composite/aspect.hpp" // for typesafe_aspect, aspect, etc
#include "ai/composite/engine.hpp" // for engine, engine_factory, etc
#include "ai/composite/goal.hpp" // for goal
#include "ai/composite/stage.hpp" // for ministage
#include "ai/game_info.hpp" // for aspect_type<>::typesafe_ptr, etc
#include "ai/lua/unit_advancements_aspect.hpp"
#include "ai/manager.hpp" // for manager

#include "chat_events.hpp" // for chat_handler, etc
#include "config.hpp" // for config, etc
#include "game_board.hpp" // for game_board
#include "game_config.hpp" // for debug
#include "game_display.hpp" // for game_display
#include "game_errors.hpp" // for throw
#include "log.hpp" // for LOG_STREAM, logger, etc
#include "map.hpp" // for gamemap
#include "pathfind/pathfind.hpp" // for paths::dest_vect, paths, etc
#include "recall_list_manager.hpp" // for recall_list_manager
#include "resources.hpp" // for units, gameboard, etc
#include "serialization/string_utils.hpp" // for split, etc
#include "team.hpp" // for team
#include "terrain_filter.hpp" // for terrain_filter
#include "terrain_translation.hpp" // for t_terrain
#include "time_of_day.hpp" // for time_of_day
#include "tod_manager.hpp" // for tod_manager
#include "unit.hpp" // for unit, intrusive_ptr_release, etc
#include "unit_map.hpp" // for unit_map::iterator_base, etc
#include "unit_ptr.hpp" // for UnitPtr
#include "unit_types.hpp" // for attack_type, unit_type, etc
#include "variant.hpp" // for variant

#include <algorithm> // for find, count, max
#include <boost/foreach.hpp> // for auto_any_base, etc
#include <boost/smart_ptr/intrusive_ptr.hpp> // for intrusive_ptr
#include <boost/smart_ptr/shared_ptr.hpp> // for dynamic_pointer_cast, etc
#include <cmath> // for sqrt
#include <cstdlib> // for NULL, abs
#include <ctime> // for time
#include <iterator> // for back_inserter
#include <ostream> // for operator<<, basic_ostream, etc

static lg::log_domain log_ai("ai/general");
#define DBG_AI LOG_STREAM(debug, log_ai)
Expand Down
49 changes: 29 additions & 20 deletions src/ai/contexts.hpp
Expand Up @@ -21,35 +21,44 @@
#ifndef AI_CONTEXTS_HPP_INCLUDED
#define AI_CONTEXTS_HPP_INCLUDED

#include "game_info.hpp"
#include "../generic_event.hpp"
#include "../config.hpp"
#include "lua/unit_advancements_aspect.hpp"
#include "../unit_ptr.hpp"

//#include "../unit.hpp"
#include "ai/game_info.hpp" // for move_map, aspect_type, etc

#include "global.hpp"

#include "../config.hpp" // for config
#include "../game_errors.hpp"
#include "../generic_event.hpp" // for observer
#include "../unit_ptr.hpp" // for UnitPtr
#include "../map_location.hpp" // for map_location

#include <map> // for map, map<>::value_compare
#include <set> // for set
#include <string> // for string
#include <utility> // for pair
#include <vector> // for vector

class gamemap; // lines 41-41
class team;
class terrain_filter; // lines 43-43
class unit_map;
class unit_type; // lines 46-46
class variant; // lines 42-42
namespace ai { class ai_context; } // lines 51-51
namespace ai { class ministage; }
namespace ai { class unit_advancements_aspect; }
namespace ai { template <typename T> class typesafe_aspect; }
namespace boost { template <class T> class shared_ptr; }
namespace pathfind { struct paths; }
struct battle_context_unit_stats; // lines 39-39

#ifdef _MSC_VER
#pragma warning(push)
//silence "inherits via dominance" warnings
#pragma warning(disable:4250)
#endif

class battle_context;
struct battle_context_unit_stats;
class game_display;
class gamemap;
class variant;
class terrain_filter;
class terrain_translation;
class unit;
class unit_type;

namespace ai {

class interface;
class ai_context;

typedef ai_context* ai_context_ptr;


Expand Down
1 change: 1 addition & 0 deletions src/ai/recruitment/recruitment.hpp
Expand Up @@ -23,6 +23,7 @@

#include "../composite/rca.hpp"
#include "../../unit.hpp"
#include "../../unit_map.hpp"

#include <boost/foreach.hpp>
#include <boost/optional.hpp>
Expand Down
10 changes: 7 additions & 3 deletions src/config.cpp
Expand Up @@ -18,20 +18,24 @@
* Routines related to configuration-files / WML.
*/

#include "config.hpp"

#include "global.hpp"

#include "config.hpp"
#include "log.hpp"
#include "serialization/string_utils.hpp"
#include "util.hpp"
#include "utils/const_clone.tpp"

#include <cstdlib>
#include <cstring>
#include <deque>
#include <istream>

#include <boost/foreach.hpp>
#include <boost/variant.hpp>
#include <boost/variant/apply_visitor.hpp>
#include <boost/variant/get.hpp>
#include <boost/variant/static_visitor.hpp>
#include <boost/variant/variant.hpp>

static lg::log_domain log_config("config");
#define ERR_CF LOG_STREAM(err, log_config)
Expand Down
15 changes: 7 additions & 8 deletions src/config.hpp
Expand Up @@ -30,23 +30,22 @@

#include "global.hpp"

#include <map>
#include <ctime>
#include <iosfwd>
#include <iterator>
#include <map>
#include <string>
#include <utility>
#include <vector>

#include <boost/blank.hpp>
#include <boost/exception/exception.hpp>
#include <boost/variant/apply_visitor.hpp>
#include <boost/variant/get.hpp>
#include <boost/variant/static_visitor.hpp>
#include <boost/variant/variant.hpp>

#include "game_errors.hpp"
#include "exceptions.hpp"
#include "tstring.hpp"

class config;
struct tconfig_implementation;
class vconfig;
struct lua_State;

bool operator==(const config &, const config &);
inline bool operator!=(const config &a, const config &b) { return !operator==(a, b); }
Expand Down
1 change: 1 addition & 0 deletions src/game_events/action_wml.cpp
Expand Up @@ -34,6 +34,7 @@
#include "../fake_unit_ptr.hpp"
#include "../game_classification.hpp"
#include "../game_display.hpp"
#include "../game_errors.hpp"
#include "../game_preferences.hpp"
#include "../gettext.hpp"
#include "../gui/dialogs/gamestate_inspector.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/image_modifications.hpp
Expand Up @@ -17,6 +17,7 @@
#ifndef IMAGE_MODIFICATIONS_HPP_INCLUDED
#define IMAGE_MODIFICATIONS_HPP_INCLUDED

#include "lua_jailbreak_exception.hpp"
#include "sdl/utils.hpp"
#include <queue>

Expand Down
1 change: 1 addition & 0 deletions src/playcampaign.cpp
Expand Up @@ -23,6 +23,7 @@
#include "playcampaign.hpp"

#include "carryover.hpp"
#include "game_errors.hpp"
#include "game_preferences.hpp"
#include "generators/map_create.hpp"
#include "gui/dialogs/message.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/preferences_display.cpp
Expand Up @@ -168,7 +168,7 @@ bool set_resolution(CVideo& video
{
SDL_Rect rect;
SDL_GetClipRect(video.getSurface(), &rect);
if(rect.w == width && rect.h == height) {
if(static_cast<unsigned int> (rect.w) == width && static_cast<unsigned int>(rect.h) == height) {
return true;
}

Expand Down
1 change: 1 addition & 0 deletions src/replay_controller.cpp
Expand Up @@ -20,6 +20,7 @@
#include "carryover.hpp"
#include "actions/vision.hpp"
#include "game_end_exceptions.hpp"
#include "game_errors.hpp" //needed to be thrown
#include "game_events/handlers.hpp"
#include "gettext.hpp"
#include "log.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/unit_types.cpp
Expand Up @@ -22,6 +22,7 @@
#include "unit_types.hpp"

#include "game_config.hpp"
#include "game_errors.hpp" //thrown sometimes
//#include "gettext.hpp"
#include "loadscreen.hpp"
#include "log.hpp"
Expand Down

0 comments on commit 399ec11

Please sign in to comment.