![]() |
Crossfire Server, Trunk
1.75.0
|
Include dependency graph for maze_gen.cpp:Go to the source code of this file.
Data Structures | |
| struct | free_walls_struct |
| Contains free walls in the map. More... | |
Functions | |
| static void | fill_maze_full (char **maze, int x, int y, int xsize, int ysize, free_walls_struct *free_walls) |
| Recursive routine which will fill every available space in the maze with walls. More... | |
| static void | fill_maze_sparse (char **maze, int x, int y, int xsize, int ysize, free_walls_struct *free_walls) |
| Recursive routine which will fill much of the maze, but will leave some free spots (possibly large) toward the center. More... | |
| static int | find_free_point (char **maze, int *x, int *y, int xc, int yc, int xsize, int ysize) |
| Randomly look for a square adjacent to this one where we can place a new block without closing a path. More... | |
| static void | make_wall_free_list (int xsize, int ysize, free_walls_struct *free_walls) |
| Inits the list of points where we can put walls on. More... | |
| char ** | maze_gen (int xsize, int ysize, int option, int _unused_layers) |
| 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. More... | |
| static void | pop_wall_point (int *x, int *y, free_walls_struct *free_walls) |
| Randomly returns one of the elements from the wall point list. More... | |
General maze generator.
Definition in file maze_gen.cpp.
|
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 301 of file maze_gen.cpp.
References find_free_point(), pop_wall_point(), RANDOM, and free_walls_struct::wall_free_size.
Referenced by maze_gen().
Here is the call graph for this function:
Here is the caller graph for this function:
|
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 334 of file maze_gen.cpp.
References find_free_point(), pop_wall_point(), RANDOM, and free_walls_struct::wall_free_size.
Referenced by maze_gen().
Here is the call graph for this function:
Here is the caller graph for this function:
|
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 192 of file maze_gen.cpp.
References RANDOM.
Referenced by fill_maze_full(), and fill_maze_sparse().
Here is the caller graph for this function:
|
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 121 of file maze_gen.cpp.
References free_walls_struct::wall_free_size, free_walls_struct::wall_x_list, and free_walls_struct::wall_y_list.
Referenced by maze_gen().
Here is the caller graph for this function:| char** maze_gen | ( | int | xsize, |
| int | ysize, | ||
| int | option, | ||
| int | _unused_layers | ||
| ) |
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. |
| _unused_layers | unused. |
Definition at line 59 of file maze_gen.cpp.
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().
Here is the call graph for this function:
Here is the caller graph for this function:
|
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.cpp.
References RANDOM, 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().
Here is the caller graph for this function: