shithub: orca

Download patch

ref: 7c13d9065da184d91aec24d79e4e64289ef40d00
parent: 6d17e2e08394ca9f26ad050ec11e2ef954360f3c
author: cancel <cancel@cancel.fm>
date: Wed Nov 28 13:34:20 EST 2018

Clean up redundancy

--- a/sim.c
+++ b/sim.c
@@ -279,6 +279,10 @@
 MOVING_OPERATOR(west, 0, -1)
 MOVING_OPERATOR(southeast, 1, 1)
 
+#define MOVEMENT_CASES                                                         \
+  'N' : case 'n' : case 'E' : case 'e' : case 'S' : case 's' : case 'W'        \
+      : case 'w' : case 'Z' : case 'z'
+
 BEGIN_SOLO_PHASE_0(bang)
   BEGIN_HASTE
     BECOME('.');
@@ -315,17 +319,8 @@
   Glyph result;
   switch (g) {
   case '1':
-  case 'N':
-  case 'n':
-  case 'E':
-  case 'e':
-  case 'S':
-  case 's':
-  case 'W':
-  case 'w':
-  case 'Z':
-  case 'z':
   case '*':
+  case MOVEMENT_CASES:
     result = '*';
     break;
   default:
@@ -474,16 +469,7 @@
   {                                                                            \
     Glyph g = PEEK(_d_y, _d_x);                                                \
     switch (g) {                                                               \
-    case 'N':                                                                  \
-    case 'n':                                                                  \
-    case 'E':                                                                  \
-    case 'e':                                                                  \
-    case 'S':                                                                  \
-    case 's':                                                                  \
-    case 'W':                                                                  \
-    case 'w':                                                                  \
-    case 'Z':                                                                  \
-    case 'z':                                                                  \
+    case MOVEMENT_CASES:                                                       \
       POKE(_d_y, _d_x, _d_glyph);                                              \
       STUN(_d_y, _d_x);                                                        \
     }                                                                          \