From b0406f48bbaff3cf6484d244d2607e33ab0d722e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Guilloux?= Date: Sun, 6 Oct 2024 17:43:49 +0200 Subject: [PATCH] Add: Basic range check for replace() (#324) --- nml/ast/replace.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nml/ast/replace.py b/nml/ast/replace.py index 833e1620..71c723f4 100644 --- a/nml/ast/replace.py +++ b/nml/ast/replace.py @@ -54,6 +54,14 @@ def __init__(self, param_list, sprite_list, name, pos): def pre_process(self): self.start_id = self.start_id.reduce(global_constants.const_list) + if isinstance(self.start_id, expression.ConstantNumeric): + generic.check_range( + self.start_id.value, + 0, + 4895 - len(self.sprite_list), + "replace-block parameter 1 'start'", + self.start_id.pos, + ) def debug_print(self, indentation): generic.print_dbg(indentation, "Replace sprites starting at")