summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
Diffstat (limited to 'npc')
-rw-r--r--npc/maze0/config.txt20
1 files changed, 13 insertions, 7 deletions
diff --git a/npc/maze0/config.txt b/npc/maze0/config.txt
index 67d972fa4..c729b58bf 100644
--- a/npc/maze0/config.txt
+++ b/npc/maze0/config.txt
@@ -272,8 +272,10 @@ function script ParseMaze {
// MazeFix() → Breaks islands at cost of randomness
// runs after ParseMaze. By now, maze structure is set and working
function script MazeFix {
- return;
// FIXME: BROKEN
+ if (!$@GM_OVERRIDE)
+ return;
+
.@x=0; .@y=0;
debugmes "(%d, %d)", MAZE_MX, MAZE_MY;
while (.@x < MAZE_MX) {
@@ -285,31 +287,35 @@ function script MazeFix {
// It need to have either a way east, or a way south
if (getd(.@v$+"$["+MAZE_EAST+"]") != "WALL")
.@skip=true;
- if (getd(.@v$+"$["+MAZE_SOUTH+"]") != "WALL")
+ if (getd(.@v$+"$["+MAZESOUTH+"]") != "WALL")
.@skip=true;
// If it doesn't, but is an edge, we don't care
- if (.@x == MAZE_MX || .@y == MAZE_MY)
+ // Do note (x,y) only goes to (MX-1, MY-1) because index
+ if (.@x >= MAZE_MX-1 || .@y >= MAZE_MY-1)
.@skip=true;
// Finally skip
if (.@skip) {
.@y++;
- debugmes "(%d, %d)", .@x, .@y;
continue;
}
+ debugmes "(%d, %d) editing from %d", .@x, .@y, getd(.@v$+"_ID");
+
// At least one of those paths must be open
if (any(true, false)) {
// Force the opening to south
.@v2$=MazeVar(.@x, .@y+1);
- setd(.@v$+"$["+MAZE_SOUTH+"]", str(.@x)+"_"+str(.@y+1));
+ setd(.@v$+"$["+MAZESOUTH+"]", str(.@x)+"_"+str(.@y+1));
setd(.@v2$+"$["+MAZENORTH+"]", str(.@x)+"_"+str(.@y));
+ debugmes "Edited NS axis: %s -> %s", .@v$, .@v2$;
} else {
// Force the opening to east
.@v2$=MazeVar(.@x+1, .@y);
- setd(.@v$+"$["+MAZE_SOUTH+"]", str(.@x+1)+"_"+str(.@y));
- setd(.@v2$+"$["+MAZENORTH+"]", str(.@x)+"_"+str(.@y));
+ setd(.@v$+"$["+MAZE_EAST+"]", str(.@x+1)+"_"+str(.@y));
+ setd(.@v2$+"$["+MAZE_WEST+"]", str(.@x)+"_"+str(.@y));
+ debugmes "Edited WE axis: %s -> %s", .@v$, .@v2$;
}
// Fix type
setd(.@v$+"_ID", FindMazeTypeByCon(.@v$));