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

Comparing deliantra/server/common/object.C (file contents):
Revision 1.175 by root, Fri Aug 10 01:47:52 2007 UTC vs.
Revision 1.179 by root, Wed Aug 15 04:57:48 2007 UTC

1237 assert (!op->flag [FLAG_FREED]); 1237 assert (!op->flag [FLAG_FREED]);
1238 1238
1239 object *top, *floor = NULL; 1239 object *top, *floor = NULL;
1240 1240
1241 op->remove (); 1241 op->remove ();
1242
1243#if 0
1244 if (!m->active != !op->active)
1245 if (m->active)
1246 op->activate_recursive ();
1247 else
1248 op->deactivate_recursive ();
1249#endif
1250 1242
1251 if (out_of_map (m, op->x, op->y)) 1243 if (out_of_map (m, op->x, op->y))
1252 { 1244 {
1253 LOG (llevError, "Trying to insert object outside the map.\n%s\n", op->debug_desc ()); 1245 LOG (llevError, "Trying to insert object outside the map.\n%s\n", op->debug_desc ());
1254#ifdef MANY_CORES 1246#ifdef MANY_CORES
2344 * Cf 0.91.3 - don't let WIZ's pick up anything - will likely cause 2336 * Cf 0.91.3 - don't let WIZ's pick up anything - will likely cause
2345 * core dumps if they do. 2337 * core dumps if they do.
2346 * 2338 *
2347 * Add a check so we can't pick up invisible objects (0.93.8) 2339 * Add a check so we can't pick up invisible objects (0.93.8)
2348 */ 2340 */
2349
2350int 2341int
2351can_pick (const object *who, const object *item) 2342can_pick (const object *who, const object *item)
2352{ 2343{
2353 return /*QUERY_FLAG(who,FLAG_WIZ)|| */ 2344 return /*QUERY_FLAG(who,FLAG_WIZ)|| */
2354 (item->weight > 0 && !QUERY_FLAG (item, FLAG_NO_PICK) && 2345 (item->weight > 0 && !QUERY_FLAG (item, FLAG_NO_PICK) &&
2669 old_container->flag [FLAG_APPLIED] = 0; 2660 old_container->flag [FLAG_APPLIED] = 0;
2670 container = 0; 2661 container = 0;
2671 2662
2672 esrv_update_item (UPD_FLAGS, this, old_container); 2663 esrv_update_item (UPD_FLAGS, this, old_container);
2673 new_draw_info_format (NDI_UNIQUE, 0, this, "You close %s.", query_name (old_container)); 2664 new_draw_info_format (NDI_UNIQUE, 0, this, "You close %s.", query_name (old_container));
2665 play_sound (sound_find ("chest_close"));
2674 } 2666 }
2675 2667
2676 if (new_container) 2668 if (new_container)
2677 { 2669 {
2678 if (INVOKE_OBJECT (OPEN, new_container, ARG_OBJECT (this))) 2670 if (INVOKE_OBJECT (OPEN, new_container, ARG_OBJECT (this)))
2694 new_container->flag [FLAG_APPLIED] = 1; 2686 new_container->flag [FLAG_APPLIED] = 1;
2695 container = new_container; 2687 container = new_container;
2696 2688
2697 esrv_update_item (UPD_FLAGS, this, new_container); 2689 esrv_update_item (UPD_FLAGS, this, new_container);
2698 esrv_send_inventory (this, new_container); 2690 esrv_send_inventory (this, new_container);
2691 play_sound (sound_find ("chest_open"));
2699 } 2692 }
2700} 2693}
2701 2694
2702object * 2695object *
2703object::force_find (const shstr name) 2696object::force_find (const shstr name)
2729 force->flag [FLAG_APPLIED] = true; 2722 force->flag [FLAG_APPLIED] = true;
2730 2723
2731 insert (force); 2724 insert (force);
2732} 2725}
2733 2726
2727void
2728object::play_sound (faceidx sound) const
2729{
2730 if (!sound)
2731 return;
2732
2733 if (flag [FLAG_REMOVED])
2734 return;
2735
2736 if (env)
2737 {
2738 if (object *pl = in_player ())
2739 pl->contr->play_sound (sound);
2740 }
2741 else
2742 map->play_sound (sound, x, y);
2743}
2744

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines