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

Comparing deliantra/server/random_maps/treasure.C (file contents):
Revision 1.19 by root, Wed Jan 17 12:36:31 2007 UTC vs.
Revision 1.21 by root, Thu Jan 18 19:42:10 2007 UTC

1/* 1/*
2<<<<<<< treasure.C
3 * CrossFire, A Multiplayer game 2 * CrossFire, A Multiplayer game
4 * 3 *
5 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team 4 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
6 * Copyright (C) 2001 Mark Wedel & Crossfire Development Team 5 * Copyright (C) 2001 Mark Wedel & Crossfire Development Team
7 * Copyright (C) 1992 Frank Tore Johansen 6 * Copyright (C) 1992 Frank Tore Johansen
20 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 * 21 *
23 * The authors can be reached via e-mail at <crossfire@schmorp.de> 22 * The authors can be reached via e-mail at <crossfire@schmorp.de>
24 */ 23 */
25=======
26 * CrossFire, A Multiplayer game for X-windows
27 *
28 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
29 * Copyright (C) 2001 Mark Wedel & Crossfire Development Team
30 * Copyright (C) 1992 Frank Tore Johansen
31 *
32 * This program is free software; you can redistribute it and/or modify
33 * it under the terms of the GNU General Public License as published by
34 * the Free Software Foundation; either version 2 of the License, or
35 * (at your option) any later version.
36 *
37 * This program is distributed in the hope that it will be useful,
38 * but WITHOUT ANY WARRANTY; without even the implied warranty of
39 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
40 * GNU General Public License for more details.
41 *
42 * You should have received a copy of the GNU General Public License
43 * along with this program; if not, write to the Free Software
44 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
45 *
46 * The authors can be reached via e-mail at <crossfire@schmorp.de>
47 */
48>>>>>>> 1.18
49 24
50/* placing treasure in maps, where appropriate. */ 25/* placing treasure in maps, where appropriate. */
51 26
52#include <global.h> 27#include <global.h>
53#include <random_map.h> 28#include <random_map.h>
105 treasureoptions = RANDOM () % (2 * LAST_OPTION); 80 treasureoptions = RANDOM () % (2 * LAST_OPTION);
106 81
107 /* filter out the mutually exclusive options */ 82 /* filter out the mutually exclusive options */
108 if ((treasureoptions & RICH) && (treasureoptions & SPARSE)) 83 if ((treasureoptions & RICH) && (treasureoptions & SPARSE))
109 { 84 {
110 if (RANDOM () % 2) 85 if (rndm (2))
111 treasureoptions -= 1; 86 treasureoptions -= 1;
112 else 87 else
113 treasureoptions -= 2; 88 treasureoptions -= 2;
114 } 89 }
115 90
488 return theMonsterToFind; 463 return theMonsterToFind;
489 } 464 }
490 } 465 }
491 466
492 /* now search all the 8 squares around recursively for a monster,in random order */ 467 /* now search all the 8 squares around recursively for a monster,in random order */
493 for (i = RANDOM () % 8, j = 0; j < 8 && theMonsterToFind == NULL; i++, j++) 468 for (i = rndm (8), j = 0; j < 8 && theMonsterToFind == NULL; i++, j++)
494 { 469 {
495 theMonsterToFind = find_monster_in_room_recursive (layout, map, x + freearr_x[i % 8 + 1], y + freearr_y[i % 8 + 1], RP); 470 theMonsterToFind = find_monster_in_room_recursive (layout, map, x + freearr_x[i % 8 + 1], y + freearr_y[i % 8 + 1], RP);
496 if (theMonsterToFind != NULL) 471 if (theMonsterToFind != NULL)
497 return theMonsterToFind; 472 return theMonsterToFind;
498 } 473 }
561 room_free_spots_x[number_of_free_spots_in_room] = x; 536 room_free_spots_x[number_of_free_spots_in_room] = x;
562 room_free_spots_y[number_of_free_spots_in_room] = y; 537 room_free_spots_y[number_of_free_spots_in_room] = y;
563 number_of_free_spots_in_room++; 538 number_of_free_spots_in_room++;
564 539
565 /* now search all the 8 squares around recursively for free spots,in random order */ 540 /* now search all the 8 squares around recursively for free spots,in random order */
566 for (i = RANDOM () % 8, j = 0; j < 8 && theMonsterToFind == NULL; i++, j++) 541 for (i = rndm (8), j = 0; j < 8 && theMonsterToFind == NULL; i++, j++)
567 find_spot_in_room_recursive (layout, x + freearr_x[i % 8 + 1], y + freearr_y[i % 8 + 1], RP); 542 find_spot_in_room_recursive (layout, x + freearr_x[i % 8 + 1], y + freearr_y[i % 8 + 1], RP);
568 543
569} 544}
570 545
571/* find a random non-blocked spot in this room to drop a key. */ 546/* find a random non-blocked spot in this room to drop a key. */
800 } 775 }
801 else 776 else
802 { 777 {
803 layout[x][y] = 1; 778 layout[x][y] = 1;
804 /* now search all the 8 squares around recursively for free spots,in random order */ 779 /* now search all the 8 squares around recursively for free spots,in random order */
805 for (i = RANDOM () % 8, j = 0; j < 8 && theMonsterToFind == NULL; i++, j++) 780 for (i = rndm (8), j = 0; j < 8 && theMonsterToFind == NULL; i++, j++)
806 find_doors_in_room_recursive (layout, map, x + freearr_x[i % 8 + 1], y + freearr_y[i % 8 + 1], doorlist, ndoors, RP); 781 find_doors_in_room_recursive (layout, map, x + freearr_x[i % 8 + 1], y + freearr_y[i % 8 + 1], doorlist, ndoors, RP);
807 } 782 }
808} 783}
809 784
810/* find a random non-blocked spot in this room to drop a key. */ 785/* find a random non-blocked spot in this room to drop a key. */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines