--- deliantra/server/random_maps/snake.C 2006/08/13 17:16:03 1.1 +++ deliantra/server/random_maps/snake.C 2008/05/04 14:12:37 1.10 @@ -1,5 +1,4 @@ - /* peterm@langmuir.eecs.berkeley.edu: this function generates a random snake-type layout. @@ -11,85 +10,91 @@ */ - -#include #include -#include - - - +#include "random_map.h" +#include "rproto.h" -char **make_snake_layout(int xsize, int ysize,int options) { - int i,j; +void +make_snake_layout (Layout maze, int options) +{ + int i, j; - /* allocate that array, set it up */ - char **maze = (char **)calloc(sizeof(char*),xsize); - for(i=0;iclear (); + maze->border (); - /* write the outer walls */ - for(i=0;iw; + int ysize = maze->h; /* Bail out if the size is too small to make a snake. */ - if(xsize < 8 || ysize < 8) return maze; + if (xsize < 8 || ysize < 8) + return; /* decide snake orientation--vertical or horizontal , and make the walls and place the doors. */ - if(RANDOM()%2) { /* vertical orientation */ - int n_walls = RANDOM() % ((xsize - 5)/3) +1; - int spacing = xsize / (n_walls+1); - int orientation=1; - for(i=spacing;i