mail[Wesnoth-commits] r20193 - in /trunk: changelog src/game_events.cpp src/variable.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by patrick_X99 on September 08, 2007 - 07:57:
Author: sapient
Date: Sat Sep  8 07:57:06 2007
New Revision: 20193

URL: http://svn.gna.org/viewcvs/wesnoth?rev=20193&view=rev
Log:
fix a bug with array.length side-effects causing empty arrays to increase to 
size 1

Modified:
    trunk/changelog
    trunk/src/game_events.cpp
    trunk/src/variable.cpp

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=20193&r1=20192&r2=20193&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Sat Sep  8 07:57:06 2007
@@ -2,7 +2,8 @@
  * campaigns:
    * Northern Rebirth
      * Colored portraits for Sisal and Rakshas
-     * Fixed bug in 'Old Friend' where Tallin looses bonus HP, MP and 
experience gained from the Rod of Justice
+     * Fixed bug in 'Old Friend' where Tallin looses bonus HP, MP and
+       experience gained from the Rod of Justice
    * Son of the Black Eye
      * Fixed bug in 'Saving Inarix' where the blown up bridge wasn't shown
        properly (bug #9817)
@@ -46,6 +47,8 @@
    * a minus sign in front of a cardinal direction now reverses it ("-s"="n")
    * now radius expansion is handled last in Standard Location Filters;
      previously it was handled last except before [and], [or], and [not]
+   * fix a bug with array.length side-effects causing empty arrays to 
increase
+     to size 1
  * miscellaneous and bug fixes:
    * various bug fixes and code cleanups
    * in help, the encountered units list is now correctly updated when using

Modified: trunk/src/game_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_events.cpp?rev=20193&r1=20192&r2=20193&view=diff
==============================================================================
--- trunk/src/game_events.cpp (original)
+++ trunk/src/game_events.cpp Sat Sep  8 07:57:06 2007
@@ -207,7 +207,7 @@
 
                const std::string name = values["name"];
                wassert(state_of_game != NULL);
-               const std::string& value = state_of_game->get_variable(name);
+               const std::string& value = 
state_of_game->get_variable_const(name);
 
                const double num_value = atof(value.c_str());
 

Modified: trunk/src/variable.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/variable.cpp?rev=20193&r1=20192&r2=20193&view=diff
==============================================================================
--- trunk/src/variable.cpp (original)
+++ trunk/src/variable.cpp Sat Sep  8 07:57:06 2007
@@ -243,8 +243,10 @@
                if(size <= inner_index) {
                        if(force_valid) {
                                // Add elements to the array until the 
requested size is attained
-                               for(; size <= inner_index; ++size) {
-                                       vars->add_child(element);
+                               if(inner_explicit_index || key != "length") {
+                                       for(; size <= inner_index; ++size) {
+                                               vars->add_child(element);
+                                       }
                                }
                        } else if(inner_explicit_index) {
                                WRN_NG << "variable_info: invalid WML array 
index, "




Related Messages


Powered by MHonArc, Updated Sat Sep 08 10:00:26 2007