From 010ad92b3b26ffc650a71ec7138e91801dafe422 Mon Sep 17 00:00:00 2001 From: cancel <cancel@cancel.fm> Date: Mon, 26 Nov 2018 13:47:54 +0900 Subject: [PATCH] Cleanup --- sim.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sim.c b/sim.c index 9ac1886..bb1f5c1 100644 --- a/sim.c +++ b/sim.c @@ -77,7 +77,8 @@ static inline void oper_move_relative_or_explode(Gbuffer gbuf, Mbuffer mbuf, #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,7 +209,10 @@ static void sim_phase_0(Gbuffer gbuf, Mbuffer mbuf, Usz height, Usz width) { 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) \ @@ -226,9 +230,12 @@ static void sim_phase_1(Gbuffer gbuf, Mbuffer mbuf, Usz height, Usz width) { 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: \