Removed ~RE() function

replaced it with a special case of ~RC(): ~RC(palette1=palette2)
This commit is contained in:
Ignacio R. Morelle 2008-09-05 21:48:21 +00:00
parent 3725d93f24
commit 27abdd0762

View file

@ -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;
}
}
}