Skip to content

Commit

Permalink
Don't save [label] colors with alpha
Browse files Browse the repository at this point in the history
This cases from_rgb_string to trow an exception. Additionally, since the user cannot customize label alpha, it doesn't
make sense for its color to save it.
  • Loading branch information
Vultraz committed Dec 3, 2016
1 parent 255dd6b commit ae156cb
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
13 changes: 1 addition & 12 deletions src/map/label.cpp
Expand Up @@ -409,7 +409,7 @@ void terrain_label::write(config& cfg) const
cfg["text"] = text();
cfg["tooltip"] = tooltip();
cfg["team_name"] = (this->team_name());
cfg["color"] = cfg_color();
cfg["color"] = color_.to_rgb_string();
cfg["visible_in_fog"] = visible_in_fog_;
cfg["visible_in_shroud"] = visible_in_shroud_;
cfg["immutable"] = immutable_;
Expand Down Expand Up @@ -467,17 +467,6 @@ const color_t& terrain_label::color() const
return color_;
}

std::string terrain_label::cfg_color() const
{
std::stringstream buf;
const unsigned int red = static_cast<unsigned int>(color_.r);
const unsigned int green = static_cast<unsigned int>(color_.g);
const unsigned int blue = static_cast<unsigned int>(color_.b);
const unsigned int alpha = static_cast<unsigned int>(color_.a);
buf << red << "," << green << "," << blue << "," << alpha;
return buf.str();
}

void terrain_label::set_text(const t_string& text)
{
text_ = text;
Expand Down
1 change: 0 additions & 1 deletion src/map/label.hpp
Expand Up @@ -165,7 +165,6 @@ class terrain_label
void draw();
bool hidden() const;
bool viewable(const display_context & dc) const;
std::string cfg_color() const;

int handle_;
int tooltip_handle_;
Expand Down

0 comments on commit ae156cb

Please sign in to comment.