Crossfire Server, Trunk
rproto.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void bottom_centered_onion (char **maze, int xsize, int ysize, int option, int layers)
 
void bottom_right_centered_onion (char **maze, int xsize, int ysize, int option, int layers)
 
int can_make_wall (char **maze, int dx, int dy, int dir, RMParms *RP)
 
void centered_onion (char **maze, int xsize, int ysize, int option, int layers)
 
void connect_spirals (int xsize, int ysize, int sym, char **layout)
 
void doorify_layout (char **maze, RMParms *RP)
 
void draw_onion (char **maze, float *xlocations, float *ylocations, int layers)
 
void dump_layout (char **layout, RMParms *RP)
 
char ** expand2x (char **layout, int xsize, int ysize)
 
objectfind_closest_monster (mapstruct *map, int x, int y, RMParms *RP)
 
object ** find_doors_in_room (mapstruct *map, int x, int y, RMParms *RP)
 
void find_doors_in_room_recursive (char **layout, mapstruct *map, int x, int y, object **doorlist, int *ndoors, RMParms *RP)
 
void find_enclosed_spot (mapstruct *map, int *cx, int *cy, RMParms *RP)
 
void find_in_layout (int mode, char target, int *fx, int *fy, char **layout, RMParms *RP)
 
objectfind_monster_in_room (mapstruct *map, int x, int y, RMParms *RP)
 
objectfind_monster_in_room_recursive (char **layout, mapstruct *map, int x, int y, RMParms *RP)
 
int find_spot_for_submap (mapstruct *map, char **layout, int *ix, int *iy, int xsize, int ysize)
 
int find_spot_in_room (mapstruct *map, int x, int y, int *kx, int *ky, RMParms *RP)
 
mapstructfind_style (const char *dirname, const char *stylename, int difficulty)
 
void find_top_left_corner (char **maze, int *cx, int *cy)
 
void free_style_maps (void)
 
mapstructgenerate_random_map (const char *OutFileName, RMParms *RP, char **use_layout, sstring reset_group)
 
void include_map_in_map (mapstruct *dest_map, const mapstruct *in_map, int x, int y)
 
int keyplace (mapstruct *map, int x, int y, char *keycode, int door_flag, int n_keys, RMParms *RP)
 
char ** layoutgen (RMParms *RP)
 
int load_dir (const char *dir, char ***namelist, int skip_dirs)
 
mapstructload_style_map (char *style_name)
 
void lock_and_hide_doors (object **doorlist, mapstruct *map, int opts, RMParms *RP)
 
void make_doors (char **maze, float *xlocations, float *ylocations, int layers, int options)
 
mapstructmake_map_floor (char **layout, char *floorstyle, RMParms *RP)
 
void make_map_walls (mapstruct *map, char **layout, char *w_style, RMParms *RP)
 
char ** make_snake_layout (int xsize, int ysize, int _unused_options, int _unused_layers)
 
char ** make_square_spiral_layout (int xsize, int ysize, int _unused_options, int _unused_layers)
 
int make_wall (char **maze, int x, int y, int dir)
 
char ** map_gen_onion (int xsize, int ysize, int option, int layers)
 
char ** map_gen_spiral (int xsize, int ysize, int option, int _unused_layers)
 
char ** maze_gen (int xsize, int ysize, int option, int _unused_layers)
 
void nuke_map_region (mapstruct *map, int xstart, int ystart, int xsize, int ysize)
 
int obj_count_in_map (mapstruct *map, int x, int y)
 
objectpick_joined_wall (object *the_wall, char **layout, int i, int j, RMParms *RP)
 
objectpick_random_object (mapstruct *style)
 
objectplace_chest (int treasureoptions, int x, int y, mapstruct *map, int n_treasures, RMParms *RP)
 
void place_exits (mapstruct *map, char **maze, char *exitstyle, int orientation, RMParms *RP)
 
void place_fountain_with_specials (mapstruct *map)
 
void place_monsters (mapstruct *map, char *monsterstyle, int difficulty, RMParms *RP)
 
void place_special_exit (mapstruct *map, int hole_type, const RMParms *RP)
 
void place_specials_in_map (mapstruct *map, char **layout, RMParms *RP)
 
void place_treasure (mapstruct *map, char **layout, char *treasure_style, int treasureoptions, RMParms *RP)
 
void put_decor (mapstruct *map, char **maze, char *decorstyle, int decor_option, RMParms *RP)
 
void put_doors (mapstruct *the_map, char **maze, const char *doorstyle, RMParms *RP)
 
void remove_monsters (int x, int y, mapstruct *map)
 
objectretrofit_joined_wall (mapstruct *the_map, int i, int j, int insert_flag, RMParms *RP)
 
char ** roguelike_layout_gen (int xsize, int ysize, int options, int _unused_layers)
 
void roomify_layout (char **maze, RMParms *RP)
 
char ** rotate_layout (char **maze, int rotation, RMParms *RP)
 
int surround_check (char **layout, int i, int j, int Xsize, int Ysize)
 
int surround_check2 (char **layout, int i, int j, int Xsize, int Ysize)
 
int surround_flag (char **layout, int i, int j, RMParms *RP)
 
int surround_flag2 (char **layout, int i, int j, RMParms *RP)
 
int surround_flag3 (mapstruct *map, int i, int j, RMParms *RP)
 
int surround_flag4 (mapstruct *map, int i, int j, RMParms *RP)
 
char ** symmetrize_layout (char **maze, int sym, RMParms *RP)
 
void unblock_exits (mapstruct *map, char **maze, RMParms *RP)
 
int wall_blocked (mapstruct *m, int x, int y)
 
StringBufferwrite_map_parameters_to_string (const RMParms *RP)
 

Function Documentation

◆ bottom_centered_onion()

void bottom_centered_onion ( char **  maze,
int  xsize,
int  ysize,
int  option,
int  layers 
)

Create a bottom-centered layout.

Parameters
mazelayout.
xsize
ysizelayout size.
optioncombination of OPT_xxx values.
layersnumber of layers to create.

Definition at line 219 of file room_gen_onion.cpp.

References draw_onion(), make_doors(), MIN, OPT_IRR_SPACE, CFweardisguise::option, and RANDOM.

Referenced by map_gen_onion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bottom_right_centered_onion()

void bottom_right_centered_onion ( char **  maze,
int  xsize,
int  ysize,
int  option,
int  layers 
)

Create a bottom-right-centered layout.

Parameters
mazelayout.
xsize
ysizelayout size.
optioncombination of OPT_xxx values.
layersnumber of layers to create.

Definition at line 471 of file room_gen_onion.cpp.

References draw_onion(), make_doors(), MIN, OPT_IRR_SPACE, CFweardisguise::option, and RANDOM.

Referenced by map_gen_onion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ can_make_wall()

int can_make_wall ( char **  maze,
int  dx,
int  dy,
int  dir,
RMParms RP 
)

Checks the layout to see if we can stick a horizontal (dir = 0) wall (or vertical, dir == 1) here which ends up on other walls sensibly.

Parameters
mazelayout.
dx
dycoordinates to check
dirdirection:
  • 0: horizontally.
  • 1: vertically.
RPrandom map parameters.
Returns
-1 if wall can't be made, possibly wall length else.

Definition at line 558 of file random_map.cpp.

References surround_flag2(), diamondslots::x, RMParms::Xsize, diamondslots::y, and RMParms::Ysize.

Referenced by roomify_layout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ centered_onion()

void centered_onion ( char **  maze,
int  xsize,
int  ysize,
int  option,
int  layers 
)

Creates a centered onion layout.

Parameters
mazelayout.
xsize
ysizelayout size.
optioncombination of OPT_xxx values.
layersnumber of layers to create.

Definition at line 141 of file room_gen_onion.cpp.

References draw_onion(), make_doors(), MIN, OPT_IRR_SPACE, CFweardisguise::option, and RANDOM.

Referenced by map_gen_onion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ connect_spirals()

void connect_spirals ( int  xsize,
int  ysize,
int  sym,
char **  layout 
)

Connects disjoint spirals which may result from the symmetrization process.

Parameters
xsize
ysizelayout size.
symone of the SYM_xxx values.
layoutlayout to alter.

Definition at line 159 of file room_gen_spiral.cpp.

References surround_check(), X_SYM, XY_SYM, and Y_SYM.

Referenced by symmetrize_layout().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doorify_layout()

void doorify_layout ( char **  maze,
RMParms RP 
)

Puts doors at appropriate locations in a layout.

Parameters
mazelayout.
RPmap parameters.

Definition at line 697 of file random_map.cpp.

References RANDOM, surround_flag(), RMParms::Xsize, and RMParms::Ysize.

Referenced by layoutgen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ draw_onion()

void draw_onion ( char **  maze,
float *  xlocations,
float *  ylocations,
int  layers 
)

Draws the lines in the maze defining the onion layers.

Parameters
mazemap to draw to.
xlocations
ylocationsarray of locations.
layersnumber of layers.
Todo:
explain what locations arrays should be, and the meaning of layers.

Definition at line 306 of file room_gen_onion.cpp.

References make_face_from_files::int, and banquet::l.

Referenced by bottom_centered_onion(), bottom_right_centered_onion(), and centered_onion().

+ Here is the caller graph for this function:

◆ dump_layout()

void dump_layout ( char **  layout,
RMParms RP 
)

Dumps specified layout using printf().

Parameters
layoutlayout to dump.
RPlayout parameters.

Definition at line 43 of file random_map.cpp.

References RMParms::Xsize, and RMParms::Ysize.

Referenced by generate_random_map(), and layoutgen().

+ Here is the caller graph for this function:

◆ expand2x()

char** expand2x ( char **  layout,
int  xsize,
int  ysize 
)

Expands the layout be a factor 2. Doors and walls are taken care of.

Parameters
layoutlayout to expand. Memory is free()d at the end, so pointer becomes invalid.
xsize
ysizelayout size.
Returns
new layout. Must be free()d by caller.

Definition at line 43 of file expand2x.cpp.

References expand_door(), expand_misc(), and expand_wall().

+ Here is the call graph for this function:

◆ find_closest_monster()

object* find_closest_monster ( mapstruct map,
int  x,
int  y,
RMParms RP 
)

finds the closest monster and returns him, regardless of doors or walls

Parameters
map
x
ywhere to look from.
RPparameters for random map.
Returns
monster, or NULL if none found.
Todo:
shouldn't it search further away?

Definition at line 335 of file treasure.cpp.

References FLAG_MONSTER, FOR_MAP_FINISH, FOR_MAP_PREPARE, freearr_x, freearr_y, GET_MAP_FLAGS, disinfect::map, P_IS_ALIVE, QUERY_FLAG, SIZEOFFREE, diamondslots::x, and diamondslots::y.

Referenced by keyplace().

+ Here is the caller graph for this function:

◆ find_doors_in_room()

object** find_doors_in_room ( mapstruct map,
int  x,
int  y,
RMParms RP 
)

Gets all doors in a room.

Parameters
mapmap to look into.
x
ypoint of a room to find door for.
RPmap parameters.
Returns
door list. Should be free()d be caller. NULL-terminated.
Todo:
couldn't layout be given instead of being computed?

Definition at line 920 of file treasure.cpp.

References find_doors_in_room_recursive(), disinfect::map, wall_blocked(), diamondslots::x, RMParms::Xsize, diamondslots::y, and RMParms::Ysize.

Referenced by place_treasure().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_doors_in_room_recursive()

void find_doors_in_room_recursive ( char **  layout,
mapstruct map,
int  x,
int  y,
object **  doorlist,
int *  ndoors,
RMParms RP 
)

The workhorse routine, which finds the doors in a room

Parameters
layout
map
x
yrandom map to look into.
doorlistlist of doors.
ndoorsnumber of found doors.
RPmap parameters.

Definition at line 870 of file treasure.cpp.

References door_in_square(), freearr_x, freearr_y, llevError, LOG(), disinfect::map, RANDOM, diamondslots::x, and diamondslots::y.

Referenced by find_doors_in_room().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_enclosed_spot()

void find_enclosed_spot ( mapstruct map,
int *  cx,
int *  cy,
RMParms RP 
)

Searches the map for a spot with walls around it. The more walls the better, but it'll settle for 1 wall, or even 0, but it'll return 0 if no FREE spots are found.

Parameters
mapwhere to look.
cx
cywhere to look, and coordinates of found spot. -1 if no spot found.
RPparameters of the random map.

Definition at line 691 of file treasure.cpp.

References archininventory::arch, find_archetype(), freearr_x, freearr_y, disinfect::map, object_find_first_free_spot(), SIZEOFFREE1, surround_flag3(), diamondslots::x, and diamondslots::y.

Referenced by place_treasure().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_in_layout()

void find_in_layout ( int  mode,
char  target,
int *  fx,
int *  fy,
char **  layout,
RMParms RP 
)

Find a character in the layout.

Parameters
modehow to look:
  • 1: from top/left to bottom/right.
  • 2: from top/right to bottom/left.
  • 3: from bottom/left to top/right.
  • 4: from bottom/right to top/left.
  • other value: one random order is chosen.
targetcharacter to search.
fx
fyposition of character, or -1 if not found.
layoutmaze.
RPmaze parameters.

Definition at line 47 of file exit.cpp.

References RANDOM, RMParms::Xsize, and RMParms::Ysize.

Referenced by place_exits().

+ Here is the caller graph for this function:

◆ find_monster_in_room()

object* find_monster_in_room ( mapstruct map,
int  x,
int  y,
RMParms RP 
)

Find a monster in a room. Real work is done by find_monster_in_room_recursive().

Parameters
mapgenerated map.
x
ywhere to look from.
RPrandom map parameters.
Returns
monster, or NULL if none found.
Todo:
couldn't the layout be given instead of being calculated?

Definition at line 543 of file treasure.cpp.

References find_monster_in_room_recursive(), disinfect::map, wall_blocked(), diamondslots::x, RMParms::Xsize, diamondslots::y, and RMParms::Ysize.

Referenced by keyplace().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_monster_in_room_recursive()

object* find_monster_in_room_recursive ( char **  layout,
mapstruct map,
int  x,
int  y,
RMParms RP 
)

A recursive routine which will return a monster, eventually, if there is one. One should really call find_monster_in_room().

Parameters
layoutmap layout.
mapgenerated map.
x
ywhere to look from.
RPrandom map parameters.
Returns
monster, or NULL if none found.

Definition at line 492 of file treasure.cpp.

References FLAG_ALIVE, FOR_MAP_FINISH, FOR_MAP_PREPARE, freearr_x, freearr_y, GET_MAP_FLAGS, HEAD, disinfect::map, P_IS_ALIVE, QUERY_FLAG, RANDOM, diamondslots::x, and diamondslots::y.

Referenced by find_monster_in_room().

+ Here is the caller graph for this function:

◆ find_spot_for_submap()

int find_spot_for_submap ( mapstruct map,
char **  layout,
int *  ix,
int *  iy,
int  xsize,
int  ysize 
)

Finds a place to put a submap into.

Parameters
mapmap to insert.
layoutwhere to insert into.
ix
iycoordinates of suitable location if return is 1.
xsize
ysizesize of layout.
Returns
0 if no space found, 1 else.

Definition at line 154 of file special.cpp.

References banquet::l, m, disinfect::map, MAP_HEIGHT, MAP_WIDTH, RANDOM, settings, and Settings::special_break_map.

Referenced by place_specials_in_map().

+ Here is the caller graph for this function:

◆ find_spot_in_room()

int find_spot_in_room ( mapstruct map,
int  x,
int  y,
int *  kx,
int *  ky,
RMParms RP 
)

Find a random non-blocked spot in this room to drop a key. Returns 1 if success, 0 else.

Parameters
mapmap to look into.
x
ywhere to look from.
[out]kx
[out]kyfound spot if 1 is returned.
RPrandom map parameters.
Returns
1 if spot found, 0 else.
Todo:
couldn't layout be given instead of being computed?

Definition at line 635 of file treasure.cpp.

References find_spot_in_room_recursive(), disinfect::map, free_spots_struct::number_of_free_spots_in_room, RANDOM, free_spots_struct::room_free_spots_x, free_spots_struct::room_free_spots_y, wall_blocked(), diamondslots::x, RMParms::Xsize, diamondslots::y, and RMParms::Ysize.

Referenced by keyplace().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_style()

mapstruct* find_style ( const char *  dirname,
const char *  stylename,
int  difficulty 
)

Loads and returns the map requested. Dirname, for example, is "/styles/wallstyles", stylename, is, for example, "castle", difficulty is -1 when difficulty is irrelevant to the style. If dirname is given, but stylename isn't, and difficult is -1, it returns a random style map. Otherwise, it tries to match the difficulty given with a style file, named style_name_# where # is an integer

Parameters
dirnamewhere to look.
stylenamestyle to use, can be NULL.
difficultystyle difficulty.
Returns
style, or NULL if none suitable.
Todo:
better document.

Definition at line 180 of file style.cpp.

References Settings::datadir, load_dir(), load_style_map(), item::q, RANDOM, settings, and strlcpy().

Referenced by make_map_floor(), make_map_walls(), place_chest(), place_exits(), place_fountain_with_specials(), place_monsters(), place_special_exit(), place_specials_in_map(), put_decor(), and put_doors().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ find_top_left_corner()

void find_top_left_corner ( char **  maze,
int *  cx,
int *  cy 
)

This starts from within a centered onion layer (or between two layers), and looks up until it finds a wall, and then looks right until it finds a vertical wall, i.e., the corner. It sets cx and cy to that. it also starts from cx and cy.

Parameters
mazewhere to look.
cx
cywhere to start from, and detected corner.

Definition at line 53 of file square_spiral.cpp.

Referenced by make_square_spiral_layout().

+ Here is the caller graph for this function:

◆ free_style_maps()

void free_style_maps ( void  )

Frees cached style maps.

Definition at line 312 of file style.cpp.

References delete_map(), llevDebug, LOG(), give::next, mapstruct::next, and styles.

Referenced by cleanup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generate_random_map()

mapstruct* generate_random_map ( const char *  OutFileName,
RMParms RP,
char **  use_layout,
sstring  reset_group 
)

Main random map routine. Generates a random map based on specified parameters.

Parameters
OutFileNamethe path the map should have.
RPparameters for generation.
use_layoutif not NULL, this should be a suitable layout.
reset_groupif not NULL, the reset group this map will be part of, else the path will be used.
Returns
Crossfire map, which should be free()d by caller.

Definition at line 75 of file random_map.cpp.

References add_string(), apply_auto_fix(), buf, calculate_difficulty(), change_map_light(), RMParms::darkness, RMParms::decoroptions, RMParms::decorstyle, RMParms::difficulty, mapstruct::difficulty, RMParms::difficulty_given, RMParms::difficulty_increase, RMParms::doorstyle, dump_layout(), RMParms::dungeon_level, RMParms::exitstyle, RMParms::expand2x, RMParms::floorstyle, make_face_from_files::int, mapstruct::last_reset_time, layoutgen(), make_map_floor(), make_map_walls(), RMParms::map_layout_style, MIN_RANDOM_MAP_SIZE, RMParms::monsterstyle, mapstruct::msg, RMParms::orientation, mapstruct::outdoor, mapstruct::path, place_exits(), place_monsters(), place_specials_in_map(), place_treasure(), put_decor(), put_doors(), RANDOM, RMParms::random_seed, RMParms::region, mapstruct::region, mapstruct::reset_group, ROGUELIKE_LAYOUT, rotate_layout(), safe_strncpy, seconds(), set_darkness_map(), SRANDOM, stringbuffer_finish(), RMParms::treasureoptions, RMParms::treasurestyle, unblock_exits(), RMParms::wallstyle, write_map_parameters_to_string(), RMParms::Xsize, and RMParms::Ysize.

Referenced by cfapi_generate_random_map(), enter_random_map(), enter_random_template_map(), and generate_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ include_map_in_map()

void include_map_in_map ( mapstruct dest_map,
const mapstruct in_map,
int  x,
int  y 
)

Copy in_map into dest_map at point x,y. This also copies shop information if set in in_map.

Parameters
dest_mapmap where to copy to.
in_mapmap to copy from.
x
ycoordinates to put in_map to.

Definition at line 86 of file special.cpp.

References add_button_link(), CALLOC, FLAG_IS_LINKED, FOR_MAP_FINISH, FOR_MAP_PREPARE, FREE_AND_CLEAR, shopitems::index, INS_NO_MERGE, INS_NO_WALK_ON, MAP_HEIGHT, MAP_WIDTH, nuke_map_region(), object_copy_with_inv(), object_create_arch(), object_insert_in_map_at(), QUERY_FLAG, mapstruct::shopgreed, mapstruct::shopitems, mapstruct::shopmax, mapstruct::shopmin, mapstruct::shoprace, strdup_local, Ice::tmp, diamondslots::x, and diamondslots::y.

Referenced by place_specials_in_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ keyplace()

int keyplace ( mapstruct map,
int  x,
int  y,
char *  keycode,
int  door_flag,
int  n_keys,
RMParms RP 
)

Places keys in the map, preferably in something alive.

The idea is that you call keyplace on x,y where a door is, and it'll make sure a key is placed on both sides of the door.

Parameters
map
x
ywhere to put a key.
keycodekeycode is the key's code.
door_flagif NO_PASS_DOORS won't cross doors or walls to keyplace, PASS_DOORS will. if PASS_DOORS is set, the x & y values that are passed in are basically meaningless - IMO, it is a bit of misnomer, as when it is set, it just randomly chooses spaces on the map, ideally finding a close monster, to put the key in. In fact, if PASS_DOORS is set, there is no guarantee that the keys will be on both sides of the door - it may happen by randomness, but the code doesn't work to make sure it happens.
n_keysnumber of keys to place. If 1, it will place 1 key. Else, it will place 2-4 keys.
RPrandom map parameters.
Returns
1 if key was successfully placed, 0 else.

Definition at line 385 of file treasure.cpp.

References add_string(), create_archetype(), RMParms::dungeon_level, RMParms::dungeon_name, find_closest_monster(), find_monster_in_room(), find_spot_in_room(), free_string(), freearr_x, freearr_y, hall_of_fame::keys, disinfect::map, object::name, NO_PASS_DOORS, object_find_first_free_spot(), object_insert_in_map_at(), object_insert_in_ob(), PASS_DOORS, RANDOM, object::slaying, wall_blocked(), diamondslots::x, RMParms::Xsize, diamondslots::y, and RMParms::Ysize.

Referenced by lock_and_hide_doors(), and place_chest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ layoutgen()

char** layoutgen ( RMParms RP)

This function builds the actual layout. Selects the layout based on parameters and gives it whatever arguments it needs.

Parameters
RPrandom map parameters.
Returns
layout, must be free()d be caller.
Todo:
use an array for name/style mapping. Refactor to call only one function for each (will make it easier to override later on).

Definition at line 225 of file random_map.cpp.

References doorify_layout(), dump_layout(), expand2x(), RMParms::expand2x, RMParms::layoutoptions1, RMParms::layoutoptions2, RMParms::layoutstyle, make_snake_layout(), make_square_spiral_layout(), map_gen_onion(), map_gen_spiral(), RMParms::map_layout_style, maze_gen(), MAZE_LAYOUT, MIN_RANDOM_MAP_SIZE, NO_SYM, NROFLAYOUTS, ONION_LAYOUT, OPT_WALLS_ONLY, RANDOM, RANDOM_SYM, ROGUELIKE_LAYOUT, roguelike_layout_gen(), roomify_layout(), SNAKE_LAYOUT, SPIRAL_LAYOUT, SQUARE_SPIRAL_LAYOUT, symmetrize_layout(), RMParms::symmetry, RMParms::symmetry_used, X_SYM, RMParms::Xsize, XY_SYM, Y_SYM, and RMParms::Ysize.

Referenced by generate_random_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_dir()

int load_dir ( const char *  dir,
char ***  namelist,
int  skip_dirs 
)

This is our own version of scandir/select_regular_files/sort. To support having subdirectories in styles, we need to know if in fact the directory we read is a subdirectory. However, we can't get that through the normal dirent entry. So instead, we do our own where we do have the full directory path so can do stat calls to see if in fact it is a directory. dir is the name of the director to scan. namelist is the array of file names returned. IT needs to be freed by the caller. skip_dirs controls our behavioru - if nonzero, we don't skip any subdirectories - if zero, we store those away, since there are cases where we want to choose a random directory.

Parameters
dirdirectory to list.
[out]namelistlist of files found.
skip_dirsif non 0, don't list directories.
Returns
-1 if dir is invalid, number of files else.

Definition at line 74 of file style.cpp.

References closedir(), give::name, opendir(), pointer_strcmp(), readdir(), strdup_local, and nlohmann::detail::void().

Referenced by find_style().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ load_style_map()

mapstruct* load_style_map ( char *  style_name)

Loads specified map (or take it from cache list).

Parameters
style_namemap to load.
Returns
map.

Definition at line 131 of file style.cpp.

References first_map, MAP_STYLE, mapfile_load(), mapstruct::next, mapstruct::path, styles, and Ice::tmp.

Referenced by find_style().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lock_and_hide_doors()

void lock_and_hide_doors ( object **  doorlist,
mapstruct map,
int  opts,
RMParms RP 
)

Locks and/or hides all the doors in doorlist, or does nothing if opts doesn't say to lock/hide doors. Note that some doors can be not locked if no good spot to put a key was found.

Parameters
doorlistdoors to list. NULL-terminated.
mapmap we're working on.
optsoptions.
RPmap parameters.
Todo:
document opts. Isn't it part of RP?

Definition at line 1005 of file treasure.cpp.

References add_string(), create_archetype(), DOORED, object::face, FLAG_REMOVED, HIDDEN, keyplace(), disinfect::map, NO_PASS_DOORS, object_free_drop_inventory(), object_insert_in_map_at(), object_remove(), QUERY_FLAG, RANDOM, remove_adjacent_doors(), retrofit_joined_wall(), object::slaying, object::x, and object::y.

Referenced by place_treasure().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_doors()

void make_doors ( char **  maze,
float *  xlocations,
float *  ylocations,
int  layers,
int  options 
)

Add doors to the layout.

Parameters
mazemap to draw to.
xlocations
ylocationsarray of locations. Will be free()d.
layersnumber of layers.
optionscombination of OPT_xxx values.
Todo:
explain what locations arrays should be, and the meaning of layers.

Definition at line 345 of file room_gen_onion.cpp.

References cleanup(), make_face_from_files::int, banquet::l, OPT_BOTTOM_C, OPT_BOTTOM_R, OPT_LINEAR, OPT_NO_DOORS, options, and RANDOM.

Referenced by bottom_centered_onion(), bottom_right_centered_onion(), and centered_onion().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_map_floor()

mapstruct* make_map_floor ( char **  layout,
char *  floorstyle,
RMParms RP 
)

Creates the Crossfire mapstruct object from the layout, and adds the floor.

Parameters
layoutgenerated layout.
floorstylefloor style. Can be NULL, in which case a random one is chosen.
RPparameters of the random map.
Returns
Crossfire map.

Definition at line 75 of file floor.cpp.

References object::arch, arch_to_object(), find_style(), get_empty_map(), GET_MAP_OB, INS_NO_MERGE, INS_NO_WALK_ON, RMParms::multiple_floors, object_insert_in_map_at(), pick_random_object(), put_floor(), diamondslots::x, RMParms::Xsize, diamondslots::y, and RMParms::Ysize.

Referenced by generate_random_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_map_walls()

void make_map_walls ( mapstruct map,
char **  layout,
char *  w_style,
RMParms RP 
)

takes a map and a layout, and puts walls in the map (picked from w_style) at '#' marks.

Parameters
mapmap where walls will be put.
layoutlayout containing walls and such.
w_stylewall style. Must not be NULL, can be "none".
RPmap parameters.

Definition at line 184 of file wall.cpp.

References object::arch, arch_to_object(), find_style(), INS_NO_MERGE, INS_NO_WALK_ON, disinfect::map, MOVE_ALL, object::move_allow, object::move_block, archetype::name, object_insert_in_map_at(), pick_joined_wall(), pick_random_object(), strlcpy(), RMParms::wall_name, RMParms::Xsize, and RMParms::Ysize.

Referenced by generate_random_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_snake_layout()

char** make_snake_layout ( int  xsize,
int  ysize,
int  _unused_option,
int  _unused_layers 
)

Generate a snake-like layout.

Parameters
xsize
ysizelayout size.
_unused_optionunused.
_unused_layersunused.
Returns
generated layout.

Definition at line 36 of file snake.cpp.

References RANDOM, and nlohmann::detail::void().

Referenced by layoutgen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_square_spiral_layout()

char** make_square_spiral_layout ( int  xsize,
int  ysize,
int  _unused_option,
int  _unused_layers 
)

Generates a square-spiral layout.

Parameters
xsize
ysizesize of the layout.
_unused_optionunused.
_unused_layersunused.
Returns
generated layout.
Todo:
use function in another file for character searching.

Definition at line 80 of file square_spiral.cpp.

References find_top_left_corner(), make_wall(), map_gen_onion(), OPT_CENTERED, OPT_NO_DOORS, RANDOM, and nlohmann::detail::void().

Referenced by layoutgen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ make_wall()

int make_wall ( char **  maze,
int  x,
int  y,
int  dir 
)

Cuts the layout horizontally or vertically by a wall with a door.

Parameters
mazelayout.
x
ywhere to put the door.
dirwall direction:
  • 0: horizontally.
  • 1: vertically.
Returns
0

Definition at line 658 of file random_map.cpp.

References diamondslots::x, and diamondslots::y.

Referenced by make_square_spiral_layout(), and roomify_layout().

+ Here is the caller graph for this function:

◆ map_gen_onion()

char** map_gen_onion ( int  xsize,
int  ysize,
int  option,
int  layers 
)

Generates an onion layout.

Parameters
xsize
ysizelayout size.
optioncombination of OPT_xxx values.
layersnumber of layers the onion should have.
Returns
layout.

Definition at line 70 of file room_gen_onion.cpp.

◆ map_gen_spiral()

char** map_gen_spiral ( int  xsize,
int  ysize,
int  option,
int  _unused_layers 
)

Generates a spiral layout.

Parameters
xsize
ysizelayout size.
optioncombination of SPIRAL_xxx values.
_unused_layersunused.
Returns
generated layout.

Definition at line 62 of file room_gen_spiral.cpp.

References FINE_SPIRAL, FIT_SPIRAL, make_face_from_files::int, MAX_FINE, MAX_SPIRAL_OPT, MIN, CFweardisguise::option, RANDOM, REGULAR_SPIRAL, nlohmann::detail::void(), diamondslots::x, and diamondslots::y.

Referenced by layoutgen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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.

Parameters
xsize
ysizewanted map size.
optionif 0, maze will be sparse (sizeable rooms), else totally filled.
_unused_layersunused.
Returns
a char** array with # and . for closed and open respectively. a char value of 0 represents a blank space: a '#' is a wall.

Definition at line 59 of file maze_gen.cpp.

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.

+ Here is the call graph for this function:

◆ nuke_map_region()

void nuke_map_region ( mapstruct map,
int  xstart,
int  ystart,
int  xsize,
int  ysize 
)

Erases all objects (except floor) in the given rectangle.

Parameters
mapmap to process.
xstart
ystarttop-left coordinates of zone.
xsize
ysizesize of zone.

Definition at line 59 of file special.cpp.

References FLAG_IS_FLOOR, FOR_MAP_FINISH, FOR_MAP_PREPARE, HEAD, disinfect::map, object_free_drop_inventory(), object_remove(), QUERY_FLAG, and Ice::tmp.

Referenced by include_map_in_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ obj_count_in_map()

int obj_count_in_map ( mapstruct map,
int  x,
int  y 
)

Count objects at a spot.

Parameters
mapmap we want to check
x
ycoordinates
Returns
count of objects in the map at x,y.

Definition at line 39 of file decor.cpp.

References disinfect::count, FOR_MAP_FINISH, FOR_MAP_PREPARE, disinfect::map, Ice::tmp, diamondslots::x, and diamondslots::y.

Referenced by put_decor().

+ Here is the caller graph for this function:

◆ pick_joined_wall()

object* pick_joined_wall ( object the_wall,
char **  layout,
int  i,
int  j,
RMParms RP 
)

Picks the right wall type for this square, to make it look nice, and have everything nicely joined. It uses the layout.

Parameters
the_wallwall we want to insert.
layout
i
jwhere to insert.
RPmap parameters.
Returns
correct wall archetype to fit on the square.
Todo:
check if there isn't an equivalent function in the building code, merge?

Definition at line 255 of file wall.cpp.

References object::arch, arch_to_object(), banquet::l, archetype::name, surround_flag2(), try_find_archetype(), and wall_join.

Referenced by make_map_walls().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ pick_random_object()

object* pick_random_object ( mapstruct style)

Picks a random object from a style map. Redone by MSW so it should be faster and not use static variables to generate tables.

Parameters
stylemap to pick from.
Returns
random object. Can be NULL.

Definition at line 289 of file style.cpp.

References GET_MAP_OB, HEAD, MAP_HEIGHT, MAP_WIDTH, RANDOM, CFInsulter::style, diamondslots::x, and diamondslots::y.

Referenced by make_map_floor(), make_map_walls(), place_chest(), place_exits(), place_fountain_with_specials(), place_monsters(), place_special_exit(), put_decor(), and put_doors().

+ Here is the caller graph for this function:

◆ place_chest()

object* place_chest ( int  treasureoptions,
int  x,
int  y,
mapstruct map,
int  n_treasures,
RMParms RP 
)

Put a chest into the map, near x and y, with a chest from the styles/cheststyles map.

Parameters
treasureoptionsoptions.
x
yaround which spot to put treasure.
mapmap to put on.
n_treasures?
RPparameters the map was generated from.
Returns
inserted chest, NULL for failure.
Todo:
document treasureoptions. Clean parameters. Check meaning of chest hp's field.

Definition at line 220 of file treasure.cpp.

References add_string(), BC_RANDOM, living::Cha, RMParms::cheststyle, create_archetype(), RMParms::difficulty, find_style(), find_treasurelist(), freearr_x, freearr_y, living::hp, keyplace(), KEYREQUIRED, object::level, disinfect::map, MIMIC, object_copy_with_inv(), object_find_first_free_spot(), object_free_drop_inventory(), object_insert_in_map_at(), object_insert_in_ob(), object_new(), PASS_DOORS, pick_random_object(), RANDOM, object::randomitems, object::slaying, object::stats, TRAPPED, TREASURE, object::type, wall_blocked(), diamondslots::x, object::x, diamondslots::y, and object::y.

Referenced by place_treasure().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ place_exits()

void place_exits ( mapstruct map,
char **  maze,
char *  exitstyle,
int  orientation,
RMParms RP 
)

Place exits in the map.

Parameters
mapmap to put exits into.
mazemap layout.
exitstylewhat style to use. If NULL uses a random one.
orientationhow exits should be oriented:
  • 0 means random.
  • 1 means descending dungeon.
  • 2 means ascending dungeon.
  • 3 means rightward.
  • 4 means leftward.
  • 5 means northward.
  • 6 means southward.
RPmap parameters.
Note
unblock_exits() should be called at some point, as exits will be blocking everything to avoid putting other objects on them.
Todo:
add orientations 3-6 or fix previous comment.

Definition at line 144 of file exit.cpp.

References add_string(), archininventory::arch, object::arch, arch_to_object(), buf, create_archetype(), RMParms::dungeon_depth, RMParms::dungeon_level, EXIT, RMParms::exit_on_final_map, EXIT_PATH, EXIT_X, EXIT_Y, RMParms::final_exit_archetype, RMParms::final_map, find_archetype(), find_in_layout(), find_style(), FOR_MAP_FINISH, FOR_MAP_PREPARE, freearr_x, freearr_y, living::hp, disinfect::map, MAP_ENTER_X, MAP_ENTER_Y, MOVE_ALL, object::move_block, object_find_first_free_spot(), object_free_drop_inventory(), object_insert_in_map_at(), object_remove(), object_set_msg(), RMParms::origin_map, RMParms::origin_x, RMParms::origin_y, mapstruct::path, pick_random_object(), RANDOM, ready_map_name(), mapstruct::reset_group, set_map_timeout(), object::slaying, living::sp, object::stats, stringbuffer_finish(), Ice::tmp, try_find_archetype(), wall_blocked(), write_map_parameters_to_string(), object::x, RMParms::Xsize, object::y, and RMParms::Ysize.

Referenced by generate_random_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ place_fountain_with_specials()

◆ place_monsters()

void place_monsters ( mapstruct map,
char *  monsterstyle,
int  difficulty,
RMParms RP 
)

Place some monsters into the map. Their experience is linked to difficulty to insert a suitable number of critters.

Parameters
mapwhere to put monsters on.
monsterstylestyle. Can be NULL, in which case a random one is used.
difficultyhow difficult the monsters should be, and how many there should be.
RPrandom map parameters.

Definition at line 38 of file monster.cpp.

References object::arch, living::exp, find_style(), freearr_x, freearr_y, generate_artifact(), living::hp, INS_NO_MERGE, INS_NO_WALK_ON, level_exp(), disinfect::map, MAP_HEIGHT, MAP_WIDTH, archetype::more, object_copy_with_inv(), object_create_arch(), object_find_first_free_spot(), object_insert_in_map_at(), pick_random_object(), RANDOM, rndm(), object::stats, RMParms::total_map_hp, diamondslots::x, RMParms::Xsize, diamondslots::y, and RMParms::Ysize.

Referenced by generate_random_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ place_special_exit()

◆ place_specials_in_map()

void place_specials_in_map ( mapstruct map,
char **  layout,
RMParms RP 
)

Main function for specials.

Parameters
mapmap to alter.
layoutlayout the map was generated from.
RPparameters the map was generated from.

Definition at line 396 of file special.cpp.

References RMParms::difficulty, find_spot_for_submap(), find_style(), include_map_in_map(), disinfect::map, MAP_HEIGHT, MAP_WIDTH, NUM_OF_SPECIAL_TYPES, place_fountain_with_specials(), place_special_exit(), RANDOM, SPECIAL_EXIT, SPECIAL_FOUNTAIN, and SPECIAL_SUBMAP.

Referenced by generate_random_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ place_treasure()

void place_treasure ( mapstruct map,
char **  layout,
char *  treasure_style,
int  treasureoptions,
RMParms RP 
)

Place treasures in the map. map, (required) layout, (required) treasure style (may be NULL or "none" to cause no treasure.) treasureoptions (may be 0 for random choices or positive)

Parameters
mapwhere to insert to.
layoutlayout the map was generated from.
treasure_styletreasure style. May be NULL or "none" for no treasures, any other value to put treasures.
treasureoptionstreasure options.
RPrandom map parameters.
Todo:
flags for treasureoptions.

Definition at line 92 of file treasure.cpp.

References BC_RANDOM, CONCENTRATED, RMParms::difficulty, DOORED, find_doors_in_room(), find_enclosed_spot(), HIDDEN, LAST_OPTION, lock_and_hide_doors(), disinfect::map, RMParms::map_layout_style, ONION_LAYOUT, place_chest(), RANDOM, RICH, SPARSE, SPIRAL_LAYOUT, SQUARE_SPIRAL_LAYOUT, surround_by_doors(), RMParms::symmetry_used, RMParms::total_map_hp, wall_blocked(), object::x, RMParms::Xsize, object::y, and RMParms::Ysize.

Referenced by generate_random_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ put_decor()

void put_decor ( mapstruct map,
char **  maze,
char *  decorstyle,
int  decor_option,
RMParms RP 
)

Put the decor into the map. Right now, it's very primitive.

Parameters
mapmap to add decor to.
mazelayout of the map, as was generated.
decorstylestyle to use. Can be NULL.
decor_optionhow to place decor:
  • 0 means no decor.
  • 1 means to place randomly decor.
  • other means to fill the map with decor.
RPparameters of the random map.

Definition at line 65 of file decor.cpp.

References object::arch, arch_to_object(), find_style(), disinfect::map, NR_DECOR_OPTIONS, obj_count_in_map(), object_copy(), object_insert_in_map_at(), pick_random_object(), RANDOM, diamondslots::x, RMParms::Xsize, diamondslots::y, and RMParms::Ysize.

Referenced by generate_random_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ put_doors()

void put_doors ( mapstruct the_map,
char **  maze,
const char *  doorstyle,
RMParms RP 
)

Add doors to a map.

Parameters
the_mapmap we're adding doors to.
mazemaze layout.
doorstyledoor style to be. If "none", won't do anything. If NULL, will choose one randomly.
RPrandom map parameters.

Definition at line 73 of file door.cpp.

References object::arch, arch_to_object(), find_style(), object_copy(), object_insert_in_map_at(), mapstruct::path, pick_random_object(), surround_check2(), RMParms::Xsize, and RMParms::Ysize.

Referenced by generate_random_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ remove_monsters()

void remove_monsters ( int  x,
int  y,
mapstruct map 
)

Remove living things on specified spot.

Parameters
x
y
mapwhere to remove.

Definition at line 764 of file treasure.cpp.

References FLAG_ALIVE, FOR_MAP_FINISH, FOR_MAP_PREPARE, GET_MAP_OB, HEAD, disinfect::map, object_free_drop_inventory(), object_remove(), QUERY_FLAG, Ice::tmp, diamondslots::x, and diamondslots::y.

Referenced by surround_by_doors().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ retrofit_joined_wall()

object* retrofit_joined_wall ( mapstruct the_map,
int  i,
int  j,
int  insert_flag,
RMParms RP 
)

this takes a map, and changes an existing wall to match what's blocked around it, counting only doors and walls as blocked. If insert_flag is 1, . If not, it will only return the wall which would belong there, and doesn't remove anything. It depends on the global, previously-set variable, "wall_name"

Parameters
the_map
i
jwhere to look.
insert_flagif 1, insert the correct wall into the map, else don't insert.
RPmap parameters.
Returns
correct wall for spot.
Todo:
merge with pick_joined_wall()?

Definition at line 314 of file wall.cpp.

References arch_to_object(), DOOR, EXIT, FOR_MAP_FINISH, FOR_MAP_PREPARE, INS_NO_MERGE, INS_NO_WALK_ON, banquet::l, LOCKED_DOOR, object::map, MOVE_ALL, object::move_block, MOVE_WALK, object_free_drop_inventory(), object_insert_in_map_at(), object_remove(), surround_flag4(), TELEPORTER, Ice::tmp, try_find_archetype(), object::type, wall_join, and RMParms::wall_name.

Referenced by lock_and_hide_doors().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ roguelike_layout_gen()

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

Parameters
xsize
ysizewanted layout size.
_unused_optionsunused.
_unused_layersunused.
Returns
generated layout.

Definition at line 309 of file rogue_layout.cpp.

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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ roomify_layout()

void roomify_layout ( char **  maze,
RMParms RP 
)

Take a layout and make some rooms in it. Works best on onions.

Parameters
mazelayout to alter.
RPmap parameters.

Definition at line 510 of file random_map.cpp.

References can_make_wall(), make_wall(), RANDOM, RMParms::Xsize, and RMParms::Ysize.

Referenced by layoutgen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rotate_layout()

char** rotate_layout ( char **  maze,
int  rotation,
RMParms RP 
)

Takes a map and rotates it. This completes the onion layouts, making them possibly centered on any wall. It'll modify Xsize and Ysize if they're swapped.

Parameters
mazelayout to rotate, will be free()d by this function.
rotationhow to rotate:
  • 0: don't do anything.
  • 1: rotate 90 deg clockwise.
  • 2: rotate 180 deg.
  • 3: rotate 90 deg counter-clockwise.
RPrandom map parameters.
Returns
new layout, must be free()d be caller. NULL if invalid rotation.

Definition at line 441 of file random_map.cpp.

References RMParms::Xsize, and RMParms::Ysize.

Referenced by generate_random_map().

+ Here is the caller graph for this function:

◆ surround_check()

int surround_check ( char **  layout,
int  i,
int  j,
int  Xsize,
int  Ysize 
)

Checks free spots around a spot.

Parameters
layoutmap layout.
i
jcoordinates to check.
Xsize
Ysizesize of the layout.
Returns
combination of the following values:
  • 1 = free space to left,
  • 2 = free space to right,
  • 4 = free space above
  • 8 = free space below
Todo:
there is an equivalent function in another layout, merge them together.

Definition at line 280 of file rogue_layout.cpp.

◆ surround_check2()

int surround_check2 ( char **  layout,
int  i,
int  j,
int  Xsize,
int  Ysize 
)

Serch for doors or walls around a spot.

Parameters
layoutmaze.
i
jcoordinates to check.
Xsize
Ysizemaze size.
Returns
Combination of flags:
  • 1 = door or wall to left.
  • 2 = door or wall to right.
  • 4 = door or wall above.
  • 8 = door or wall below.

Definition at line 43 of file door.cpp.

Referenced by put_doors().

+ Here is the caller graph for this function:

◆ surround_flag()

int surround_flag ( char **  layout,
int  i,
int  j,
RMParms RP 
)

Given a layout and a coordinate, tell me which squares up/down/right/left are occupied.

Parameters
layout
i
jspot to look.
RPmap parameters.
Returns
combination of:
  • 1 = something on left.
  • 2 = something on right.
  • 4 = something on above.
  • 8 = something on below.
Todo:
merge with surround_flag2() and friends, check if such a function doesn't exist in other files.

Definition at line 40 of file wall.cpp.

Referenced by doorify_layout().

+ Here is the caller graph for this function:

◆ surround_flag2()

int surround_flag2 ( char **  layout,
int  i,
int  j,
RMParms RP 
)

Given a layout and a coordinate, tell me which squares up/down/right/left are occupied by walls.

Parameters
layout
i
jspot to look.
RPmap parameters.
Returns
combination of:
  • 1 = wall on left.
  • 2 = wall on right.
  • 4 = wall on above.
  • 8 = wall on below.
Todo:
merge with surround_flag() and friends, check if such a function doesn't exist in other files.

Definition at line 77 of file wall.cpp.

Referenced by can_make_wall(), and pick_joined_wall().

+ Here is the caller graph for this function:

◆ surround_flag3()

int surround_flag3 ( mapstruct map,
int  i,
int  j,
RMParms RP 
)

Check a map for blocked spots. Since this is part of the random map code, presumption is that this is not a tiled map. What is considered blocking and not is somewhat hard coded.

Parameters
map
i
jspot to look.
RPmap parameters.
Returns
combination of:
  • 1 = blocked on left.
  • 2 = blocked on right.
  • 4 = blocked on above.
  • 8 = blocked on below.

Definition at line 114 of file wall.cpp.

References GET_MAP_MOVE_BLOCK, disinfect::map, and MOVE_BLOCK_DEFAULT.

Referenced by find_enclosed_spot().

+ Here is the caller graph for this function:

◆ surround_flag4()

int surround_flag4 ( mapstruct map,
int  i,
int  j,
RMParms RP 
)

Check a map for spots with walls. Since this is part of the random map code, presumption is that this is not a tiled map. What is considered blocking and not is somewhat hard coded.

Parameters
map
i
jspot to look.
RPmap parameters.
Returns
combination of:
  • 1 = blocked on left.
  • 2 = blocked on right.
  • 4 = blocked on above.
  • 8 = blocked on below.

Definition at line 152 of file wall.cpp.

References disinfect::map, and wall_blocked().

Referenced by retrofit_joined_wall().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ symmetrize_layout()

char** symmetrize_layout ( char **  maze,
int  sym,
RMParms RP 
)

Takes a map and makes it symmetric: adjusts Xsize and Ysize to produce a symmetric map.

Parameters
mazelayout to symmetrize. Will be free()d by this function.
symhow to make symetric, a Random map symetry value.
RPmap parameters.
Returns
new layout, must be free()d by caller.

Definition at line 360 of file random_map.cpp.

References connect_spirals(), RMParms::map_layout_style, NO_SYM, ROGUELIKE_LAYOUT, SPIRAL_LAYOUT, RMParms::symmetry_used, X_SYM, RMParms::Xsize, XY_SYM, Y_SYM, and RMParms::Ysize.

Referenced by layoutgen().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unblock_exits()

void unblock_exits ( mapstruct map,
char **  maze,
RMParms RP 
)

This function unblocks the exits. We blocked them to keep things from being dumped on them during the other phases of random map generation.

Parameters
mapmap to alter.
mazemap layout.
RPmap generation parameters.

Definition at line 401 of file exit.cpp.

References FOR_MAP_FINISH, FOR_MAP_PREPARE, LOCKED_DOOR, disinfect::map, MOVE_ALL, MOVE_BLOCK_DEFAULT, object_update(), UP_OBJ_CHANGE, RMParms::Xsize, and RMParms::Ysize.

Referenced by generate_random_map().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ wall_blocked()

int wall_blocked ( mapstruct m,
int  x,
int  y 
)

Returns true if square x,y has P_NO_PASS set, which is true for walls and doors but not monsters. This function is not map tile aware.

Parameters
m
x
ymap and coordinates to check for.
Returns
non zero if blocked, 0 else.

Definition at line 62 of file treasure.cpp.

References GET_MAP_MOVE_BLOCK, m, MOVE_BLOCK_DEFAULT, OUT_OF_REAL_MAP, ring_occidental_mages::r, diamondslots::x, and diamondslots::y.

Referenced by find_doors_in_room(), find_monster_in_room(), find_spot_in_room(), keyplace(), place_chest(), place_exits(), place_treasure(), surround_by_doors(), and surround_flag4().

+ Here is the caller graph for this function:

◆ write_map_parameters_to_string()