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.11 by root, Sat Dec 30 18:45:28 2006 UTC vs.
Revision 1.12 by root, Sun Dec 31 17:17:23 2006 UTC

158 unblock_exits (theMap, layout, RP); 158 unblock_exits (theMap, layout, RP);
159 159
160 /* free the layout */ 160 /* free the layout */
161 for (i = 0; i < RP->Xsize; i++) 161 for (i = 0; i < RP->Xsize; i++)
162 free (layout[i]); 162 free (layout[i]);
163
163 free (layout); 164 free (layout);
164 165
165 theMap->msg = strdup (buf); 166 theMap->msg = strdup (buf);
167 theMap->in_memory = MAP_IN_MEMORY;
166 168
167 return theMap; 169 return theMap;
168} 170}
169 171
170/* function selects the layout function and gives it whatever 172/* function selects the layout function and gives it whatever
570 572
571 return 0; 573 return 0;
572} 574}
573 575
574/* puts doors at appropriate locations in a layout. */ 576/* puts doors at appropriate locations in a layout. */
575
576void 577void
577doorify_layout (char **maze, random_map_params * RP) 578doorify_layout (char **maze, random_map_params * RP)
578{ 579{
579 int ndoors = RP->Xsize * RP->Ysize / 60; /* reasonable number of doors. */ 580 int ndoors = RP->Xsize * RP->Ysize / 60; /* reasonable number of doors. */
580 char *doorlist_x; 581 char *doorlist_x;
597 doorlist_x[doorlocs] = i; 598 doorlist_x[doorlocs] = i;
598 doorlist_y[doorlocs] = j; 599 doorlist_y[doorlocs] = j;
599 doorlocs++; 600 doorlocs++;
600 } 601 }
601 } 602 }
603
602 while (ndoors > 0 && doorlocs > 0) 604 while (ndoors > 0 && doorlocs > 0)
603 { 605 {
604 int di; 606 int di;
605 int sindex; 607 int sindex;
606 608
616 /* reduce the size of the list */ 618 /* reduce the size of the list */
617 doorlocs--; 619 doorlocs--;
618 doorlist_x[di] = doorlist_x[doorlocs]; 620 doorlist_x[di] = doorlist_x[doorlocs];
619 doorlist_y[di] = doorlist_y[doorlocs]; 621 doorlist_y[di] = doorlist_y[doorlocs];
620 } 622 }
623
621 free (doorlist_x); 624 free (doorlist_x);
622 free (doorlist_y); 625 free (doorlist_y);
623} 626}
624
625 627
626void 628void
627write_map_parameters_to_string (char *buf, random_map_params * RP) 629write_map_parameters_to_string (char *buf, random_map_params * RP)
628{ 630{
629 char small_buf[256]; 631 char small_buf[256];
890 { 892 {
891 sprintf (small_buf, "layoutoptions1 %d\n", layoutoptions1_n); 893 sprintf (small_buf, "layoutoptions1 %d\n", layoutoptions1_n);
892 strcat (buf, small_buf); 894 strcat (buf, small_buf);
893 } 895 }
894 896
895
896 if (layoutoptions2_n) 897 if (layoutoptions2_n)
897 { 898 {
898 sprintf (small_buf, "layoutoptions2 %d\n", layoutoptions2_n); 899 sprintf (small_buf, "layoutoptions2 %d\n", layoutoptions2_n);
899 strcat (buf, small_buf); 900 strcat (buf, small_buf);
900 } 901 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines