Skip to content

Commit

Permalink
fixup map label segfault in editor
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeck88 committed Jul 6, 2014
1 parent 7fec227 commit f63f133
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/map_label.cpp
Expand Up @@ -461,7 +461,7 @@ void terrain_label::draw()
return;
clear();

if ( !viewable() )
if ( !viewable(parent_->disp().get_disp_context()) )
return;

const map_location loc_nextx(loc_.x+1,loc_.y);
Expand Down Expand Up @@ -514,17 +514,17 @@ bool terrain_label::hidden() const
* creating a label. Conditions that can change during unit movement (disregarding
* potential WML events) should not be listed here; they belong in hidden().
*/
bool terrain_label::viewable() const
bool terrain_label::viewable(const display_context & dc) const
{
if ( !parent_->enabled() )
return false;

// In the editor, all labels are viewable.
if ( team::nteams() == 0 )
if ( dc.teams().empty() )
return true;

// Observers are not privvy to team labels.
const bool can_see_team_labels = !resources::gameboard->is_observer();
const bool can_see_team_labels = !dc.is_observer();

// Global labels are shown unless covered by a team label.
if ( team_name_.empty() )
Expand Down
3 changes: 2 additions & 1 deletion src/map_label.hpp
Expand Up @@ -22,6 +22,7 @@

class config;
class display;
class display_context;
//class team;
class terrain_label;

Expand Down Expand Up @@ -139,7 +140,7 @@ class terrain_label
void clear();
void draw();
bool hidden() const;
bool viewable() const;
bool viewable(const display_context & dc) const;
std::string cfg_color() const;

int handle_;
Expand Down

0 comments on commit f63f133

Please sign in to comment.