Skip to content

Commit

Permalink
Fix: missing feature > scope conversion for random_action with vehicl…
Browse files Browse the repository at this point in the history
…e-offset. (OpenTTD#258)
  • Loading branch information
frosch123 authored Aug 13, 2022
1 parent 434327e commit a961adc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion nml/ast/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,9 @@ def __init__(self, param_list, choices, pos):
if len(self.type.params) == 0:
self.type_count = None
elif len(self.type.params) == 1:
self.type_count = action2var.reduce_varaction2_expr(self.type.params[0], feature)
# var_scope is really weird for type=BACKWARD/FORWARD.
var_scope = action2var.get_scope(feature, 0x89)
self.type_count = action2var.reduce_varaction2_expr(self.type.params[0], var_scope)
else:
raise generic.ScriptError(
"Value for random_switch parameter 2 'type' can have only one parameter.", self.type.pos
Expand Down

0 comments on commit a961adc

Please sign in to comment.