From cb574aadcc2bdd1c445cfba57610c640573c283c Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sun, 3 Jan 2016 00:36:36 +0200 Subject: [PATCH] Split wallification into two by function --- include/extern.h | 1 + src/mkmaze.c | 38 +++++++++++++++++++++++++++----------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/include/extern.h b/include/extern.h index c25c634b6..3bba9fe1d 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1190,6 +1190,7 @@ E void FDECL(remove_rooms, (int, int, int, int)); /* ### mkmaze.c ### */ E void FDECL(wallification, (int, int, int, int)); +E void FDECL(fix_wall_spines, (int, int, int, int)); E void FDECL(walkfrom, (int, int, SCHAR_P)); E void FDECL(makemaz, (const char *)); E void FDECL(mazexy, (coord *)); diff --git a/src/mkmaze.c b/src/mkmaze.c index eddf6fbd1..100b0b525 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -135,17 +135,6 @@ int x1, y1, x2, y2; uchar type; register int x, y; struct rm *lev; - int bits; - int locale[3][3]; /* rock or wall status surrounding positions */ - /* - * Value 0 represents a free-standing wall. It could be anything, - * so even though this table says VWALL, we actually leave whatever - * typ was there alone. - */ - static xchar spine_array[16] = { VWALL, HWALL, HWALL, HWALL, - VWALL, TRCORNER, TLCORNER, TDWALL, - VWALL, BRCORNER, BLCORNER, TUWALL, - VWALL, TLWALL, TRWALL, CROSSWALL }; /* sanity check on incoming variables */ if (x1 < 0 || x2 >= COLNO || x1 > x2 || y1 < 0 || y2 >= ROWNO || y1 > y2) @@ -165,6 +154,33 @@ int x1, y1, x2, y2; } } + fix_wall_spines(x1,y1,x2,y2); +} + +void +fix_wall_spines(x1, y1, x2, y2) +int x1, y1, x2, y2; +{ + uchar type; + register int x,y; + struct rm *lev; + int bits; + int locale[3][3]; /* rock or wall status surrounding positions */ + + /* + * Value 0 represents a free-standing wall. It could be anything, + * so even though this table says VWALL, we actually leave whatever + * typ was there alone. + */ + static xchar spine_array[16] = { VWALL, HWALL, HWALL, HWALL, + VWALL, TRCORNER, TLCORNER, TDWALL, + VWALL, BRCORNER, BLCORNER, TUWALL, + VWALL, TLWALL, TRWALL, CROSSWALL }; + + /* sanity check on incoming variables */ + if (x1<0 || x2>=COLNO || x1>x2 || y1<0 || y2>=ROWNO || y1>y2) + panic("wall_extends: bad bounds (%d,%d) to (%d,%d)",x1,y1,x2,y2); + /* * Step 2: set the correct wall type. We can't combine steps * 1 and 2 into a single sweep because we depend on knowing if -- 2.40.0