Avoid including team.hpp in diaplay.hpp

This commit is contained in:
Charles Dang 2016-11-30 12:56:32 +11:00
parent cea61b61ca
commit 6465750cdf
6 changed files with 24 additions and 8 deletions

View file

@ -682,6 +682,21 @@ const display::rect_of_hexes display::hexes_under_rect(const SDL_Rect& r) const
return res;
}
bool display::team_valid() const
{
return currentTeam_ < dc_->teams().size();
}
bool display::shrouded(const map_location& loc) const
{
return is_blindfolded() || (dont_show_all_ && dc_->teams()[currentTeam_].shrouded(loc));
}
bool display::fogged(const map_location& loc) const
{
return is_blindfolded() || (dont_show_all_ && dc_->teams()[currentTeam_].fogged(loc));
}
int display::get_location_x(const map_location& loc) const
{
return static_cast<int>(map_area().x + (loc.x + theme_.border().size) * hex_width() - xpos_);

View file

@ -39,6 +39,7 @@ class terrain_builder;
class map_labels;
class arrow;
class reports;
class team;
namespace halo {
class manager;
@ -55,7 +56,6 @@ namespace wb {
#include "font/standard_colors.hpp"
#include "image.hpp" //only needed for enums (!)
#include "key.hpp"
#include "team.hpp"
#include "time_of_day.hpp"
#include "sdl/rect.hpp"
#include "theme.hpp"
@ -94,7 +94,7 @@ public:
/** The playing team is the team whose turn it is. */
size_t playing_team() const { return activeTeam_; }
bool team_valid() const { return currentTeam_ < dc_->teams().size(); }
bool team_valid() const;
/** The viewing team is the team currently viewing the game. */
size_t viewing_team() const { return currentTeam_; }
@ -344,13 +344,10 @@ public:
const rect_of_hexes get_visible_hexes() const {return hexes_under_rect(map_area());}
/** Returns true if location (x,y) is covered in shroud. */
bool shrouded(const map_location& loc) const {
return is_blindfolded() || (dont_show_all_ && dc_->teams()[currentTeam_].shrouded(loc));
}
bool shrouded(const map_location& loc) const;
/** Returns true if location (x,y) is covered in fog. */
bool fogged(const map_location& loc) const {
return is_blindfolded() || (dont_show_all_ && dc_->teams()[currentTeam_].fogged(loc));
}
bool fogged(const map_location& loc) const;
/**
* Determines whether a grid should be overlayed on the game board.

View file

@ -24,6 +24,7 @@
#include "map/location.hpp"
#include "sdl/rect.hpp"
#include "team.hpp"
#include "units/unit.hpp"
#include "units/map.hpp"

View file

@ -15,6 +15,7 @@
#include "editor/editor_display.hpp"
#include "reports.hpp"
#include "team.hpp"
#include "terrain/builder.hpp"
#include "units/map.hpp"

View file

@ -22,6 +22,7 @@
#include "gettext.hpp"
#include "team.hpp"
#include "units/types.hpp"
namespace editor {

View file

@ -33,6 +33,7 @@
#include "gui/widgets/toggle_button.hpp"
#include "gui/widgets/label.hpp"
#include "formula/string_utils.hpp"
#include "team.hpp"
namespace gui2
{