shithub: orca

Download patch

ref: 010ad92b3b26ffc650a71ec7138e91801dafe422
parent: 3fa44aeba878a812d8b5c7151a1b4da6aa99920b
author: cancel <cancel@cancel.fm>
date: Mon Nov 26 08:47:54 EST 2018

Cleanup

--- a/sim.c
+++ b/sim.c
@@ -77,7 +77,8 @@
 
 #define OPER_PHASE_N(_phase_number, _oper_name)                                \
   static inline void oper_phase##_phase_number##_##_oper_name(                 \
-      Gbuffer gbuffer, Mbuffer mbuffer, Usz height, Usz width, Usz y, Usz x) { \
+      Gbuffer const gbuffer, Mbuffer const mbuffer, Usz const height,          \
+      Usz const width, Usz y, Usz x) {                                         \
     (void)gbuffer;                                                             \
     (void)mbuffer;                                                             \
     (void)height;                                                              \
@@ -208,8 +209,11 @@
     Glyph* glyph_row = gbuf + iy * width;
     for (Usz ix = 0; ix < width; ++ix) {
       Glyph c = glyph_row[ix];
-      if (mbuffer_peek(mbuf, height, width, iy, ix) & Mark_flag_sleep)
+      if (c == '.')
         continue;
+      if (mbuffer_peek(mbuf, height, width, iy, ix) &
+          (Mark_flag_lock | Mark_flag_sleep))
+        continue;
       switch (c) {
 #define X(_oper_name, _oper_char)                                              \
   case _oper_char:                                                             \
@@ -226,9 +230,12 @@
   for (Usz iy = 0; iy < height; ++iy) {
     Glyph* glyph_row = gbuf + iy * width;
     for (Usz ix = 0; ix < width; ++ix) {
-      if (mbuffer_peek(mbuf, height, width, iy, ix) & Mark_flag_sleep)
-        continue;
       Glyph c = glyph_row[ix];
+      if (c == '.')
+        continue;
+      if (mbuffer_peek(mbuf, height, width, iy, ix) &
+          (Mark_flag_lock | Mark_flag_sleep))
+        continue;
       switch (c) {
 #define X(_oper_name, _oper_char)                                              \
   case _oper_char:                                                             \