color_info helper method to assist the color_range=<string> change

This commit is contained in:
Patrick Parker 2007-07-27 03:39:05 +00:00
parent 89aeefae92
commit 2db07b0eb0
2 changed files with 15 additions and 0 deletions

View file

@ -234,6 +234,20 @@ namespace game_config
}
}
const color_range& color_info(const std::string& name)
{
std::map<std::string, color_range>::const_iterator i = team_rgb_range.find(name);
if(i == team_rgb_range.end()) {
try {
team_rgb_range.insert(std::make_pair(name,color_range(string2rgb(name))));
return color_info(name);
} catch(bad_lexical_cast&) {
throw config::error(_("Invalid color range: ") + name);
}
}
return i->second;
}
const std::vector<Uint32>& tc_info(const std::string& name)
{
std::map<std::string, std::vector<Uint32> >::const_iterator i = team_rgb_colors.find(name);

View file

@ -76,6 +76,7 @@ namespace game_config
const void add_color_info(const config& v);
const std::vector<Uint32>& tc_info(const std::string& name);
const color_range& color_info(const std::string& name);
struct game_version {
game_version(std::string str);