Crossfire Server, Trunk
exit.cpp File Reference
#include "global.h"
#include <stdlib.h>
#include <string.h>
#include "random_map.h"
#include "rproto.h"
#include "sproto.h"
+ Include dependency graph for exit.cpp:

Go to the source code of this file.

Functions

void find_in_layout (int mode, char target, int *fx, int *fy, char **layout, RMParms *RP)
 
void place_exits (mapstruct *map, char **maze, char *exitstyle, int orientation, RMParms *RP)
 
void unblock_exits (mapstruct *map, char **maze, RMParms *RP)
 

Detailed Description

Handle exit placement in map.

Definition in file exit.cpp.

Function Documentation

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

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

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