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.41 by root, Thu Jul 24 20:35:37 2008 UTC vs.
Revision 1.43 by root, Mon Sep 29 09:04:51 2008 UTC

117 NO_PASS_DOORS is set. */ 117 NO_PASS_DOORS is set. */
118 if (n_keys == 1) 118 if (n_keys == 1)
119 { 119 {
120 if (wall_blocked (map, x, y)) 120 if (wall_blocked (map, x, y))
121 { 121 {
122 the_key->destroy (); 122 the_key->destroy (true);
123 return 0; 123 return 0;
124 } 124 }
125 125
126 the_keymaster = find_monster_in_room (map, x, y, RP); 126 the_keymaster = find_monster_in_room (map, x, y, RP);
127 if (!the_keymaster) /* if fail, find a spot to drop the key. */ 127 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); 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 } 146 }
147 147
148 the_key->destroy (); 148 the_key->destroy (true);
149 return 1; 149 return 1;
150 } 150 }
151 } 151 }
152 152
153 LOG(llevError, "key %d,%d %p\n", the_keymaster ? the_keymaster->x : x, the_keymaster ? the_keymaster->y : y, the_keymaster+0);//D
154 if (the_keymaster) 153 if (the_keymaster)
155 the_keymaster->head_ ()->insert (the_key); 154 the_keymaster->head_ ()->insert (the_key);
156 else 155 else
157 { 156 {
158 the_key->x = kx; 157 the_key->x = kx;
332 331
333 /* first, find a place to put the chest. */ 332 /* first, find a place to put the chest. */
334 int i = find_first_free_spot (the_chest, map, x, y); // this call uses the main rng 333 int i = find_first_free_spot (the_chest, map, x, y); // this call uses the main rng
335 if (i == -1) 334 if (i == -1)
336 { 335 {
337 the_chest->destroy (); 336 the_chest->destroy (true);
338 return NULL; 337 return NULL;
339 } 338 }
340 339
341 int xl = x + freearr_x[i]; 340 int xl = x + freearr_x[i];
342 int yl = y + freearr_y[i]; 341 int yl = y + freearr_y[i];
670} 669}
671 670
672void 671void
673remove_monsters (int x, int y, maptile *map) 672remove_monsters (int x, int y, maptile *map)
674{ 673{
675 object *tmp;
676
677 for (tmp = GET_MAP_OB (map, x, y); tmp; tmp = tmp->above) 674 for (object *tmp = GET_MAP_OB (map, x, y); tmp; )
678 if (QUERY_FLAG (tmp, FLAG_ALIVE))
679 { 675 {
680 if (tmp->head) 676 object *next = tmp->above;
681 tmp = tmp->head; 677
682 tmp->remove (); 678 if (tmp->flag [FLAG_ALIVE])
683 tmp->destroy (); 679 tmp->head_ ()->destroy (true);
684 tmp = GET_MAP_OB (map, x, y); 680
685 if (tmp == NULL) 681 tmp = next;
686 break;
687 }; 682 }
688} 683}
689 684
690/* surrounds the point x,y by doors, so as to enclose something, like 685/* surrounds the point x,y by doors, so as to enclose something, like
691 a chest. It only goes as far as the 8 squares surrounding, and 686 a chest. It only goes as far as the 8 squares surrounding, and
692 it'll remove any monsters it finds.*/ 687 it'll remove any monsters it finds.*/
821 816
822 /* lock the doors and hide the keys. */ 817 /* lock the doors and hide the keys. */
823 818
824 if (opts & DOORED) 819 if (opts & DOORED)
825 { 820 {
826 for (i = 0, door = doorlist[0]; doorlist[i] != NULL; i++) 821 for (i = 0, door = doorlist[0]; doorlist[i]; i++)
827 { 822 {
828 object *new_door = get_archetype (shstr_locked_door1); 823 object *new_door = get_archetype (shstr_locked_door1);
829 824
830 door = doorlist[i]; 825 door = doorlist[i];
831 new_door->face = door->face; 826 new_door->face = door->face;
832 new_door->x = door->x; 827 new_door->x = door->x;
833 new_door->y = door->y; 828 new_door->y = door->y;
834 door->remove ();
835 door->destroy (); 829 door->destroy (true);
836 doorlist[i] = new_door; 830 doorlist[i] = new_door;
837 insert_ob_in_map (new_door, map, NULL, 0); 831 insert_ob_in_map (new_door, map, NULL, 0);
838 new_door->slaying = format ("RMG-%d-%d", (int)rmg_rndm (1000000000), (int)rmg_rndm (1000000000)); 832 new_door->slaying = format ("RMG-%d-%d", (int)rmg_rndm (1000000000), (int)rmg_rndm (1000000000));
839 keyplace (map, new_door->x, new_door->y, new_door->slaying, NO_PASS_DOORS, 2, RP); 833 keyplace (map, new_door->x, new_door->y, new_door->slaying, NO_PASS_DOORS, 2, RP);
840 } 834 }
856 retrofit_joined_wall (map, door->x, door->y - 1, 0, RP); 850 retrofit_joined_wall (map, door->x, door->y - 1, 0, RP);
857 retrofit_joined_wall (map, door->x, door->y + 1, 0, RP); 851 retrofit_joined_wall (map, door->x, door->y + 1, 0, RP);
858 852
859 door->face = wallface->face; 853 door->face = wallface->face;
860 854
861 if (!QUERY_FLAG (wallface, FLAG_REMOVED))
862 wallface->remove ();
863
864 wallface->destroy (); 855 wallface->destroy (true);
865 } 856 }
866 } 857 }
867 } 858 }
868} 859}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines