From 93238afc02a67c4f96642ba56ae57a270bec7037 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Wed, 15 Apr 2020 21:32:21 +0200 Subject: [PATCH] added being able to use CE condition "CE value/score gets 0" While the custom element check "CE value/score gets 0 of []" always worked fine, using the check "CE value/score gets 0" for the same element never worked, because this required a previous change action for changing the CE value or CE score in the same game frame, but CEs can only change once in one game frame. (And checking in the next game frame does not work either, because the CE value or score does not change in the next frame, so it cannot be checked for zero.) Resetting the CE's change counter after changing the CE value or score makes it possible to test for zero directly afterwards. --- src/game.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/game.c b/src/game.c index d5256fd4..a82ca079 100644 --- a/src/game.c +++ b/src/game.c @@ -10160,6 +10160,9 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) if (CustomValue[x][y] == 0) { + // reset change counter (else CE_VALUE_GETS_ZERO would not work) + ChangeCount[x][y] = 0; // allow at least one more change + CheckElementChange(x, y, element, EL_UNDEFINED, CE_VALUE_GETS_ZERO); CheckTriggeredElementChange(x, y, element, CE_VALUE_GETS_ZERO_OF_X); } @@ -10183,6 +10186,9 @@ static void ExecuteCustomElementAction(int x, int y, int element, int page) { int xx, yy; + // reset change counter (else CE_SCORE_GETS_ZERO would not work) + ChangeCount[x][y] = 0; // allow at least one more change + CheckElementChange(x, y, element, EL_UNDEFINED, CE_SCORE_GETS_ZERO); CheckTriggeredElementChange(x, y, element, CE_SCORE_GETS_ZERO_OF_X); -- 2.34.1