Crossfire Server, Branches 1.12  R18729
wall.c File Reference
#include <global.h>
#include <random_map.h>
#include <rproto.h>
+ Include dependency graph for wall.c:

Go to the source code of this file.

Functions

void make_map_walls (mapstruct *map, char **layout, char *w_style, RMParms *RP)
 
objectpick_joined_wall (object *the_wall, char **layout, int i, int j, RMParms *RP)
 
objectretrofit_joined_wall (mapstruct *the_map, int i, int j, int insert_flag, RMParms *RP)
 
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)
 

Detailed Description

Deals with wall management in random maps.

Definition in file wall.c.

Function Documentation

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 180 of file wall.c.

References obj::arch, arch_to_object(), find_style(), INS_NO_MERGE, INS_NO_WALK_ON, insert_ob_in_map(), MOVE_ALL, obj::move_allow, obj::move_block, archt::name, pick_joined_wall(), pick_random_object(), snprintf(), RMParms::wall_name, obj::x, RMParms::Xsize, obj::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:

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 241 of file wall.c.

References obj::arch, arch_to_object(), archt::name, surround_flag2(), and try_find_archetype().

Referenced by make_map_walls().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 362 of file wall.c.

References obj::above, arch_to_object(), DOOR, EXIT, free_object(), GET_MAP_OB, INS_NO_MERGE, INS_NO_WALK_ON, insert_ob_in_map(), LOCKED_DOOR, obj::map, MOVE_ALL, obj::move_block, obj::move_type, MOVE_WALK, remove_ob(), surround_flag4(), TELEPORTER, try_find_archetype(), obj::type, RMParms::wall_name, obj::x, and obj::y.

Referenced by lock_and_hide_doors().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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 56 of file wall.c.

Referenced by doorify_layout().

+ Here is the caller graph for this function:

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 88 of file wall.c.

Referenced by can_make_wall(), and pick_joined_wall().

+ Here is the caller graph for this function:

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 120 of file wall.c.

References GET_MAP_MOVE_BLOCK, and MOVE_BLOCK_DEFAULT.

Referenced by find_enclosed_spot().

+ Here is the caller graph for this function:

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 153 of file wall.c.

References wall_blocked().

Referenced by retrofit_joined_wall().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: