summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-04-23 02:18:39 -0300
committerJesusaves <cpntb1@ymail.com>2020-04-23 02:18:39 -0300
commit01300364ec077462bb499aa7058c3fb15cf28896 (patch)
treed5c32a497877842412fbdf18f0f2f1919763dd57
parent43610bbbda4f84e295f35702a6dff720f3d2d4f4 (diff)
downloadserverdata-01300364ec077462bb499aa7058c3fb15cf28896.tar.gz
serverdata-01300364ec077462bb499aa7058c3fb15cf28896.tar.bz2
serverdata-01300364ec077462bb499aa7058c3fb15cf28896.tar.xz
serverdata-01300364ec077462bb499aa7058c3fb15cf28896.zip
This sketch should fix the two major bugs
-rw-r--r--npc/maze0/config.txt51
1 files changed, 49 insertions, 2 deletions
diff --git a/npc/maze0/config.txt b/npc/maze0/config.txt
index c729b58bf..305c95603 100644
--- a/npc/maze0/config.txt
+++ b/npc/maze0/config.txt
@@ -290,13 +290,60 @@ function script MazeFix {
if (getd(.@v$+"$["+MAZESOUTH+"]") != "WALL")
.@skip=true;
- // If it doesn't, but is an edge, we don't care
+ // Finally skip
+ if (.@skip) {
+ .@y++;
+ continue;
+ }
+
+ .@dirns=any(true, false);
+
+ // If it doesn't, but is an edge, so we cannot enforce both rules
// 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) {
+ // End of X axis (row)
+ if (.@x >= MAZE_MX-1) {
+ .@x1=0; .@al=true;
+ while (.@x1 < .@x) {
+ .@vi=MazeVar(.@x1, .@y);
+ // There's a wall somewhere
+ if (getd(.@v$+"$["+MAZE_EAST+"]") == "WALL") {
+ .@al=false;
+ break;
+ }
+ .@x1++;
+ }
+ // There's no walls, so we need safeties
+ if (.@al) {
+ // Could pick a random place, but...
+ .@skip=false; .@dirns=true;
+ }
+ // End of Y axis (column)
+ } else {
+ .@y1=0; .@al=true;
+ while (.@y1 < .@y) {
+ .@vi=MazeVar(.@x, .@y1);
+ // There's a wall somewhere
+ if (getd(.@v$+"$["+MAZESOUTH+"]") == "WALL") {
+ .@al=false;
+ break;
+ }
+ .@y1++;
+ }
+ // There's no walls, so we need safeties
+ if (.@al) {
+ // Could pick a random place, but...
+ .@skip=false; .@dirns=false;
+ }
+ }
+ }
+
+ // All fine, continue to next row
+ if (.@skip) {
.@y++;
continue;
}
@@ -304,7 +351,7 @@ function script MazeFix {
debugmes "(%d, %d) editing from %d", .@x, .@y, getd(.@v$+"_ID");
// At least one of those paths must be open
- if (any(true, false)) {
+ if (.@dirns) {
// Force the opening to south
.@v2$=MazeVar(.@x, .@y+1);
setd(.@v$+"$["+MAZESOUTH+"]", str(.@x)+"_"+str(.@y+1));