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.125 by root, Sat Jan 27 23:59:29 2007 UTC vs.
Revision 1.131 by root, Sat Feb 10 15:20:23 2007 UTC

819 819
820 if (flag [FLAG_IS_LINKED]) 820 if (flag [FLAG_IS_LINKED])
821 remove_button_link (this); 821 remove_button_link (this);
822 822
823 if (flag [FLAG_FRIENDLY]) 823 if (flag [FLAG_FRIENDLY])
824 {
824 remove_friendly_object (this); 825 remove_friendly_object (this);
826
827 if (type == GOLEM
828 && owner
829 && owner->type == PLAYER
830 && owner->contr->ranges[range_golem] == this)
831 owner->contr->ranges[range_golem] = 0;
832 }
825 833
826 if (!flag [FLAG_REMOVED]) 834 if (!flag [FLAG_REMOVED])
827 remove (); 835 remove ();
828 836
829 destroy_inv (true); 837 destroy_inv (true);
903 * object will have no environment. If the object previously had an 911 * object will have no environment. If the object previously had an
904 * environment, the x and y coordinates will be updated to 912 * environment, the x and y coordinates will be updated to
905 * the previous environment. 913 * the previous environment.
906 */ 914 */
907void 915void
908object::remove_slow () 916object::do_remove ()
909{ 917{
910 object *tmp, *last = 0; 918 object *tmp, *last = 0;
911 object *otmp; 919 object *otmp;
912 920
913 if (QUERY_FLAG (this, FLAG_REMOVED)) 921 if (QUERY_FLAG (this, FLAG_REMOVED))
956 } 964 }
957 else if (map) 965 else if (map)
958 { 966 {
959 if (type == PLAYER) 967 if (type == PLAYER)
960 { 968 {
969 // leaving a spot always closes any open container on the ground
970 if (container && !container->env)
971 // this causes spurious floorbox updates, but it ensures
972 // that the CLOSE event is being sent.
973 close_container ();
974
961 --map->players; 975 --map->players;
962 map->touch (); 976 map->touch ();
963 } 977 }
964 978
965 map->dirty = true; 979 map->dirty = true;
2570{ 2584{
2571 char flagdesc[512]; 2585 char flagdesc[512];
2572 char info2[256 * 4]; 2586 char info2[256 * 4];
2573 char *p = info; 2587 char *p = info;
2574 2588
2575 p += snprintf (p, 512, "{cnt:%d,uuid:<1,%" PRIx64 ">,name:\"%s\"%s%s,flags:[%s],type:%d}", 2589 p += snprintf (p, 512, "{cnt:%d,uuid:<1.%" PRIx64 ">,name:\"%s\"%s%s,flags:[%s],type:%d}",
2576 count, uuid.seq, 2590 count, uuid.seq,
2577 &name, 2591 &name,
2578 title ? "\",title:\"" : "", 2592 title ? "\",title:\"" : "",
2579 title ? (const char *)title : "", 2593 title ? (const char *)title : "",
2580 flag_desc (flagdesc, 512), type); 2594 flag_desc (flagdesc, 512), type);
2607{ 2621{
2608 return map ? map->region (x, y) 2622 return map ? map->region (x, y)
2609 : region::default_region (); 2623 : region::default_region ();
2610} 2624}
2611 2625
2626const materialtype_t *
2627object::dominant_material () const
2628{
2629 if (materialtype_t *mat = name_to_material (materialname))
2630 return mat;
2631
2632 // omfg this is slow, this has to be temporary :)
2633 shstr unknown ("unknown");
2634
2635 return name_to_material (unknown);
2636}
2637
2638void
2639object::open_container (object *new_container)
2640{
2641 if (container == new_container)
2642 return;
2643
2644 if (contr && contr->ns)
2645 contr->ns->floorbox_reset ();
2646
2647 if (object *old_container = container)
2648 {
2649 if (INVOKE_OBJECT (CLOSE, old_container, ARG_OBJECT (this)))
2650 return;
2651
2652#if 0
2653 // remove the "Close old_container" object.
2654 if (object *closer = old_container->inv)
2655 if (closer->type == CLOSE_CON)
2656 closer->destroy ();
2657#endif
2658
2659 old_container->flag [FLAG_APPLIED] = 0;
2660 container = 0;
2661
2662 esrv_update_item (UPD_FLAGS, this, old_container);
2663 new_draw_info_format (NDI_UNIQUE, 0, this, "You close %s.", query_name (old_container));
2664 }
2665
2666 if (new_container)
2667 {
2668 if (INVOKE_OBJECT (OPEN, new_container, ARG_OBJECT (this)))
2669 return;
2670
2671 // TODO: this does not seem to serve any purpose anymore?
2672#if 0
2673 // insert the "Close Container" object.
2674 if (archetype *closer = new_container->other_arch)
2675 {
2676 object *closer = arch_to_object (new_container->other_arch);
2677 closer->flag [FLAG_NO_MAP_SAVE] = 1;
2678 new_container->insert (closer);
2679 }
2680#endif
2681
2682 new_container->flag [FLAG_APPLIED] = 1;
2683 container = new_container;
2684
2685 esrv_update_item (UPD_FLAGS, this, new_container);
2686 esrv_send_inventory (this, new_container);
2687 new_draw_info_format (NDI_UNIQUE, 0, this, "You open %s.", query_name (new_container));
2688 }
2689}
2690
2691

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines