Crossfire Server, Trunk
|
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, int _unused_layers) |
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 301 of file maze_gen.c.
References find_free_point(), pop_wall_point(), RANDOM, free_walls_struct::wall_free_size, diamondslots::x, and diamondslots::y.
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 334 of file maze_gen.c.
References find_free_point(), pop_wall_point(), RANDOM, free_walls_struct::wall_free_size, diamondslots::x, and diamondslots::y.
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 192 of file maze_gen.c.
References disinfect::count, make_face_from_files::int, RANDOM, diamondslots::x, and diamondslots::y.
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 121 of file maze_gen.c.
References disinfect::count, 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, | ||
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.c.
References fill_maze_full(), fill_maze_sparse(), make_wall_free_list(), CFweardisguise::option, pop_wall_point(), nlohmann::detail::void(), 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 npc_dialog::index, RANDOM, free_walls_struct::wall_free_size, free_walls_struct::wall_x_list, free_walls_struct::wall_y_list, diamondslots::x, and diamondslots::y.
Referenced by fill_maze_full(), fill_maze_sparse(), and maze_gen().