ANL: research options – check if choosen option is a change

Don't consume MP if the same option was choosen.
Also removed unneccessary code by using 1.13 additions.
This commit is contained in:
Severin Glöckner 2019-06-12 04:53:02 +02:00
parent acc17f310c
commit 04d32e5d96

View file

@ -1,28 +1,39 @@
#textdomain wesnoth-anl
#define TARGET_RESEARCH_COMMAND TARGET_ID TARGET_NAME
[set_variable]
name=player_$side_number|.research.current_target
value={TARGET_ID}
[/set_variable]
[set_variable]
name=player_$side_number|.research.target_language_name
value={TARGET_NAME}
[/set_variable]
[if]
[variable]
name=player_$side_number|.research.current_target
not_equals={TARGET_ID}
[/variable]
# only consume points if it is changed
[then]
[set_variable]
name=player_$side_number|.research.current_target
value={TARGET_ID}
[/set_variable]
[set_variable]
name=player_$side_number|.research.target_language_name
value={TARGET_NAME}
[/set_variable]
[set_variable]
name=finished_options
value=yes
[/set_variable]
[set_variable]
name=unit.status.worked_this_turn
value=yes
[/set_variable]
[set_variable]
name=unit.moves
value=0
[/set_variable]
[set_variable]
name=unit.status.worked_this_turn
value=yes
[/set_variable]
[set_variable]
name=unit.moves
value=0
[/set_variable]
[unstore_unit]
variable=unit
find_vacant=no
[/unstore_unit]
[/then]
[/if]
[break][/break]
#enddef
#define RESEARCH_OPTIONS TYPES
@ -104,21 +115,8 @@
kill=no
variable=unit
[/store_unit]
[set_variable]
name=finished_options
value=no
[/set_variable]
[set_variable]
name=cancelled
value=no
[/set_variable]
[while]
[variable]
name=finished_options
boolean_equals=no
[/variable]
[true][/true]
[do]
[message]
@ -135,15 +133,7 @@ Our mines produce $player_$side_number|.mining.gold|g
[option]
label= _ "Continue as before"
[command]
[set_variable]
name=finished_options
value=yes
[/set_variable]
[set_variable]
name=cancelled
value=yes
[/set_variable]
[break][/break]
[/command]
[/option]
@ -171,7 +161,7 @@ Study Progress: $player_$side_number|.mining.progress|/$player_$side_number|.min
[/command]
[/option]
#Warfare
# Warfare
[option]
image = "wesnoth-icon.png~SCALE(72,72)"
@ -192,29 +182,6 @@ Study Progress: $player_$side_number|.warfare.progress|/$player_$side_number|.wa
[/message]
[/do]
[/while]
[if]
[variable]
name=cancelled
boolean_equals=no
[/variable]
[then]
[unstore_unit]
variable=unit
find_vacant=no
[/unstore_unit]
[/then]
[else]
#[allow_undo]
#[/allow_undo]
[/else]
[/if]
[clear_variable]
name=finished_options,cancelled
[/clear_variable]
[/command]
[/set_menu_item]
#enddef