From: Holger Schemel Date: Wed, 15 Apr 2020 19:32:21 +0000 (+0200) Subject: added being able to use CE condition "CE value/score gets 0" X-Git-Tag: 4.2.0.0~51 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=93238afc02a67c4f96642ba56ae57a270bec7037;p=rocksndiamonds.git 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. --- 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);