URL:
<http://gna.org/bugs/?13734>
Summary: phantom containers in auto-stored unit variables
Project: Battle for Wesnoth
Submitted by: ken_oh
Submitted on: Saturday 06/20/2009 at 17:24
Category: Bug
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: WML
Status: None
Privacy: Public
Assigned to: None
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 1.6.2/1.7.0
Operating System: WinXP/OSX
_______________________________________________________
Details:
When units are auto-stored for events, containers in previously stored units
in the same variable can stay. What is even stranger is that these phantom
containers are always sub-containers. This effects any statements that relay
on variable.length.
Enter the below code into a scenario.
[code][event]
name=start
{GENERIC_UNIT 1 "Ancient Lich" 9 12}
{GENERIC_UNIT 2 "Goblin Spearman" 10 11}
{GENERIC_UNIT 2 "Goblin Spearman" 10 12}
[store_unit]
[filter]
x,y=10,11
[/filter]
variable=sup
[/store_unit]
{VARIABLE sup.one.two.three.four.five "wassup"}
[unstore_unit]
variable=sup
[/unstore_unit]
[store_unit]
[filter]
x,y=9,12
[/filter]
variable=the_lich
[/store_unit]
{VARIABLE the_lich.attacks_left "2"}
[unstore_unit]
variable=the_lich
[/unstore_unit]
[/event]
[event]
name=attack
first_time_only=no
{DEBUG_MSG "
second_unit.one.length $second_unit.one.length
second_unit.one.two.length $second_unit.one.two.length
second_unit.one.two.three.length $second_unit.one.two.three.length
second_unit.one.two.three.four.length
$second_unit.one.two.three.four.length"}
[set_variables]
name=dead_unit
mode=replace
to_variable=unit
[/set_variables]
[/event][/code]
Kill the north goblin and you get the expected result:
http://files.getdropbox.com/u/776904/expected.jpg
However, kill the south goblin, which has no such variables, -after- killing
the north one and you get something quite unexpected:
http://files.getdropbox.com/u/776904/unexpected.jpg
How can unit.one.length be 0 but unit.one.two.length be 1?
This works for other types of events. Substitute the attack event with this
die event and the results are the same.
[code][event]
name=die
first_time_only=no
{DEBUG_MSG "
unit.one.length $unit.one.length
unit.one.two.length $unit.one.two.length
unit.one.two.three.length $unit.one.two.three.length
unit.one.two.three.four.length $unit.one.two.three.four.length"}
[set_variables]
name=dead_unit
mode=replace
to_variable=unit
[/set_variables]
[/event][/code]
As you can see in the code, I tried to store the unit variables to dead_unit.
The result from a save file shows no indication of phantom variables (though,
no idea how that would even be represented).
_______________________________________________________
Reply to this item at:
<http://gna.org/bugs/?13734>
_______________________________________________
Message sent via/by Gna!
http://gna.org/
_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs