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.15 by root, Sun Dec 31 20:48:27 2006 UTC vs.
Revision 1.18 by root, Thu Jan 11 00:41:08 2007 UTC

1
2/* 1/*
3 CrossFire, A Multiplayer game for X-windows 2 CrossFire, A Multiplayer game for X-windows
4 3
4 Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
5 Copyright (C) 2001 Mark Wedel & Crossfire Development Team 5 Copyright (C) 2001 Mark Wedel & Crossfire Development Team
6 Copyright (C) 1992 Frank Tore Johansen 6 Copyright (C) 1992 Frank Tore Johansen
7 7
8 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
54} 54}
55 55
56maptile * 56maptile *
57generate_random_map (const char *OutFileName, random_map_params *RP) 57generate_random_map (const char *OutFileName, random_map_params *RP)
58{ 58{
59 char **layout, buf[HUGE_BUF]; 59 char **layout, buf[16384];
60 maptile *theMap; 60 maptile *theMap;
61 int i; 61 int i;
62 62
63 /* pick a random seed, or use the one from the input file */ 63 /* pick a random seed, or use the one from the input file */
64 SRANDOM (RP->random_seed ? RP->random_seed + RP->dungeon_level : time (0)); 64 SRANDOM (RP->random_seed ? RP->random_seed + RP->dungeon_level : time (0));
631} 631}
632 632
633void 633void
634write_map_parameters_to_string (char *buf, random_map_params *RP) 634write_map_parameters_to_string (char *buf, random_map_params *RP)
635{ 635{
636 char small_buf[2048]; 636 char small_buf[16384];
637 637
638 sprintf (buf, "xsize %d\nysize %d\n", RP->Xsize, RP->Ysize); 638 sprintf (buf, "xsize %d\nysize %d\n", RP->Xsize, RP->Ysize);
639 639
640 if (RP->wallstyle[0]) 640 if (RP->wallstyle[0])
641 { 641 {
776 { 776 {
777 sprintf (small_buf, "origin_y %d\n", RP->origin_y); 777 sprintf (small_buf, "origin_y %d\n", RP->origin_y);
778 strcat (buf, small_buf); 778 strcat (buf, small_buf);
779 } 779 }
780 780
781 if (RP->treasureoptions)
782 {
783 sprintf (small_buf, "treasureoptions %d\n", RP->treasureoptions);
784 strcat (buf, small_buf);
785 }
786
781 if (RP->random_seed) 787 if (RP->random_seed)
782 { 788 {
783 /* Add one so that the next map is a bit different */
784 sprintf (small_buf, "random_seed %d\n", RP->random_seed + 1);
785 strcat (buf, small_buf);
786 }
787
788 if (RP->treasureoptions)
789 {
790 sprintf (small_buf, "treasureoptions %d\n", RP->treasureoptions);
791 strcat (buf, small_buf);
792 }
793
794 if (RP->random_seed)
795 {
796 sprintf (small_buf, "random_seed %d\n", RP->random_seed); 789 sprintf (small_buf, "random_seed %d\n", RP->random_seed);
790 strcat (buf, small_buf);
791 }
792
793 if (RP->custom)
794 {
795 sprintf (small_buf, "custom %s\n", RP->custom);
797 strcat (buf, small_buf); 796 strcat (buf, small_buf);
798 } 797 }
799} 798}
800 799
801void 800void
823 int difficulty_given_n, 822 int difficulty_given_n,
824 int decoroptions_n, 823 int decoroptions_n,
825 int orientation_n, 824 int orientation_n,
826 int origin_x_n, int origin_y_n, int random_seed_n, int treasureoptions_n, float difficulty_increase) 825 int origin_x_n, int origin_y_n, int random_seed_n, int treasureoptions_n, float difficulty_increase)
827{ 826{
828 char small_buf[2048]; 827 char small_buf[16384];
829 828
830 sprintf (buf, "xsize %d\nysize %d\n", xsize_n, ysize_n); 829 sprintf (buf, "xsize %d\nysize %d\n", xsize_n, ysize_n);
831 830
832 if (wallstyle_n && wallstyle_n[0]) 831 if (wallstyle_n && wallstyle_n[0])
833 { 832 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines