 |
Crossfire Server, Trunk
1.75.0
|
Go to the documentation of this file.
47 for (i = 0; i < RP->
Xsize; i++) {
48 for (j = 0; j < RP->
Ysize; j++) {
52 printf(
"%c",
layout[i][j]);
194 for (i = 0; i < RP->
Xsize; i++) {
364 int Xsize_orig, Ysize_orig;
366 Xsize_orig = RP->
Xsize;
367 Ysize_orig = RP->
Ysize;
370 RP->
Xsize = Xsize_orig;
371 RP->
Ysize = Ysize_orig;
378 sym_maze = (
char **)calloc(
sizeof(
char *), RP->
Xsize);
379 for (i = 0; i < RP->
Xsize; i++) {
380 sym_maze[i] = (
char *)calloc(
sizeof(
char), RP->
Ysize);
384 for (i = 0; i < RP->
Xsize/2+1; i++)
385 for (j = 0; j < RP->
Ysize; j++) {
386 sym_maze[i][j] = maze[i][j];
387 sym_maze[RP->
Xsize-i-1][j] = maze[i][j];
390 for (i = 0; i < RP->
Xsize; i++)
391 for (j = 0; j < RP->
Ysize/2+1; j++) {
392 sym_maze[i][j] = maze[i][j];
393 sym_maze[i][RP->
Ysize-j-1] = maze[i][j];
396 for (i = 0; i < RP->
Xsize/2+1; i++)
397 for (j = 0; j < RP->
Ysize/2+1; j++) {
398 sym_maze[i][j] = maze[i][j];
399 sym_maze[i][RP->
Ysize-j-1] = maze[i][j];
400 sym_maze[RP->
Xsize-i-1][j] = maze[i][j];
401 sym_maze[RP->
Xsize-i-1][RP->
Ysize-j-1] = maze[i][j];
405 for (i = 0; i < Xsize_orig; i++) {
451 char *rotated =
static_cast<char *
>(malloc(
sizeof(
char)*RP->
Xsize*RP->
Ysize));
453 for (i = 0; i < RP->
Xsize; i++) {
454 for (j = 0; j < RP->
Ysize; j++) {
455 rotated[i*RP->
Ysize+j] = maze[i][j];
458 for (i = 0; i < RP->
Xsize; i++) {
459 for (j = 0; j < RP->
Ysize; j++) {
471 new_maze = (
char **)calloc(
sizeof(
char *), RP->
Ysize);
472 for (i = 0; i < RP->
Ysize; i++) {
473 new_maze[i] = (
char *)calloc(
sizeof(
char), RP->
Xsize);
476 for (i = 0; i < RP->
Xsize; i++)
477 for (j = 0; j < RP->
Ysize; j++) {
478 new_maze[j][i] = maze[i][j];
482 for (i = 0; i < RP->
Xsize; i++)
483 for (j = 0; j < RP->
Ysize; j++) {
484 new_maze[j][i] = maze[RP->
Xsize-i-1][RP->
Ysize-j-1];
489 for (i = 0; i < RP->
Xsize; i++) {
515 for (ti = 0; ti < tries; ti++) {
564 if (dx == 0 || dx == (RP->
Xsize-1) || dy == 0 || dy == (RP->
Ysize-1)) {
569 if (maze[dx][dy] != 0) {
577 for (i1 = dx-1; i1 > 0; i1--) {
586 if (maze[i1][y] != 0) {
592 for (i1 = dx+1; i1 < RP->
Xsize-1; i1++) {
601 if (maze[i1][y] != 0) {
611 for (i1 = dy-1; i1 > 0; i1--) {
620 if (maze[x][i1] != 0) {
626 for (i1 = dy+1; i1 < RP->
Ysize-1; i1++) {
635 if (maze[x][i1] != 0) {
665 for (i1 = x-1; maze[i1][y] == 0; i1--) {
668 for (i1 = x+1; maze[i1][y] == 0; i1++) {
677 for (i1 = y-1; maze[x][i1] == 0; i1--) {
680 for (i1 = y+1; maze[x][i1] == 0; i1++) {
705 doorlist_x =
static_cast<int *
>(malloc(
sizeof(
int)*RP->
Xsize*RP->
Ysize));
706 doorlist_y =
static_cast<int *
>(malloc(
sizeof(
int)*RP->
Xsize*RP->
Ysize));
710 for (i = 1; i < RP->
Xsize-1; i++)
711 for (j = 1; j < RP->
Ysize-1; j++) {
713 if (sindex == 3 || sindex == 12) {
715 doorlist_x[doorlocs] = i;
716 doorlist_y[doorlocs] = j;
721 while (ndoors > 0 && doorlocs > 0) {
729 if (sindex == 3 || sindex == 12) {
735 doorlist_x[di] = doorlist_x[doorlocs];
736 doorlist_y[di] = doorlist_y[doorlocs];
char ** map_gen_onion(int xsize, int ysize, int option, int layers)
Generates an onion layout.
mapstruct * generate_random_map(const char *OutFileName, RMParms *RP, char **use_layout, sstring reset_group)
Main random map routine.
char layoutstyle[RM_SIZE]
Contains the layout type to generate, see layoutgen() for valid types.
struct region * region
What jurisdiction in the game world this map is ruled by points to the struct containing all the prop...
char ** roguelike_layout_gen(int xsize, int ysize, int options, int _unused_layers)
Actually make the rogue layout.
uint16_t difficulty
What level the player should be to play here.
int difficulty_given
If non zero, this means the difficulty was not zero initially.
int multiple_floors
If non zero, then the map will have multiple floors, else only one floor will be used.
uint32_t outdoor
True if an outdoor map.
int make_wall(char **maze, int x, int y, int dir)
Cuts the layout horizontally or vertically by a wall with a door.
void stringbuffer_append_printf(StringBuffer *sb, const char *format,...)
Append a formatted string to a string buffer instance.
StringBuffer * stringbuffer_new(void)
Create a new string buffer.
char ** make_square_spiral_layout(int xsize, int ysize, int _unused_options, int _unused_layers)
Generates a square-spiral layout.
non standard information is not specified or uptime this means how long since the executable has been started A particular host may have been running a server for quite a long time
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,...
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 ...
#define OPT_WALLS_ONLY
Only walls.
void roomify_layout(char **maze, RMParms *RP)
Take a layout and make some rooms in it.
char path[HUGE_BUF]
Filename of the map.
char ** map_gen_spiral(int xsize, int ysize, int option, int _unused_layers)
Generates a spiral layout.
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.
void unblock_exits(mapstruct *map, char **maze, RMParms *RP)
This function unblocks the exits.
void set_darkness_map(mapstruct *m)
Set the darkness level for a map, based on the time of the day.
char * stringbuffer_finish(StringBuffer *sb)
Deallocate the string buffer instance and return the string.
void apply_auto_fix(mapstruct *m)
Go through the entire map (only the first time when an original map is loaded) and performs special a...
#define SQUARE_SPIRAL_LAYOUT
void place_specials_in_map(mapstruct *map, char **layout, RMParms *RP)
Main function for specials.
StringBuffer * write_map_parameters_to_string(const RMParms *RP)
Creates a suitable message for exit from RP.
char this_map[RM_SIZE]
Path of the map from which the random map(s) were created.
char decorstyle[RM_SIZE]
Name of the decor style file, in /styles/decorstyles, can be an empty string in which case a random o...
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.
int darkness
Map darkness.
char final_map[RM_SIZE]
If not empty, the path of the final map this whole maze leads to.
void dump_layout(char **layout, RMParms *RP)
Dumps specified layout using printf().
sstring add_string(const char *str)
This will add 'str' to the hash table.
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.
int change_map_light(mapstruct *m, int change)
Used to change map light level (darkness) up or down.
#define MIN_RANDOM_MAP_SIZE
Minimal size a random should have to actually be generated.
void doorify_layout(char **maze, RMParms *RP)
Puts doors at appropriate locations in a layout.
#define NO_SYM
No symmetry.
char ** expand2x(char **layout, int xsize, int ysize)
Expands the layout be a factor 2.
char ** rotate_layout(char **maze, int rotation, RMParms *RP)
Takes a map and rotates it.
sstring reset_group
For reset purpose, all maps in the same group reset at the same time.
char wallstyle[RM_SIZE]
Name of the wall style file, in /styles/wallstyles, can be an empty string in which case a random one...
char doorstyle[RM_SIZE]
Name of the doors style file, in /styles/doorstyles, see put_doors().
long last_reset_time
A timestamp of the last original map loading.
long seconds(void)
Return wall clock time in seconds.
#define X_SYM
Vertical symmetry.
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.
A buffer that will be expanded as content is added to it.
char final_exit_archetype[RM_SIZE]
If not empty, the archetype name of the exit leading to the final map.
void place_treasure(mapstruct *map, char **layout, char *treasure_style, int treasureoptions, RMParms *RP)
Place treasures in the map.
void connect_spirals(int xsize, int ysize, int sym, char **layout)
Connects disjoint spirals which may result from the symmetrization process.
char cheststyle[RM_SIZE]
Name of the chests style file, in /styles/cheststyles, can be an empty string in which case a random ...
int outdoor
Whether generated map is outdoor or not.
const typedef char * sstring
void place_exits(mapstruct *map, char **maze, char *exitstyle, int orientation, RMParms *RP)
Place exits in the map.
void put_doors(mapstruct *the_map, char **maze, const char *doorstyle, RMParms *RP)
Add doors to a map.
void place_monsters(mapstruct *map, char *monsterstyle, int difficulty, RMParms *RP)
Place some monsters into the map.
char exit_on_final_map[RM_SIZE]
If this is "no", then no exit will be made to the final map from the previous random map.
char treasurestyle[RM_SIZE]
Name of the treasures style file, in /styles/treasurestyles, can be an empty string in which case a r...
char dungeon_name[RM_SIZE]
If not empty, will be used in the name of the random keys.
char ** make_snake_layout(int xsize, int ysize, int _unused_options, int _unused_layers)
Generate a snake-like layout.
mapstruct * make_map_floor(char **layout, char *floorstyle, RMParms *RP)
Creates the Crossfire mapstruct object from the layout, and adds the floor.
char floorstyle[RM_SIZE]
Name of the floor style file, in /styles/floors, can be an empty string in which case a random one is...
char * msg
Message map creator may have left.
void put_decor(mapstruct *map, char **maze, char *decorstyle, int decor_option, RMParms *RP)
Put the decor into the map.
char monsterstyle[RM_SIZE]
Name of the monster style directory, in /styles/monsters, can be an empty string in which case a rand...
int calculate_difficulty(mapstruct *m)
This routine is supposed to find out the difficulty of the map.
#define XY_SYM
Reflection.
char exitstyle[RM_SIZE]
Name of the exit style files, in /styles/exitstyles/{up,down}, can be an empty string in which case a...
#define Y_SYM
Horizontal symmetry.
bool link_source_map
Whether to set the reset group (if not already defined) of the source map for this random map.
float difficulty_increase
char ** layoutgen(RMParms *RP)
This function builds the actual layout.
#define RANDOM_SYM
Random symmetry.