From: Holger Schemel Date: Wed, 22 Jan 2020 17:04:51 +0000 (+0100) Subject: improved readability of some condition checks in EM engine X-Git-Tag: 4.2.0.0~180 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=0385fa0a637a585abe9f33824b0ba80424449df7;p=rocksndiamonds.git improved readability of some condition checks in EM engine --- diff --git a/src/game_em/synchro_2.c b/src/game_em/synchro_2.c index 830c13b3..68774735 100644 --- a/src/game_em/synchro_2.c +++ b/src/game_em/synchro_2.c @@ -4496,37 +4496,14 @@ static void Ldrip_fall(int x, int y) default: switch (RANDOM(8)) { - case 0: - temp = Xamoeba_1; - break; - - case 1: - temp = Xamoeba_2; - break; - - case 2: - temp = Xamoeba_3; - break; - - case 3: - temp = Xamoeba_4; - break; - - case 4: - temp = Xamoeba_5; - break; - - case 5: - temp = Xamoeba_6; - break; - - case 6: - temp = Xamoeba_7; - break; - - case 7: - temp = Xamoeba_8; - break; + case 0: temp = Xamoeba_1; break; + case 1: temp = Xamoeba_2; break; + case 2: temp = Xamoeba_3; break; + case 3: temp = Xamoeba_4; break; + case 4: temp = Xamoeba_5; break; + case 5: temp = Xamoeba_6; break; + case 6: temp = Xamoeba_7; break; + case 7: temp = Xamoeba_8; break; } Cave[y][x] = temp; @@ -4717,22 +4694,22 @@ static void Lexit(int x, int y) if (lev.required > 0) return; - int temp = RANDOM(64); - - if (temp < 21) - { - Cave[y][x] = Xexit_1; - Next[y][x] = Xexit_2; - } - else if (temp < 42) - { - Cave[y][x] = Xexit_2; - Next[y][x] = Xexit_3; - } - else + switch (RANDOM(64) / 21) { - Cave[y][x] = Xexit_3; - Next[y][x] = Xexit_1; + case 0: + Cave[y][x] = Xexit_1; + Next[y][x] = Xexit_2; + break; + + case 1: + Cave[y][x] = Xexit_2; + Next[y][x] = Xexit_3; + break; + + default: + Cave[y][x] = Xexit_3; + Next[y][x] = Xexit_1; + break; } play_element_sound(x, y, SOUND_exit_open, Xexit);