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.40 by root, Thu May 8 11:39:24 2008 UTC vs.
Revision 1.41 by root, Thu May 8 13:47:19 2008 UTC

543void 543void
544doorify_layout (char **maze, random_map_params *RP) 544doorify_layout (char **maze, random_map_params *RP)
545{ 545{
546 int ndoors = RP->Xsize * RP->Ysize / 60; /* reasonable number of doors. */ 546 int ndoors = RP->Xsize * RP->Ysize / 60; /* reasonable number of doors. */
547 int doorlocs = 0; /* # of available doorlocations */ 547 int doorlocs = 0; /* # of available doorlocations */
548 int i, j;
549 548
550 char *doorlist_x = salloc<char> (RP->Xsize * RP->Ysize); 549 uint16 *doorlist_x = salloc<uint16> (RP->Xsize * RP->Ysize);
551 char *doorlist_y = salloc<char> (RP->Xsize * RP->Ysize); 550 uint16 *doorlist_y = salloc<uint16> (RP->Xsize * RP->Ysize);
552 551
553 /* make a list of possible door locations */ 552 /* make a list of possible door locations */
554 for (i = 1; i < RP->Xsize - 1; i++) 553 for (int i = 1; i < RP->Xsize - 1; i++)
555 for (j = 1; j < RP->Ysize - 1; j++) 554 for (int j = 1; j < RP->Ysize - 1; j++)
556 { 555 {
557 int sindex = surround_flag (maze, i, j, RP); 556 int sindex = surround_flag (maze, i, j, RP);
558 557
559 if (sindex == 3 || sindex == 12) /* these are possible door sindex */ 558 if (sindex == 3 || sindex == 12) /* these are possible door sindex */
560 { 559 {
564 } 563 }
565 } 564 }
566 565
567 while (ndoors > 0 && doorlocs > 0) 566 while (ndoors > 0 && doorlocs > 0)
568 { 567 {
569 int di;
570 int sindex;
571
572 di = rmg_rndm (doorlocs); 568 int di = rmg_rndm (doorlocs);
573 i = doorlist_x[di]; 569 int i = doorlist_x[di];
574 j = doorlist_y[di]; 570 int j = doorlist_y[di];
575 sindex = surround_flag (maze, i, j, RP); 571 int sindex = surround_flag (maze, i, j, RP);
576 572
577 if (sindex == 3 || sindex == 12) /* these are possible door sindex */ 573 if (sindex == 3 || sindex == 12) /* these are possible door sindex */
578 { 574 {
579 maze[i][j] = 'D'; 575 maze[i][j] = 'D';
580 ndoors--; 576 ndoors--;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines