mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-29 17:58:14 +00:00
Formula engine: fix comparison trying to cast everything to decimal
Now it only tries to cast to decimal if both are numbers.
This commit is contained in:
parent
b53ee994c9
commit
e78b5d7baf
@ -829,7 +829,10 @@ bool variant::operator!=(const variant& v) const
|
||||
bool variant::operator<=(const variant& v) const
|
||||
{
|
||||
if(type_ != v.type_) {
|
||||
if( type_ == TYPE_DECIMAL || v.type_ == TYPE_DECIMAL ) {
|
||||
if(type_ == TYPE_DECIMAL && v.type_ == TYPE_INT) {
|
||||
return as_decimal() <= v.as_decimal();
|
||||
}
|
||||
if(v.type_ == TYPE_DECIMAL && type_ == TYPE_INT) {
|
||||
return as_decimal() <= v.as_decimal();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user