Crossfire Server, Trunk
|
#include "global.h"
#include <assert.h>
#include <math.h>
#include <stdlib.h>
#include "random_map.h"
Go to the source code of this file.
Data Structures | |
struct | Room |
Functions | |
static int | rn2 (int x) |
char ** | roguelike_layout_gen (int xsize, int ysize, int _unused_options, int _unused_layers) |
static void | roguelike_link_rooms (Room *Rooms, char **maze) |
static void | roguelike_make_rooms (Room *Rooms, char **maze) |
static int | roguelike_place_room (Room *Rooms, int xsize, int ysize) |
int | surround_check (char **layout, int i, int j, int Xsize, int Ysize) |
Rogue/NetHack style room generation.
Definition in file rogue_layout.c.
|
static |
Definition at line 41 of file rogue_layout.c.
References RANDOM, and diamondslots::x.
Referenced by roguelike_place_room().
char** roguelike_layout_gen | ( | int | xsize, |
int | ysize, | ||
int | _unused_options, | ||
int | _unused_layers | ||
) |
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. |
_unused_options | unused. |
_unused_layers | unused. |
Definition at line 309 of file rogue_layout.c.
References RANDOM, roguelike_link_rooms(), roguelike_make_rooms(), roguelike_place_room(), surround_check(), nlohmann::detail::void(), Room::x, and Room::y.
Referenced by layoutgen(), and main().
|
static |
Link generated rooms with corridors.
Rooms | room list. |
maze | maze. |
Definition at line 157 of file rogue_layout.c.
References MAX, MIN, RANDOM, diamondslots::x, Room::x, guild_entry::x1, diamondslots::y, Room::y, and guild_entry::y1.
Referenced by roguelike_layout_gen().
|
static |
Write all the rooms into the maze.
Rooms | list of rooms to write. |
maze | where to write to. |
Definition at line 127 of file rogue_layout.c.
References Room::ax, Room::ay, RANDOM, 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. |
Definition at line 55 of file rogue_layout.c.
References Room::ax, Room::ay, RANDOM, rn2(), 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 280 of file rogue_layout.c.
Referenced by connect_spirals(), and roguelike_layout_gen().