Author: shadowmaster
Date: Sun Mar 22 01:16:38 2009
New Revision: 34008
URL: http://svn.gna.org/viewcvs/wesnoth?rev=34008&view=rev
Log:
The ~RC() image functor does not accept the special palette switch
~RC(palette1=palette2) syntax anymore. ~PAL(palette1>palette2)
should be used instead.
No idea what I was drinking when I decided to use ~RC(palette1=palette2)
instead of introducing a new functor (most likely I was thinking of the
overhead of the string comparison, but it's been reduced a lot since
then).
A wmllint test is missing, as well as backwards compatibility code. I
assume that this feature hasn't been used at all anyway.
Modified:
trunk/changelog
trunk/data/scenario-test.cfg
trunk/src/image.cpp
Modified: trunk/changelog
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=34008&r1=34007&r2=34008&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Sun Mar 22 01:16:38 2009
@@ -1,4 +1,8 @@
Version 1.7.0-svn:
+ * Graphics:
+ * The ~RC() image functor does not accept the special palette switch
+ ~RC(palette1=palette2) syntax anymore. ~PAL(palette1>palette2) should
+ be used instead
* Language and i18n:
* updated translations: German, Finnish, Hebrew, Italian, Turkish
* FormulaAI:
Modified: trunk/data/scenario-test.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/scenario-test.cfg?rev=34008&r1=34007&r2=34008&view=diff
==============================================================================
--- trunk/data/scenario-test.cfg (original)
+++ trunk/data/scenario-test.cfg Sun Mar 22 01:16:38 2009
@@ -94,7 +94,7 @@
id=hairdo
[effect]
apply_to=image_mod
-
add="RC(FFDC02,EA9752,C4793A,C35029,6B2C29,A34C29,D5561F,343424,353624,BF5746=BCBCBC,7D7D7D,5E5E5E,434343,232323,3B3B3B,494949,232323,232323,484848)"
+
add="PAL(FFDC02,EA9752,C4793A,C35029,6B2C29,A34C29,D5561F,343424,353624,BF5746
> BCBCBC,7D7D7D,5E5E5E,434343,232323,3B3B3B,494949,232323,232323,484848)"
[/effect]
[/trait]
[/modifications]
Modified: trunk/src/image.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/image.cpp?rev=34008&r1=34007&r2=34008&view=diff
==============================================================================
--- trunk/src/image.cpp (original)
+++ trunk/src/image.cpp Sun Mar 22 01:16:38 2009
@@ -468,35 +468,39 @@
}
}
else {
- //
- // try to recolor source
palette to target palette (palette switch)
- //
- const std::vector<std::string>
remap_params = utils::split(field,'=');
- if(remap_params.size() > 1) {
- std::map<Uint32,
Uint32> tmp_map;
- try {
-
std::vector<Uint32> const& old_palette =
-
game_config::tc_info(remap_params[0]);
-
std::vector<Uint32> const& new_palette =
-
game_config::tc_info(remap_params[1]);
-
- for(size_t i =
0; i < old_palette.size() && i < new_palette.size(); ++i) {
-
tmp_map[old_palette[i]] = new_palette[i];
- }
+ // Deprecated 1.6 palette
switch syntax
+ if(field.find('=') !=
std::string::npos) {
+ lg::wml_error << "the
~RC() image function cannot be used for palette switch (A=B) in 1.7.x; use
~PAL(A>B) instead\n";
+ }
+ }
+ }
+ // Palette switch (PAL)
+ else if("PAL" == function) {
+ const std::vector<std::string>
remap_params = utils::split(field,'>');
+ if(remap_params.size() > 1) {
+ std::map<Uint32, Uint32>
tmp_map;
+ try {
+ std::vector<Uint32>
const& old_palette =
+
game_config::tc_info(remap_params[0]);
+ std::vector<Uint32>
const& new_palette =
+
game_config::tc_info(remap_params[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 while processing palette switch RC: "
- <<
e.message
- << '\n';
- ERR_DP
- <<
"bailing out from RC\n";
- tmp_map.clear();
- }
-
- foreach(const
rc_entry_type& rc_entry, tmp_map) {
-
rc.map()[rc_entry.first] = rc_entry.second;
- }
+ }
+ catch(config::error& e) {
+ ERR_DP
+ << "caught
config::error while processing PAL function: "
+ << e.message
+ << '\n';
+ ERR_DP
+ << "bailing out
from PAL\n";
+ tmp_map.clear();
+ }
+
+ foreach(const rc_entry_type&
rc_entry, tmp_map) {
+
rc.map()[rc_entry.first] = rc_entry.second;
}
}
}
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits