URL:
<http://gna.org/bugs/?12546>
Summary: WML variables not completely compatible with
standard mathematical operations
Project: Battle for Wesnoth
Submitted by: shadowmaster
Submitted on: Friday 10/31/2008 at 22:31
Category: Bug
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: 1.5.5+svn
Operating System: GNU/Linux
_______________________________________________________
Details:
The following code does not yield the same result:
++
{VARIABLE var3 100}
{VARIABLE_OP var3 multiply 0.5}
[message]
speaker=narrator
message="Float multiply: (STORED)100 * (MULTIPLY_OPERAND)0.5 =
$var3"
[/message]
{VARIABLE var3 0.5}
{VARIABLE_OP var3 multiply 100}
[message]
speaker=narrator
message="Float multiply: (STORED)0.5 * (MULTIPLY_OPERAND)100 =
$var3"
[/message]
--
On the first operation, var3 is set to 50, but on the second one, var3 is set
to 0. This means that WML variable operations such as multiply are not
commutative as one would expect from other programming languages. I suspect
that the second case uses some kind of cast from the stored "0.5" string into
an integer type, thus dropping the fractional component.
_______________________________________________________
Reply to this item at:
<http://gna.org/bugs/?12546>
_______________________________________________
Message sent via/by Gna!
http://gna.org/
_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs