From a6fb7eaecac1356fd14e36affe8e81fc79a9d149 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Sun, 19 Dec 2021 18:48:06 -0500 Subject: [PATCH] Process mod in defines --- CHANGELOG.md | 1 + src/core/parseutil.cpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 582fbf51..3329236c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ The **"Breaking Changes"** listed below are changes that have been made in the d - New events will be placed in the center of the current view of the map. ### Fixed +- Fix % operator in C defines not being evaluated - Fix tileset palette editor crash that could occur when switching maps or tilesets with it open. - Loading wild encounters will now properly preserve the original order, so saving the file will not give huge diffs. diff --git a/src/core/parseutil.cpp b/src/core/parseutil.cpp index fad3c804..4302147b 100644 --- a/src/core/parseutil.cpp +++ b/src/core/parseutil.cpp @@ -130,6 +130,7 @@ QMap Token::precedenceMap = QMap( { {"*", 3}, {"/", 3}, + {"%", 3}, {"+", 4}, {"-", 4}, {"<<", 5}, @@ -194,6 +195,8 @@ int ParseUtil::evaluatePostfix(const QList &postfix) { result = op1 * op2; } else if (token.value == "/") { result = op1 / op2; + } else if (token.value == "%") { + result = op1 % op2; } else if (token.value == "+") { result = op1 + op2; } else if (token.value == "-") {