--- deliantra/server/random_maps/room_gen_spiral.C 2007/11/08 19:43:25 1.11 +++ deliantra/server/random_maps/room_gen_spiral.C 2008/04/11 21:09:53 1.12 @@ -1,7 +1,7 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. * - * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team * Copyright (©) 1994,2007 Mark Wedel * Copyright (©) 1992,2007 Frank Tore Johansen * @@ -51,7 +51,7 @@ extern int surround_check (char **maze, int i, int j, int xsize, int ysize); -char ** +Maze map_gen_spiral (int xsize, int ysize, int option) { int i, j; @@ -61,13 +61,7 @@ float SizeX, SizeY; float xscale, yscale; - /* allocate that array, set it up */ - char **maze = (char **) calloc (sizeof (char *), xsize); - - for (i = 0; i < xsize; i++) - { - maze[i] = (char *) calloc (sizeof (char), ysize); - } + Maze maze (xsize, ysize); /* slightly easier to fill and then cut */ for (i = 0; i < xsize; i++) @@ -81,9 +75,7 @@ /* select random options if necessary */ if (option == 0) - { - option = rndm (MAX_SPIRAL_OPT); - } + option = rndm (MAX_SPIRAL_OPT); /* the order in which these are evaluated matters */ @@ -128,18 +120,16 @@ { x = parm * cos (parm) * xscale; y = parm * sin (parm) * yscale; - maze[(int) (ic + x)][(int) (jc + y)] = '\0'; + maze[int (ic + x)][int (jc + y)] = '\0'; parm += 0.01; }; - maze[(int) (ic + x + 0.5)][(int) (jc + y + 0.5)] = '<'; - + maze[int (ic + x + 0.5)][int (jc + y + 0.5)] = '<'; /* cut out the center in a 2x2 and place the center and downexit */ maze[ic][jc + 1] = '>'; maze[ic][jc] = 'C'; - return maze; } @@ -224,7 +214,4 @@ } } } - - - }