--- deliantra/server/random_maps/exit.C 2010/03/28 22:29:50 1.40 +++ deliantra/server/random_maps/exit.C 2010/07/02 15:03:57 1.45 @@ -27,10 +27,10 @@ #include #include -/* find a character in the layout. fx and fy are pointers to +/* find a character in the maze. fx and fy are pointers to where to find the char. fx,fy = -1 if not found. */ static void -find_in_layout (int mode, char target, int *fx, int *fy, char **layout, random_map_params *RP) +find_in_layout (int mode, char target, int *fx, int *fy, char **maze, random_map_params *RP) { int M; int i, j; @@ -54,7 +54,7 @@ for (i = 1; i < RP->Xsize; i++) for (j = 1; j < RP->Ysize; j++) { - if (layout[i][j] == target) + if (maze[i][j] == target) { *fx = i; *fy = j; @@ -68,7 +68,7 @@ for (i = RP->Xsize - 2; i > 0; i--) for (j = 1; j < RP->Ysize - 1; j++) { - if (layout[i][j] == target) + if (maze[i][j] == target) { *fx = i; *fy = j; @@ -82,7 +82,7 @@ for (i = 1; i < RP->Xsize - 1; i++) for (j = RP->Ysize - 2; j > 0; j--) { - if (layout[i][j] == target) + if (maze[i][j] == target) { *fx = i; *fy = j; @@ -96,7 +96,7 @@ for (i = RP->Xsize - 2; i > 0; i--) for (j = RP->Ysize - 2; j > 0; j--) { - if (layout[i][j] == target) + if (maze[i][j] == target) { *fx = i; *fy = j; @@ -117,7 +117,7 @@ 6 means southward */ void -place_exits (maptile *map, char **maze, char *exitstyle, int orientation, random_map_params *RP) +place_exits (maptile *map, char **maze, const char *exitstyle, int orientation, random_map_params *RP) { maptile *style_map_down = 0; /* harder maze */ maptile *style_map_up = 0; /* easier maze */ @@ -139,22 +139,22 @@ { case 1: { - style_map_up = find_style ("/styles/exitstyles/up" , exitstyle, -1); - style_map_down = find_style ("/styles/exitstyles/down", exitstyle, -1); + style_map_up = find_style ("/styles/exitstyles/up" , exitstyle, RP->difficulty); + style_map_down = find_style ("/styles/exitstyles/down", exitstyle, RP->difficulty); break; } case 2: { - style_map_up = find_style ("/styles/exitstyles/down", exitstyle, -1); - style_map_down = find_style ("/styles/exitstyles/up" , exitstyle, -1); + style_map_up = find_style ("/styles/exitstyles/down", exitstyle, RP->difficulty); + style_map_down = find_style ("/styles/exitstyles/up" , exitstyle, RP->difficulty); break; } default: { style_map_up = - style_map_down = find_style ("/styles/exitstyles/generic", exitstyle, -1); + style_map_down = find_style ("/styles/exitstyles/generic", exitstyle, RP->difficulty); break; } } @@ -278,15 +278,13 @@ if (the_exit_down) { - char buf[16384]; - - int i = find_free_spot (the_exit_down, map, downx, downy, 1, SIZEOFFREE1 + 1); + int i = rmg_find_free_spot (the_exit_down, map, downx, downy, 1, SIZEOFFREE1 + 1); the_exit_down->x = downx + freearr_x[i]; the_exit_down->y = downy + freearr_y[i]; RP->origin_x = the_exit_down->x; RP->origin_y = the_exit_down->y; - write_map_parameters_to_string (buf, RP); - the_exit_down->msg = buf; + + the_exit_down->msg = RP->as_shstr (); /* the identifier for making a random map. */ if (RP->dungeon_level >= RP->dungeon_depth && *RP->final_map)