ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/random_map.C
(Generate patch)

Comparing deliantra/server/random_maps/random_map.C (file contents):
Revision 1.45 by root, Sat Nov 7 18:30:05 2009 UTC vs.
Revision 1.49 by root, Tue Apr 13 02:39:53 2010 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2001 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 9 * the terms of the Affero GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version. 11 * option) any later version.
358 { 358 {
359 sprintf (small_buf, "wallstyle %s\n", RP->wallstyle); 359 sprintf (small_buf, "wallstyle %s\n", RP->wallstyle);
360 strcat (buf, small_buf); 360 strcat (buf, small_buf);
361 } 361 }
362 362
363 if (RP->miningstyle[0])
364 {
365 sprintf (small_buf, "miningstyle %s\n", RP->miningstyle);
366 strcat (buf, small_buf);
367 }
368
363 if (RP->floorstyle[0]) 369 if (RP->floorstyle[0])
364 { 370 {
365 sprintf (small_buf, "floorstyle %s\n", RP->floorstyle); 371 sprintf (small_buf, "floorstyle %s\n", RP->floorstyle);
366 strcat (buf, small_buf); 372 strcat (buf, small_buf);
367 } 373 }
508 } 514 }
509 515
510 if (RP->custom) 516 if (RP->custom)
511 { 517 {
512 sprintf (small_buf, "custom %s\n", RP->custom); 518 sprintf (small_buf, "custom %s\n", RP->custom);
513 strcat (buf, small_buf);
514 }
515}
516
517void
518write_parameters_to_string (char *buf,
519 int xsize_n,
520 int ysize_n,
521 const char *wallstyle_n,
522 const char *floorstyle_n,
523 const char *monsterstyle_n,
524 const char *treasurestyle_n,
525 const char *layoutstyle_n,
526 const char *decorstyle_n,
527 const char *doorstyle_n,
528 const char *exitstyle_n,
529 const char *final_map_n,
530 const char *exit_on_final_map_n,
531 const char *this_map_n,
532 int layoutoptions1_n,
533 int layoutoptions2_n,
534 int layoutoptions3_n,
535 int symmetry_n,
536 int dungeon_depth_n,
537 int dungeon_level_n,
538 int difficulty_n,
539 int difficulty_given_n,
540 int decoroptions_n,
541 int orientation_n,
542 int origin_x_n,
543 int origin_y_n,
544 uint32_t random_seed_n,
545 int treasureoptions_n,
546 float difficulty_increase)
547{
548 char small_buf[16384];
549
550 sprintf (buf, "xsize %d\nysize %d\n", xsize_n, ysize_n);
551
552 if (wallstyle_n && wallstyle_n[0])
553 {
554 sprintf (small_buf, "wallstyle %s\n", wallstyle_n);
555 strcat (buf, small_buf);
556 }
557
558 if (floorstyle_n && floorstyle_n[0])
559 {
560 sprintf (small_buf, "floorstyle %s\n", floorstyle_n);
561 strcat (buf, small_buf);
562 }
563
564 if (monsterstyle_n && monsterstyle_n[0])
565 {
566 sprintf (small_buf, "monsterstyle %s\n", monsterstyle_n);
567 strcat (buf, small_buf);
568 }
569
570 if (treasurestyle_n && treasurestyle_n[0])
571 {
572 sprintf (small_buf, "treasurestyle %s\n", treasurestyle_n);
573 strcat (buf, small_buf);
574 }
575
576 if (layoutstyle_n && layoutstyle_n[0])
577 {
578 sprintf (small_buf, "layoutstyle %s\n", layoutstyle_n);
579 strcat (buf, small_buf);
580 }
581
582 if (decorstyle_n && decorstyle_n[0])
583 {
584 sprintf (small_buf, "decorstyle %s\n", decorstyle_n);
585 strcat (buf, small_buf);
586 }
587
588 if (doorstyle_n && doorstyle_n[0])
589 {
590 sprintf (small_buf, "doorstyle %s\n", doorstyle_n);
591 strcat (buf, small_buf);
592 }
593
594 if (exitstyle_n && exitstyle_n[0])
595 {
596 sprintf (small_buf, "exitstyle %s\n", exitstyle_n);
597 strcat (buf, small_buf);
598 }
599
600 if (final_map_n && final_map_n[0])
601 {
602 sprintf (small_buf, "final_map %s\n", final_map_n);
603 strcat (buf, small_buf);
604 }
605
606 if (exit_on_final_map_n && exit_on_final_map_n[0])
607 {
608 sprintf (small_buf, "exit_on_final_map %s\n", exit_on_final_map_n);
609 strcat (buf, small_buf);
610 }
611
612 if (this_map_n && this_map_n[0])
613 {
614 sprintf (small_buf, "origin_map %s\n", this_map_n);
615 strcat (buf, small_buf);
616 }
617
618 if (layoutoptions1_n)
619 {
620 sprintf (small_buf, "layoutoptions1 %d\n", layoutoptions1_n);
621 strcat (buf, small_buf);
622 }
623
624 if (layoutoptions2_n)
625 {
626 sprintf (small_buf, "layoutoptions2 %d\n", layoutoptions2_n);
627 strcat (buf, small_buf);
628 }
629
630
631 if (layoutoptions3_n)
632 {
633 sprintf (small_buf, "layoutoptions3 %d\n", layoutoptions3_n);
634 strcat (buf, small_buf);
635 }
636
637 if (symmetry_n)
638 {
639 sprintf (small_buf, "symmetry %d\n", symmetry_n);
640 strcat (buf, small_buf);
641 }
642
643
644 if (difficulty_n && difficulty_given_n)
645 {
646 sprintf (small_buf, "difficulty %d\n", difficulty_n);
647 strcat (buf, small_buf);
648 }
649
650 if (difficulty_increase > 0.001)
651 {
652 sprintf (small_buf, "difficulty_increase %f\n", difficulty_increase);
653 strcat (buf, small_buf);
654 }
655
656 sprintf (small_buf, "dungeon_level %d\n", dungeon_level_n);
657 strcat (buf, small_buf);
658
659 if (dungeon_depth_n)
660 {
661 sprintf (small_buf, "dungeon_depth %d\n", dungeon_depth_n);
662 strcat (buf, small_buf);
663 }
664
665 if (decoroptions_n)
666 {
667 sprintf (small_buf, "decoroptions %d\n", decoroptions_n);
668 strcat (buf, small_buf);
669 }
670
671 if (orientation_n)
672 {
673 sprintf (small_buf, "orientation %d\n", orientation_n);
674 strcat (buf, small_buf);
675 }
676
677 if (origin_x_n)
678 {
679 sprintf (small_buf, "origin_x %d\n", origin_x_n);
680 strcat (buf, small_buf);
681 }
682
683 if (origin_y_n)
684 {
685 sprintf (small_buf, "origin_y %d\n", origin_y_n);
686 strcat (buf, small_buf);
687 }
688
689 if (random_seed_n)
690 {
691 /* Add one so that the next map is a bit different */
692 sprintf (small_buf, "random_seed %u\n", random_seed_n + 1);
693 strcat (buf, small_buf);
694 }
695
696 if (treasureoptions_n)
697 {
698 sprintf (small_buf, "treasureoptions %d\n", treasureoptions_n);
699 strcat (buf, small_buf); 519 strcat (buf, small_buf);
700 } 520 }
701} 521}
702 522
703///////////////////////////////////////////////////////////////////////////// 523/////////////////////////////////////////////////////////////////////////////
919 CEDE; 739 CEDE;
920 740
921 /* create walls unless the wallstyle is "none" */ 741 /* create walls unless the wallstyle is "none" */
922 if (strcmp (RP->wallstyle, "none")) 742 if (strcmp (RP->wallstyle, "none"))
923 { 743 {
924 make_map_walls (this, layout, RP->wallstyle, RP); 744 make_map_walls (this, layout, RP->wallstyle, RP->miningstyle, RP);
925 745
926 /* place doors unless doorstyle or wallstyle is "none" */ 746 /* place doors unless doorstyle or wallstyle is "none" */
927 if (strcmp (RP->doorstyle, "none")) 747 if (strcmp (RP->doorstyle, "none"))
928 put_doors (this, layout, RP->doorstyle, RP); 748 put_doors (this, layout, RP->doorstyle, RP);
929 } 749 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines