fix a bug with array.length side-effects causing empty arrays to increase to size 1

This commit is contained in:
Patrick Parker 2007-09-08 05:57:06 +00:00
parent 66afaefd19
commit 093439695c
3 changed files with 9 additions and 4 deletions

View file

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

View file

@ -207,7 +207,7 @@ bool internal_conditional_passed(const unit_map* units,
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());

View file

@ -243,8 +243,10 @@ variable_info::variable_info(const std::string& varname, bool force_valid, TYPE
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, "