|
Atrinik Server 2.5
|
#include <global.h>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 *free_walls) |
| static void | fill_maze_sparse (char **maze, int x, int y, int xsize, int ysize, free_walls_struct *free_walls) |
| static void | make_wall_free_list (int xsize, int ysize, free_walls_struct *free_walls) |
| static void | pop_wall_point (int *x, int *y, free_walls_struct *free_walls) |
| static int | find_free_point (char **maze, int *x, int *y, int xc, int yc, int xsize, int ysize) |
| char ** | maze_gen (int xsize, int ysize, int option) |
General maze generator.
We need to maintain a list of wall points to generate reasonable mazes: a straightforward recursive random walk maze generator would generate a map with a trivial circle-the-outer-wall solution
Definition in file maze_gen.c.
| typedef struct free_walls_struct free_walls_struct |
Contains free walls in the map.
| static void fill_maze_full | ( | char ** | maze, |
| int | x, | ||
| int | y, | ||
| int | xsize, | ||
| int | ysize, | ||
| free_walls_struct * | free_walls | ||
| ) | [static] |
Recursive routine which will fill every available space in the maze with walls.
| maze | The maze layout. |
| x | X position where to put a wall. |
| y | Y position where to put a wall. |
| xsize | X maze size. |
| ysize | Y maze size. |
| free_walls | Free walls list. |
Definition at line 326 of file maze_gen.c.
| static void fill_maze_sparse | ( | char ** | maze, |
| int | x, | ||
| int | y, | ||
| int | xsize, | ||
| int | ysize, | ||
| free_walls_struct * | free_walls | ||
| ) | [static] |
Recursive routine which will fill much of the maze, but will leave some free spots (possibly large) toward the center.
| maze | Maze layout. |
| x | X position where to put a wall. |
| y | Y position where to put a wall. |
| xsize | X size of the maze. |
| ysize | Y size of the maze. |
| free_walls | Free walls list. |
Definition at line 356 of file maze_gen.c.
| static int find_free_point | ( | char ** | maze, |
| int * | x, | ||
| int * | y, | ||
| int | xc, | ||
| int | yc, | ||
| int | xsize, | ||
| int | ysize | ||
| ) | [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 layout. |
| x | X coordinate of the found point. |
| y | Y coordinate of the found point. |
| xc | X coordinate from where to look. |
| yc | Y coordinate from where to look. |
| xsize | X size of the maze. |
| ysize | Y size of the maze. |
Definition at line 204 of file maze_gen.c.
| static void make_wall_free_list | ( | int | xsize, |
| int | ysize, | ||
| free_walls_struct * | free_walls | ||
| ) | [static] |
Initializes 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 | X size of the map. |
| ysize | Y size of the map. |
| free_walls | Structure to initialize. free_walls_struct::wall_free_size must be initialized. |
Definition at line 134 of file maze_gen.c.
| 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 | X wanted map size |
| ysize | Y wanted map size |
| option | If 0, maze will be sparse (sizeable rooms), otherwise totally filled. |
Definition at line 65 of file maze_gen.c.
| static void pop_wall_point | ( | int * | x, |
| int * | y, | ||
| free_walls_struct * | free_walls | ||
| ) | [static] |
Randomly returns one of the elements from the wall point list.
| x | X coordinate of the point. |
| y | Y coordinate of the point. |
| free_walls | Free walls list. |
Definition at line 177 of file maze_gen.c.
1.7.4