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

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)
 

Variables

static const char * wall_join [16]
 

Function Documentation

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

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

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

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

Variable Documentation

◆ wall_join

const char* wall_join[16]
static
Initial value:
= {
"_0", "_1_3", "_1_4", "_2_1_2",
"_1_2", "_2_2_4", "_2_2_1", "_3_1",
"_1_1", "_2_2_3", "_2_2_2", "_3_3",
"_2_1_1", "_3_4", "_3_2", "_4"
}

Suffix to add to a base wall archetype name to get the joined wall based on the value returned by surround_flag2().

Definition at line 232 of file wall.cpp.

Referenced by pick_joined_wall(), and retrofit_joined_wall().