From 54e9505d2bf0e4ed245d06a4f8126e63401f6831 Mon Sep 17 00:00:00 2001 From: Martin Griffin Date: Tue, 13 May 2025 14:58:40 +0100 Subject: [PATCH] Warn on suspicious setvar usages --- asm/macros/event.inc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/asm/macros/event.inc b/asm/macros/event.inc index b8dedb7ffc..3356a8b98d 100644 --- a/asm/macros/event.inc +++ b/asm/macros/event.inc @@ -145,7 +145,10 @@ .endm @ Changes the value of destination to value. - .macro setvar destination:req, value:req + .macro setvar destination:req, value:req, warn=TRUE + .if \warn && ((\value >= VARS_START && \value <= VARS_END) || (\value >= SPECIAL_VARS_START && \value <= SPECIAL_VARS_END)) + .warning "setvar with a value that might be a VAR_ constant; did you mean copyvar instead?" + .endif .byte SCR_OP_SETVAR .2byte \destination .2byte \value