lifted parse_team_overlays from game_display to display.

This is part of makeing [item] and other overlays work in the editor.
This commit is contained in:
fendrin 2013-07-08 23:11:11 +02:00
parent 547a736346
commit 7614195710
4 changed files with 22 additions and 22 deletions

View file

@ -76,6 +76,22 @@ namespace {
int display::last_zoom_ = SmallZoom;
void display::parse_team_overlays()
{
const team& curr_team = (*teams_)[playing_team()];
const team& prev_team = (*teams_)[playing_team()-1 < teams_->size() ? playing_team()-1 : teams_->size()-1];
BOOST_FOREACH(const game_display::overlay_map::value_type i, overlays_) {
const overlay& ov = i.second;
if (!ov.team_name.empty() &&
((ov.team_name.find(curr_team.team_name()) + 1) != 0) !=
((ov.team_name.find(prev_team.team_name()) + 1) != 0))
{
invalidate(i.first);
}
}
}
void display::add_overlay(const map_location& loc, const std::string& img, const std::string& halo,const std::string& team_name, bool visible_under_fog)
{
const int halo_handle = halo::add(get_location_x(loc) + hex_size() / 2,

View file

@ -102,7 +102,7 @@ public:
* Allows a unit to request to be the only one drawn in its hex. Useful for situations where
* multiple units (one real, multiple temporary) can end up stacked, such as with the whiteboard.
* @param loc The location of the unit requesting exclusivity.
* @param unit The unit requesting exlusivity.
* @param unit The unit requesting exclusivity.
* @return false if there's already an exclusive draw request for this location.
*/
bool add_exclusive_draw(const map_location& loc, unit& unit);
@ -117,6 +117,11 @@ public:
const map_location& loc, size_t height, double filled,
const SDL_Color& col, fixed_t alpha);
/**
* Check the overlay_map for proper team-specific overlays to be
* displayed/hidden
*/
void parse_team_overlays();
/**
* Functions to add and remove overlays from locations.

View file

@ -789,20 +789,6 @@ void game_display::clear_attack_indicator()
void game_display::parse_team_overlays()
{
// const team& curr_team = (*teams_)[playing_team()];
// const team& prev_team = (*teams_)[playing_team()-1 < teams_->size() ? playing_team()-1 : teams_->size()-1];
// BOOST_FOREACH(const game_display::overlay_map::value_type i, overlays_) {
// const overlay& ov = i.second;
// if (!ov.team_name.empty() &&
// ((ov.team_name.find(curr_team.team_name()) + 1) != 0) !=
// ((ov.team_name.find(prev_team.team_name()) + 1) != 0))
// {
// invalidate(i.first);
// }
// }
}
std::string game_display::current_team_name() const
{

View file

@ -222,13 +222,6 @@ public:
attack_indicator_src_.get_relative_dir(attack_indicator_dst_));
}
/**
* Check the overlay_map for proper team-specific overlays to be
* displayed/hidden
*/
void parse_team_overlays();
// Functions used in the editor:
//void draw_terrain_palette(int x, int y, terrain_type::TERRAIN selected);