ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/maze_gen.C
(Generate patch)

Comparing deliantra/server/random_maps/maze_gen.C (file contents):
Revision 1.6 by root, Thu Jan 18 19:42:10 2007 UTC vs.
Revision 1.7 by root, Sat Jan 27 02:19:37 2007 UTC

19#include <global.h> 19#include <global.h>
20 20
21/*#include <random_map.h>*/ 21/*#include <random_map.h>*/
22#include <maze_gen.h> 22#include <maze_gen.h>
23#include <time.h> 23#include <time.h>
24
25
26/* this include solely, and only, is needed for the definition of RANDOM */
27
28
29 24
30/* global variables that everyone needs: don't want to pass them in 25/* global variables that everyone needs: don't want to pass them in
31 as parameters every time. */ 26 as parameters every time. */
32int *wall_x_list = 0; 27int *wall_x_list = 0;
33int *wall_y_list = 0; 28int *wall_y_list = 0;
136/* randomly returns one of the elements from the wall point list */ 131/* randomly returns one of the elements from the wall point list */
137 132
138void 133void
139pop_wall_point (int *x, int *y) 134pop_wall_point (int *x, int *y)
140{ 135{
141 int index = RANDOM () % wall_free_size; 136 int index = rndm (wall_free_size);
142 137
143 *x = wall_x_list[index]; 138 *x = wall_x_list[index];
144 *y = wall_y_list[index]; 139 *y = wall_y_list[index];
145 /* write the last array point here */ 140 /* write the last array point here */
146 wall_x_list[index] = wall_x_list[wall_free_size - 1]; 141 wall_x_list[index] = wall_x_list[wall_free_size - 1];
224 if (count == 0) 219 if (count == 0)
225 return -1; /* failed to find any clear points */ 220 return -1; /* failed to find any clear points */
226 221
227 /* choose a random direction */ 222 /* choose a random direction */
228 if (count > 1) 223 if (count > 1)
229 count = RANDOM () % count; 224 count = rndm (count);
230 else 225 else
231 count = 0; 226 count = 0;
227
232 switch (dirlist[count]) 228 switch (dirlist[count])
233 { 229 {
234 case 1: /* up */ 230 case 1: /* up */
235 { 231 {
236 *y = yc + 1; 232 *y = yc + 1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines