Removed ~RE() function
replaced it with a special case of ~RC(): ~RC(palette1=palette2)
This commit is contained in:
parent
3725d93f24
commit
27abdd0762
1 changed files with 17 additions and 19 deletions
|
@ -397,8 +397,8 @@ surface locator::load_image_sub_file() const
|
|||
}
|
||||
}
|
||||
|
||||
if("RC" == function){ // Re-color function
|
||||
std::vector<std::string> recolor=utils::split(field,'>');
|
||||
if("RC" == function){ // Re-color range/palette function
|
||||
std::vector<std::string> recolor=utils::split(field,'>'); // recolor palette to range
|
||||
if(recolor.size()>1){
|
||||
std::map<Uint32, Uint32> tmp_map;
|
||||
try {
|
||||
|
@ -411,24 +411,22 @@ surface locator::load_image_sub_file() const
|
|||
for(std::map<Uint32, Uint32>::const_iterator tmp = tmp_map.begin(); tmp!= tmp_map.end(); tmp++){
|
||||
recolor_map[tmp->first] = tmp->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if("RE" == function){ // Remap colors function - like RC, but works with palettes only, not color ranges
|
||||
std::vector<std::string> recolor = utils::split(field, '>');
|
||||
if(recolor.size() > 1) {
|
||||
std::map<Uint32, Uint32> tmp_map;
|
||||
try {
|
||||
std::vector<Uint32> const& old_palette = game_config::tc_info(recolor[0]);
|
||||
std::vector<Uint32> const& new_palette = game_config::tc_info(recolor[1]);
|
||||
for(size_t i = 0; i < old_palette.size() && i < new_palette.size(); ++i) {
|
||||
tmp_map[old_palette[i]] = new_palette[i];
|
||||
} else {
|
||||
std::vector<std::string> remap = utils::split(field,'='); // recolor palette to new palette
|
||||
if(remap.size() > 1) {
|
||||
std::map<Uint32, Uint32> tmp_map;
|
||||
try {
|
||||
std::vector<Uint32> const& old_palette = game_config::tc_info(remap[0]);
|
||||
std::vector<Uint32> const& new_palette = game_config::tc_info(remap[1]);
|
||||
for(size_t i = 0; i < old_palette.size() && i < new_palette.size(); ++i) {
|
||||
tmp_map[old_palette[i]] = new_palette[i];
|
||||
}
|
||||
} catch(config::error& e) {
|
||||
ERR_DP << "caught config::error... " << e.message << '\n';
|
||||
}
|
||||
for(std::map<Uint32, Uint32>::const_iterator tmp = tmp_map.begin(); tmp!= tmp_map.end(); tmp++){
|
||||
recolor_map[tmp->first] = tmp->second;
|
||||
}
|
||||
} catch(config::error& e) {
|
||||
ERR_DP << "caught config::error... " << e.message << '\n';
|
||||
}
|
||||
for(std::map<Uint32, Uint32>::const_iterator tmp = tmp_map.begin(); tmp!= tmp_map.end(); tmp++){
|
||||
recolor_map[tmp->first] = tmp->second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue