color_info helper method to assist the color_range=<string> change
This commit is contained in:
parent
89aeefae92
commit
2db07b0eb0
2 changed files with 15 additions and 0 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue