Author: sapient
Date: Sun Apr  5 21:07:06 2009
New Revision: 34562

URL: http://svn.gna.org/viewcvs/wesnoth?rev=34562&view=rev
Log:
fix a bug with auto-stored WML variables not being restored correctly to their 
previous state afterwards (spotted by silene)

Modified:
    trunk/src/variable.cpp

Modified: trunk/src/variable.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/variable.cpp?rev=34562&r1=34561&r2=34562&view=diff
==============================================================================
--- trunk/src/variable.cpp (original)
+++ trunk/src/variable.cpp Sun Apr  5 21:07:06 2009
@@ -474,9 +474,8 @@
 
 void scoped_wml_variable::store(const config& var_value)
 {
-       // FIXME: this code isn't correct, as it concats all the children.
        foreach (const config &i, 
repos->get_variables().child_range(var_name_)) {
-               previous_val_.append(i);
+               previous_val_.add_child(var_name_, i);
        }
        repos->clear_variable_cfg(var_name_);
        repos->add_variable_cfg(var_name_, var_value);
@@ -488,7 +487,6 @@
 {
        if(activated_) {
                repos->clear_variable_cfg(var_name_);
-               // FIXME: this code isn't correct, as previous_val_ doesn't 
contain a var_name_ child.
                foreach (const config &i, previous_val_.child_range(var_name_)) 
{
                        repos->add_variable_cfg(var_name_, i);
                }


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

Reply via email to