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.43 by root, Mon Sep 29 09:04:51 2008 UTC vs.
Revision 1.45 by root, Mon Oct 12 14:00:58 2009 UTC

3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2001,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * it under the terms of the GNU General Public License as published by 9 * the terms of the Affero GNU General Public License as published by the
10 * the Free Software Foundation, either version 3 of the License, or 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * (at your option) any later version. 11 * option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the Affero GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>.
20 * 21 *
21 * The authors can be reached via e-mail to <support@deliantra.net> 22 * The authors can be reached via e-mail to <support@deliantra.net>
22 */ 23 */
23 24
24/* placing treasure in maps, where appropriate. */ 25/* placing treasure in maps, where appropriate. */
117 NO_PASS_DOORS is set. */ 118 NO_PASS_DOORS is set. */
118 if (n_keys == 1) 119 if (n_keys == 1)
119 { 120 {
120 if (wall_blocked (map, x, y)) 121 if (wall_blocked (map, x, y))
121 { 122 {
122 the_key->destroy (true); 123 the_key->destroy ();
123 return 0; 124 return 0;
124 } 125 }
125 126
126 the_keymaster = find_monster_in_room (map, x, y, RP); 127 the_keymaster = find_monster_in_room (map, x, y, RP);
127 if (!the_keymaster) /* if fail, find a spot to drop the key. */ 128 if (!the_keymaster) /* if fail, find a spot to drop the key. */
143 keyplace (map, x + 1, y - 1, keycode, NO_PASS_DOORS, 1, RP); 144 keyplace (map, x + 1, y - 1, keycode, NO_PASS_DOORS, 1, RP);
144 keyplace (map, x - 1, y + 1, keycode, NO_PASS_DOORS, 1, RP); 145 keyplace (map, x - 1, y + 1, keycode, NO_PASS_DOORS, 1, RP);
145 keyplace (map, x - 1, y - 1, keycode, NO_PASS_DOORS, 1, RP); 146 keyplace (map, x - 1, y - 1, keycode, NO_PASS_DOORS, 1, RP);
146 } 147 }
147 148
148 the_key->destroy (true); 149 the_key->destroy ();
149 return 1; 150 return 1;
150 } 151 }
151 } 152 }
152 153
153 if (the_keymaster) 154 if (the_keymaster)
331 332
332 /* first, find a place to put the chest. */ 333 /* first, find a place to put the chest. */
333 int i = find_first_free_spot (the_chest, map, x, y); // this call uses the main rng 334 int i = find_first_free_spot (the_chest, map, x, y); // this call uses the main rng
334 if (i == -1) 335 if (i == -1)
335 { 336 {
336 the_chest->destroy (true); 337 the_chest->destroy ();
337 return NULL; 338 return NULL;
338 } 339 }
339 340
340 int xl = x + freearr_x[i]; 341 int xl = x + freearr_x[i];
341 int yl = y + freearr_y[i]; 342 int yl = y + freearr_y[i];
674 for (object *tmp = GET_MAP_OB (map, x, y); tmp; ) 675 for (object *tmp = GET_MAP_OB (map, x, y); tmp; )
675 { 676 {
676 object *next = tmp->above; 677 object *next = tmp->above;
677 678
678 if (tmp->flag [FLAG_ALIVE]) 679 if (tmp->flag [FLAG_ALIVE])
679 tmp->head_ ()->destroy (true); 680 tmp->head_ ()->destroy ();
680 681
681 tmp = next; 682 tmp = next;
682 } 683 }
683} 684}
684 685
824 825
825 door = doorlist[i]; 826 door = doorlist[i];
826 new_door->face = door->face; 827 new_door->face = door->face;
827 new_door->x = door->x; 828 new_door->x = door->x;
828 new_door->y = door->y; 829 new_door->y = door->y;
829 door->destroy (true); 830 door->destroy ();
830 doorlist[i] = new_door; 831 doorlist[i] = new_door;
831 insert_ob_in_map (new_door, map, NULL, 0); 832 insert_ob_in_map (new_door, map, NULL, 0);
832 new_door->slaying = format ("RMG-%d-%d", (int)rmg_rndm (1000000000), (int)rmg_rndm (1000000000)); 833 new_door->slaying = format ("RMG-%d-%d", (int)rmg_rndm (1000000000), (int)rmg_rndm (1000000000));
833 keyplace (map, new_door->x, new_door->y, new_door->slaying, NO_PASS_DOORS, 2, RP); 834 keyplace (map, new_door->x, new_door->y, new_door->slaying, NO_PASS_DOORS, 2, RP);
834 } 835 }
850 retrofit_joined_wall (map, door->x, door->y - 1, 0, RP); 851 retrofit_joined_wall (map, door->x, door->y - 1, 0, RP);
851 retrofit_joined_wall (map, door->x, door->y + 1, 0, RP); 852 retrofit_joined_wall (map, door->x, door->y + 1, 0, RP);
852 853
853 door->face = wallface->face; 854 door->face = wallface->face;
854 855
855 wallface->destroy (true); 856 wallface->destroy ();
856 } 857 }
857 } 858 }
858 } 859 }
859} 860}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines