From b49129ad1ffd34608a1769663b7d4e914f8ef21d Mon Sep 17 00:00:00 2001 From: Gouvernathor <44340603+Gouvernathor@users.noreply.github.com> Date: Thu, 4 Apr 2024 22:36:46 +0200 Subject: [PATCH] Avoid evals and release name constraint Name resemblances between two variables should be for the developers' benefit only. If there is a link between data, it should be apparent. --- game/scripts/01cds.rpy | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/game/scripts/01cds.rpy b/game/scripts/01cds.rpy index 9abe731c..744fc6e9 100644 --- a/game/scripts/01cds.rpy +++ b/game/scripts/01cds.rpy @@ -81,24 +81,27 @@ python early hide: def execute(self): print(f"{self}") who, action = self - func = eval(f"{who}_chibi.{action}") + chibi = DollChibi.instance[who] + getattr(chibi, action) # print(f"Execution: {who} {action}") def lint(self): who, action = self - try: - chibi = eval(f"{who}_chibi") - except Exception: + + if who not in DollChibi.instances: renpy.error(f"Character chibi not defined: {who}") + + chibi = DollChibi.instances[who] + if not hasattr(chibi, action): renpy.error(f"Chibi action not defined: {who} {action}") def predict(self): who, action = self - chibi = eval(f"{who}_chibi") - doll = eval(f"{who}") + chibi = DollChibi.instances[who] + doll = getattr(store, who) layers = ( l[0] for pose in chibi.poses.keys()