… | |
… | |
467 | rp.origin_y = exit_ob->y; |
467 | rp.origin_y = exit_ob->y; |
468 | strcpy (rp.origin_map, pl->map->path); |
468 | strcpy (rp.origin_map, pl->map->path); |
469 | |
469 | |
470 | /* If we have a final_map, use it as a base name to give some clue |
470 | /* If we have a final_map, use it as a base name to give some clue |
471 | * as where the player is. Otherwise, use the origin map. |
471 | * as where the player is. Otherwise, use the origin map. |
472 | * Take the last component (after the last slash) to give |
|
|
473 | * shorter names without bogus slashes. |
|
|
474 | */ |
472 | */ |
475 | if (rp.final_map[0]) |
473 | sprintf (newmap_name, "/random%s+%04d", |
476 | { |
474 | *rp.final_map ? rp.final_map : rp.origin_map, |
477 | cp = strrchr (rp.final_map, '/'); |
475 | reference_number++); |
478 | if (!cp) |
|
|
479 | cp = rp.final_map; |
|
|
480 | } |
|
|
481 | else |
|
|
482 | { |
|
|
483 | char buf[HUGE_BUF]; |
|
|
484 | |
|
|
485 | cp = strrchr (rp.origin_map, '/'); |
|
|
486 | if (!cp) |
|
|
487 | cp = rp.origin_map; |
|
|
488 | /* Need to strip of any trailing digits, if it has them */ |
|
|
489 | strcpy (buf, cp); |
|
|
490 | while (isdigit (buf[strlen (buf) - 1])) |
|
|
491 | buf[strlen (buf) - 1] = 0; |
|
|
492 | cp = buf; |
|
|
493 | } |
|
|
494 | |
|
|
495 | sprintf (newmap_name, "/random/%s%04d", cp + 1, reference_number++); |
|
|
496 | |
476 | |
497 | /* now to generate the actual map. */ |
477 | /* now to generate the actual map. */ |
498 | new_map = generate_random_map (newmap_name, &rp); |
478 | new_map = generate_random_map (newmap_name, &rp); |
499 | |
479 | |
500 | /* Update the exit_ob so it now points directly at the newly created |
480 | /* Update the exit_ob so it now points directly at the newly created |