--- deliantra/server/random_maps/random_map.C 2006/09/10 16:06:37 1.3 +++ deliantra/server/random_maps/random_map.C 2006/12/30 10:16:11 1.10 @@ -1,9 +1,3 @@ - -/* - * static char *rcsid_random_map_c = - * "$Id: random_map.C,v 1.3 2006/09/10 16:06:37 root Exp $"; - */ - /* CrossFire, A Multiplayer game for X-windows @@ -24,7 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - The authors can be reached via e-mail at crossfire-devel@real-time.com + The authors can be reached via e-mail at */ #include @@ -57,12 +51,14 @@ } printf ("\n"); } -EXTERN FILE *logfile; -mapstruct * + +extern FILE *logfile; + +maptile * generate_random_map (const char *OutFileName, RMParms * RP) { char **layout, buf[HUGE_BUF]; - mapstruct *theMap; + maptile *theMap; int i; /* pick a random seed, or use the one from the input file */ @@ -76,18 +72,19 @@ if (RP->difficulty == 0) { RP->difficulty = RP->dungeon_level; /* use this instead of a map difficulty */ + if (RP->difficulty_increase > 0.001) - { - RP->difficulty = (int) ((float) RP->dungeon_level * RP->difficulty_increase); - if (RP->difficulty < 1) - RP->difficulty = 1; - } + RP->difficulty = (int) ((float) RP->dungeon_level * RP->difficulty_increase); + + if (RP->difficulty < 1) + RP->difficulty = 1; } else RP->difficulty_given = 1; if (RP->Xsize < MIN_RANDOM_MAP_SIZE) RP->Xsize = MIN_RANDOM_MAP_SIZE + RANDOM () % 25 + 5; + if (RP->Ysize < MIN_RANDOM_MAP_SIZE) RP->Ysize = MIN_RANDOM_MAP_SIZE + RANDOM () % 25 + 5; @@ -118,7 +115,7 @@ theMap = make_map_floor (layout, RP->floorstyle, RP); /* set the name of the map. */ - strcpy (theMap->path, OutFileName); + theMap->path = OutFileName; /* set region */ theMap->region = RP->region; @@ -145,7 +142,7 @@ place_monsters (theMap, RP->monsterstyle, RP->difficulty, RP); /* treasures needs to have a proper difficulty set for the map. */ - theMap->difficulty = calculate_difficulty (theMap); + theMap->difficulty = theMap->estimate_difficulty (); /* create treasure unless the treasurestyle is "none" */ if (strcmp (RP->treasurestyle, "none")) @@ -165,12 +162,11 @@ free (layout[i]); free (layout); - theMap->msg = strdup_local (buf); + theMap->msg = strdup (buf); return theMap; } - /* function selects the layout function and gives it whatever arguments it needs. */ char ** @@ -998,12 +994,12 @@ { object *walk, *tmp; - copy_object (src_ob, dest_ob); + src_ob->copy_to (dest_ob); for (walk = src_ob->inv; walk != NULL; walk = walk->below) { - tmp = get_object (); - copy_object (walk, tmp); + tmp = object::create (); + walk->copy_to (tmp); insert_ob_in_ob (tmp, dest_ob); } }