Crossfire Server, Branches 1.12
R18729
|
Go to the source code of this file.
Data Structures | |
struct | Room |
Functions | |
char ** | roguelike_layout_gen (int xsize, int ysize, int options) |
static void | roguelike_link_rooms (Room *Rooms, char **maze, int xsize, int ysize) |
static void | roguelike_make_rooms (Room *Rooms, char **maze, int options) |
static int | roguelike_place_room (Room *Rooms, int xsize, int ysize, int nrooms) |
int | surround_check (char **layout, int i, int j, int Xsize, int Ysize) |
Rogue/nethack-like layout generation
Definition in file rogue_layout.c.
char** roguelike_layout_gen | ( | int | xsize, |
int | ysize, | ||
int | options | ||
) |
Actually make the rogue layout. We work by a reduction process: first we make everything a wall, then we remove areas to make rooms
xsize | |
ysize | wanted layout size. |
options | 2 to have circular rooms, 1 for rectanglar ones, another value for random choice. |
Definition at line 69 of file rogue_layout.c.
References roguelike_link_rooms(), roguelike_make_rooms(), roguelike_place_room(), surround_check(), Room::x, and Room::y.
Referenced by layoutgen(), and main().
|
static |
Link generated rooms with corridors.
Rooms | room list. |
maze | maze. |
xsize | |
ysize | maze size. |
Definition at line 300 of file rogue_layout.c.
References MAX, MIN, Room::x, and Room::y.
Referenced by roguelike_layout_gen().
|
static |
Write all the rooms into the maze.
Rooms | list of rooms to write. |
maze | where to write to. |
options | 2 to have circular rooms, 1 for rectanglar ones, another value for random choice. |
Definition at line 254 of file rogue_layout.c.
References Room::ax, Room::ay, Room::sx, Room::sy, Room::x, and Room::y.
Referenced by roguelike_layout_gen().
|
static |
Place a room in the layout.
Rooms | list of existing rooms, new room will be added to it. |
xsize | |
ysize | layout size. |
nrooms | wanted number of room, used to determine size. |
Definition at line 180 of file rogue_layout.c.
References Room::ax, Room::ay, isqrt(), Room::sx, Room::sy, Room::x, Room::y, Room::zx, and Room::zy.
Referenced by roguelike_layout_gen().
int surround_check | ( | char ** | layout, |
int | i, | ||
int | j, | ||
int | Xsize, | ||
int | Ysize | ||
) |
Checks free spots around a spot.
layout | map layout. |
i | |
j | coordinates to check. |
Xsize | |
Ysize | size of the layout. |
Definition at line 44 of file rogue_layout.c.
Referenced by connect_spirals(), and roguelike_layout_gen().