Skip to content

Commit

Permalink
Avoid including team.hpp in diaplay.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Nov 30, 2016
1 parent cea61b6 commit 6465750
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 8 deletions.
15 changes: 15 additions & 0 deletions src/display.cpp
Expand Up @@ -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_);
Expand Down
13 changes: 5 additions & 8 deletions src/display.hpp
Expand Up @@ -39,6 +39,7 @@ class terrain_builder;
class map_labels;
class arrow;
class reports;
class team;

namespace halo {
class manager;
Expand All @@ -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"
Expand Down Expand Up @@ -94,7 +94,7 @@ class display : public filter_context, public video2::draw_layering
/** 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_; }
Expand Down Expand Up @@ -344,13 +344,10 @@ class display : public filter_context, public video2::draw_layering
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.
Expand Down
1 change: 1 addition & 0 deletions src/editor/action/mouse/mouse_action_unit.cpp
Expand Up @@ -24,6 +24,7 @@

#include "map/location.hpp"
#include "sdl/rect.hpp"
#include "team.hpp"
#include "units/unit.hpp"
#include "units/map.hpp"

Expand Down
1 change: 1 addition & 0 deletions src/editor/editor_display.cpp
Expand Up @@ -15,6 +15,7 @@

#include "editor/editor_display.hpp"
#include "reports.hpp"
#include "team.hpp"
#include "terrain/builder.hpp"
#include "units/map.hpp"

Expand Down
1 change: 1 addition & 0 deletions src/editor/palette/unit_palette.cpp
Expand Up @@ -22,6 +22,7 @@

#include "gettext.hpp"

#include "team.hpp"
#include "units/types.hpp"

namespace editor {
Expand Down
1 change: 1 addition & 0 deletions src/gui/dialogs/label_settings.cpp
Expand Up @@ -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
{
Expand Down

0 comments on commit 6465750

Please sign in to comment.