I am trying to fix 6187.

There is a problem in that simple variable substitution seems to always
get done. This causes unexpected results when a $ is the first character of
a string and the simple substitution happens before the complex
substitution. (Which typically results in an empty string.)

My c++ isn't great but it looks like any reference like cfg["key"] will
call expand() and do simple substitution on the returned variable.
This even applies when the key is "value" in set_variable, which according
to the wiki, is not supposed to happen.

It seems like it would be better to call the complex substition function
interpolate_variables_into_string instead of expand and get that done
everywhere instead of all of the special case calls used now.

Another related issue is that with complex substitution there isn't a way
to get $ or | into the resulting string. It would be nice to define some
way to get those strings. For the | case, it would be sufficient to take out
the code that removes all of the extra |s. This (removing extra |s to simplify
things for WML coders) doesn't really seem all that useful of a feature. For
$s we could use a special character other than $ or | to get $ without much
trouble.

If it is too late to be doing these kinds of changes before 1.2, the
documentation could be changed to match what happens now.

_______________________________________________
Wesnoth-dev mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-dev

Reply via email to