mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-07 21:12:57 +00:00
Avoid division by or modulo of zero in test scenario's maths test (bug #25214)
This commit is contained in:
parent
15afec7202
commit
50146bc509
@ -2635,6 +2635,24 @@ For game purposes, the races group into factions; for example, orcs often cooper
|
|||||||
variable=divisor
|
variable=divisor
|
||||||
[/text_input]
|
[/text_input]
|
||||||
[/message]
|
[/message]
|
||||||
|
[if]
|
||||||
|
[variable]
|
||||||
|
name=divisor
|
||||||
|
equals=0
|
||||||
|
[/variable]
|
||||||
|
[or]
|
||||||
|
[variable]
|
||||||
|
name=divisor
|
||||||
|
equals=
|
||||||
|
[/variable]
|
||||||
|
[/or]
|
||||||
|
[then]
|
||||||
|
[message]
|
||||||
|
speaker=narrator
|
||||||
|
message="Cannot divide by zero!"
|
||||||
|
[/message]
|
||||||
|
[/then]
|
||||||
|
[else]
|
||||||
{VARIABLE total $number}
|
{VARIABLE total $number}
|
||||||
[set_variable]
|
[set_variable]
|
||||||
name=total
|
name=total
|
||||||
@ -2644,6 +2662,8 @@ For game purposes, the races group into factions; for example, orcs often cooper
|
|||||||
speaker=narrator
|
speaker=narrator
|
||||||
message="Dividing $number| by $divisor| results in $total|."
|
message="Dividing $number| by $divisor| results in $total|."
|
||||||
[/message]
|
[/message]
|
||||||
|
[/else]
|
||||||
|
[/if]
|
||||||
[/command]
|
[/command]
|
||||||
[/option]
|
[/option]
|
||||||
[option]
|
[option]
|
||||||
@ -2656,6 +2676,24 @@ For game purposes, the races group into factions; for example, orcs often cooper
|
|||||||
variable=modulo
|
variable=modulo
|
||||||
[/text_input]
|
[/text_input]
|
||||||
[/message]
|
[/message]
|
||||||
|
[if]
|
||||||
|
[variable]
|
||||||
|
name=modulo
|
||||||
|
equals=0
|
||||||
|
[/variable]
|
||||||
|
[or]
|
||||||
|
[variable]
|
||||||
|
name=modulo
|
||||||
|
equals=
|
||||||
|
[/variable]
|
||||||
|
[/or]
|
||||||
|
[then]
|
||||||
|
[message]
|
||||||
|
speaker=narrator
|
||||||
|
message="Cannot use modulus of zero!"
|
||||||
|
[/message]
|
||||||
|
[/then]
|
||||||
|
[else]
|
||||||
{VARIABLE total $number}
|
{VARIABLE total $number}
|
||||||
[set_variable]
|
[set_variable]
|
||||||
name=total
|
name=total
|
||||||
@ -2665,6 +2703,8 @@ For game purposes, the races group into factions; for example, orcs often cooper
|
|||||||
speaker=narrator
|
speaker=narrator
|
||||||
message="$number| % $modulo| = $total|."
|
message="$number| % $modulo| = $total|."
|
||||||
[/message]
|
[/message]
|
||||||
|
[/else]
|
||||||
|
[/if]
|
||||||
[/command]
|
[/command]
|
||||||
[/option]
|
[/option]
|
||||||
[option]
|
[option]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user