Skip to content

Commit bda5e69

Browse files
committed
Always uses modern logic to look up character names.
Fixes renpy#2135.
1 parent 2d3427d commit bda5e69

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

renpy/ast.py

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -549,9 +549,6 @@ def say_menu_with(expression, callback):
549549
callback(what)
550550

551551

552-
fast_who_pattern = re.compile(r'[a-zA-Z_][a-zA-Z_0-9]*$')
553-
554-
555552
def eval_who(who, fast=None):
556553
"""
557554
Evaluates the `who` parameter to a say statement.
@@ -560,25 +557,21 @@ def eval_who(who, fast=None):
560557
if who is None:
561558
return None
562559

563-
if fast is None:
564-
fast = bool(fast_who_pattern.match(who))
565-
566-
if fast:
567-
568-
if 'store.character' in renpy.python.store_dicts:
569-
rv = renpy.python.store_dicts['store.character'].get(who, None)
570-
else:
571-
rv = None
572-
573-
if rv is None:
574-
rv = renpy.python.store_dicts['store'].get(who, None)
560+
if 'store.character' in renpy.python.store_dicts:
561+
rv = renpy.python.store_dicts['store.character'].get(who, None)
562+
else:
563+
rv = None
575564

576-
if rv is None:
577-
raise Exception("Sayer '%s' is not defined." % who.encode("utf-8"))
565+
if rv is None:
566+
rv = renpy.python.store_dicts['store'].get(who, None)
578567

568+
if rv is not None:
579569
return rv
580570

581-
return renpy.python.py_eval(who)
571+
try:
572+
return renpy.python.py_eval(who)
573+
except:
574+
raise Exception("Sayer '%s' is not defined." % who)
582575

583576

584577
class Say(Node):

0 commit comments

Comments
 (0)