Print info loglevel debug info when registering color ranges and palettes

This commit is contained in:
Ignacio R. Morelle 2015-05-30 06:38:58 -03:00
parent 9d816006ef
commit 21f8c58aeb
3 changed files with 24 additions and 0 deletions

View File

@ -184,3 +184,19 @@ int color_range::index() const
}
return 0;
}
std::string color_range::debug() const
{
std::ostringstream o;
static const Uint32 mask = 0x00FFFFFF;
o << std::hex << std::setfill('0')
<< '{' << std::setw(6) << (mid_ & mask)
<< ',' << std::setw(6) << (max_ & mask)
<< ',' << std::setw(6) << (min_ & mask)
<< ',' << std::setw(6) << (rep_ & mask)
<< '}';
return o.str();
}

View File

@ -102,6 +102,9 @@ public:
int index() const; // the default team index for this color, or 0 for none
/** Return a string describing the color range for debug output. */
std::string debug() const;
private:
Uint32 mid_ , max_ , min_ , rep_;
};

View File

@ -31,6 +31,7 @@
static lg::log_domain log_engine("engine");
#define DBG_NG LOG_STREAM(debug, log_engine)
#define LOG_NG LOG_STREAM(info, log_engine)
#define ERR_NG LOG_STREAM(err, log_engine)
namespace game_config
@ -335,6 +336,9 @@ namespace game_config
}
team_rgb_range.insert(std::make_pair(id,color_range(temp)));
team_rgb_name[id] = teamC["name"];
LOG_NG << "registered color range '" << id << "': " << team_rgb_range[id].debug() << '\n';
//generate palette of same name;
std::vector<Uint32> tp = palette(team_rgb_range[id]);
if (tp.empty()) {
@ -352,6 +356,7 @@ namespace game_config
ERR_NG << "Invalid color palette: " << rgb.second << std::endl;
}
team_rgb_colors.insert(std::make_pair(rgb.first, temp));
LOG_NG << "registered color palette: " << rgb.first << '\n';
}
}
}