1 | /* |
1 | /* |
2 | * static char *rcsid_treasure_c = |
2 | * static char *rcsid_treasure_c = |
3 | * "$Id: treasure.C,v 1.2 2006/08/29 08:01:36 root Exp $"; |
3 | * "$Id: treasure.C,v 1.3 2006/09/03 00:18:41 root Exp $"; |
4 | */ |
4 | */ |
5 | |
5 | |
6 | /* |
6 | /* |
7 | CrossFire, A Multiplayer game for X-windows |
7 | CrossFire, A Multiplayer game for X-windows |
8 | |
8 | |
… | |
… | |
235 | there's only 1 treasure....*/ |
235 | there's only 1 treasure....*/ |
236 | |
236 | |
237 | if((treasureoptions & KEYREQUIRED)&&n_treasures>1) { |
237 | if((treasureoptions & KEYREQUIRED)&&n_treasures>1) { |
238 | char keybuf[256]; |
238 | char keybuf[256]; |
239 | sprintf(keybuf,"%d",(int)RANDOM()); |
239 | sprintf(keybuf,"%d",(int)RANDOM()); |
240 | the_chest->slaying = add_string(keybuf); |
240 | the_chest->slaying = keybuf; |
241 | keyplace(map,x,y,keybuf,PASS_DOORS,1,RP); |
241 | keyplace(map,x,y,keybuf,PASS_DOORS,1,RP); |
242 | } |
242 | } |
243 | |
243 | |
244 | /* actually place the chest. */ |
244 | /* actually place the chest. */ |
245 | the_chest->x = xl; the_chest->y = yl; |
245 | the_chest->x = xl; the_chest->y = yl; |
… | |
… | |
288 | object *the_keymaster; /* the monster that gets the key. */ |
288 | object *the_keymaster; /* the monster that gets the key. */ |
289 | object *the_key; |
289 | object *the_key; |
290 | |
290 | |
291 | /* get a key and set its keycode */ |
291 | /* get a key and set its keycode */ |
292 | the_key = get_archetype("key2"); |
292 | the_key = get_archetype("key2"); |
293 | the_key->slaying = add_string(keycode); |
293 | the_key->slaying = keycode; |
294 | |
|
|
295 | |
294 | |
296 | if(door_flag==PASS_DOORS) { |
295 | if(door_flag==PASS_DOORS) { |
297 | int tries=0; |
296 | int tries=0; |
298 | the_keymaster=NULL; |
297 | the_keymaster=NULL; |
299 | while(tries<15&&the_keymaster==NULL) { |
298 | while(tries<15&&the_keymaster==NULL) { |
… | |
… | |
702 | remove_ob(door); |
701 | remove_ob(door); |
703 | free_object(door); |
702 | free_object(door); |
704 | doorlist[i]=new_door; |
703 | doorlist[i]=new_door; |
705 | insert_ob_in_map(new_door,map,NULL,0); |
704 | insert_ob_in_map(new_door,map,NULL,0); |
706 | sprintf(keybuf,"%d",(int)RANDOM()); |
705 | sprintf(keybuf,"%d",(int)RANDOM()); |
707 | new_door->slaying = add_string(keybuf); |
706 | new_door->slaying = keybuf; |
708 | keyplace(map,new_door->x,new_door->y,keybuf,NO_PASS_DOORS,2,RP); |
707 | keyplace(map,new_door->x,new_door->y,keybuf,NO_PASS_DOORS,2,RP); |
709 | } |
708 | } |
710 | } |
709 | } |
711 | |
710 | |
712 | /* change the faces of the doors and surrounding walls to hide them. */ |
711 | /* change the faces of the doors and surrounding walls to hide them. */ |