Crossfire Server, Branches 1.12
R18729
|
Go to the source code of this file.
Data Structures | |
struct | free_walls_struct |
Typedefs | |
typedef struct free_walls_struct | free_walls_struct |
Functions | |
static void | fill_maze_full (char **maze, int x, int y, int xsize, int ysize, free_walls_struct *) |
static void | fill_maze_sparse (char **maze, int x, int y, int xsize, int ysize, free_walls_struct *) |
static int | find_free_point (char **maze, int *x, int *y, int xc, int yc, int xsize, int ysize) |
static void | make_wall_free_list (int xsize, int ysize, free_walls_struct *) |
char ** | maze_gen (int xsize, int ysize, int option) |
static void | pop_wall_point (int *x, int *y, free_walls_struct *) |
General maze generator.
Definition in file maze_gen.c.
typedef struct free_walls_struct free_walls_struct |
Contains free walls in the map.
|
static |
Recursive routine which will fill every available space in the maze with walls.
maze | maze. |
x | |
y | where to put a wall. |
xsize | |
ysize | maze size. |
free_walls | free walls list. |
Definition at line 297 of file maze_gen.c.
References find_free_point(), pop_wall_point(), and free_walls_struct::wall_free_size.
Referenced by maze_gen().
|
static |
Recursive routine which will fill much of the maze, but will leave some free spots (possibly large) toward the center.
maze | maze. |
x | |
y | where to put a wall. |
xsize | |
ysize | maze size. |
free_walls | free walls list. |
Definition at line 329 of file maze_gen.c.
References find_free_point(), pop_wall_point(), and free_walls_struct::wall_free_size.
Referenced by maze_gen().
|
static |
Randomly look for a square adjacent to this one where we can place a new block without closing a path. We may only look up, down, right, or left.
maze | current maze. | |
[out] | x | |
[out] | y | coordinates of the found point. |
xc | ||
yc | coordinates from where to look. | |
xsize | ||
ysize | maze size. |
Definition at line 191 of file maze_gen.c.
Referenced by fill_maze_full(), and fill_maze_sparse().
|
static |
Inits the list of points where we can put walls on. The free wall points are those outer points which aren't corners or near corners, and don't have a maze wall growing out of them already.
xsize | |
ysize | size of the map. |
free_walls | structure to initialise. free_walls_struct::wall_free_size must be initialised. |
Definition at line 123 of file maze_gen.c.
References free_walls_struct::wall_free_size, free_walls_struct::wall_x_list, and free_walls_struct::wall_y_list.
Referenced by maze_gen().
char** maze_gen | ( | int | xsize, |
int | ysize, | ||
int | option | ||
) |
This function generates a random blocked maze with the property that there is only one path from one spot to any other, and there is always a path from one spot to any other.
xsize | |
ysize | wanted map size. |
option | if 0, maze will be sparse (sizeable rooms), else totally filled. |
Definition at line 68 of file maze_gen.c.
References fill_maze_full(), fill_maze_sparse(), make_wall_free_list(), pop_wall_point(), free_walls_struct::wall_free_size, free_walls_struct::wall_x_list, and free_walls_struct::wall_y_list.
Referenced by layoutgen().
|
static |
Randomly returns one of the elements from the wall point list.
[out] | x | |
[out] | y | coordinates of the point. |
free_walls | free walls list. |
Definition at line 163 of file maze_gen.c.
References free_walls_struct::wall_free_size, free_walls_struct::wall_x_list, and free_walls_struct::wall_y_list.
Referenced by fill_maze_full(), fill_maze_sparse(), and maze_gen().