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.347 by root, Wed May 4 07:41:13 2011 UTC vs.
Revision 1.350 by root, Sun May 8 12:40:41 2011 UTC

737 } 737 }
738 738
739 mapspace &m = op->ms (); 739 mapspace &m = op->ms ();
740 740
741 if (!(m.flags_ & P_UPTODATE)) 741 if (!(m.flags_ & P_UPTODATE))
742 /* nop */; 742 m.update_up (); // nothing to do except copy up
743 else if (action == UP_OBJ_INSERT) 743 else if (action == UP_OBJ_INSERT)
744 { 744 {
745#if 0 745#if 0
746 // this is likely overkill, TODO: revisit (schmorp) 746 // this is likely overkill, TODO: revisit (schmorp)
747 if ((op->flag [FLAG_BLOCKSVIEW] && !(m.flags_ & P_BLOCKSVIEW)) 747 if ((op->flag [FLAG_BLOCKSVIEW] && !(m.flags_ & P_BLOCKSVIEW))
768 * that is being removed. 768 * that is being removed.
769 */ 769 */
770 else if (action == UP_OBJ_CHANGE || action == UP_OBJ_REMOVE) 770 else if (action == UP_OBJ_CHANGE || action == UP_OBJ_REMOVE)
771 m.invalidate (); 771 m.invalidate ();
772 else if (action == UP_OBJ_FACE) 772 else if (action == UP_OBJ_FACE)
773 /* Nothing to do for that case */ ; 773 m.update_up (); // nothing to do for that case, except copy up
774 else 774 else
775 LOG (llevError, "update_object called with invalid action: %d\n", action); 775 LOG (llevError, "update_object called with invalid action: %d\n", action);
776 776
777 if (op->more) 777 if (op->more)
778 update_object (op->more, action); 778 update_object (op->more, action);
1005 1005
1006 freelist = li; 1006 freelist = li;
1007 ++free_count; 1007 ++free_count;
1008} 1008}
1009 1009
1010// special "grave" map used to store all removed objects
1011// till they can be destroyed - saves a lot of checks in the rest
1012// of the code
1010static struct freed_map : maptile 1013static struct freed_map
1014: maptile
1011{ 1015{
1012 freed_map () 1016 freed_map ()
1013 : maptile (3, 3) 1017 : maptile (3, 3)
1014 { 1018 {
1015 path = "<freed objects map>"; 1019 path = "<freed objects map>";
2410 return /*who->flag [FLAG_WIZ]|| */ 2414 return /*who->flag [FLAG_WIZ]|| */
2411 (item->weight > 0 && !item->flag [FLAG_NO_PICK] && 2415 (item->weight > 0 && !item->flag [FLAG_NO_PICK] &&
2412 !item->flag [FLAG_ALIVE] && !item->invisible && (who->is_player () || item->weight < who->weight / 3)); 2416 !item->flag [FLAG_ALIVE] && !item->invisible && (who->is_player () || item->weight < who->weight / 3));
2413} 2417}
2414 2418
2419//-GPL
2420
2415/* 2421/*
2416 * create clone from object to another 2422 * create clone from object to another
2417 */ 2423 */
2418object * 2424object *
2419object::deep_clone () 2425object::deep_clone ()
2631object::region () const 2637object::region () const
2632{ 2638{
2633 return map ? map->region (x, y) 2639 return map ? map->region (x, y)
2634 : region::default_region (); 2640 : region::default_region ();
2635} 2641}
2642
2643//+GPL
2636 2644
2637void 2645void
2638object::open_container (object *new_container) 2646object::open_container (object *new_container)
2639{ 2647{
2640 if (container == new_container) 2648 if (container == new_container)
2698 } 2706 }
2699// else if (!old_container->env && contr && contr->ns) 2707// else if (!old_container->env && contr && contr->ns)
2700// contr->ns->floorbox_reset (); 2708// contr->ns->floorbox_reset ();
2701} 2709}
2702 2710
2711//-GPL
2712
2713// prefetch some flat area around the player
2714static void
2715prefetch_surrounding_area (object *op, maptile *map, int range)
2716{
2717 for (maprect *rect = map->split_to_tiles (mapwalk_buf,
2718 op->x - range , op->y - range ,
2719 op->x + range + 1, op->y + range + 1);
2720 rect->m;
2721 ++rect)
2722 {
2723 rect->m->touch ();
2724 rect->m->activate ();
2725 }
2726}
2727
2728// prefetch a generous area around the player, also up and down
2729void
2730object::prefetch_surrounding_maps ()
2731{
2732 prefetch_surrounding_area (this, map, 40);
2733
2734 if (maptile *m = map->tile_available (TILE_DOWN))
2735 prefetch_surrounding_area (this, m, 20);
2736
2737 if (maptile *m = map->tile_available (TILE_UP))
2738 prefetch_surrounding_area (this, m, 20);
2739}
2740
2741//+GPL
2742
2703object * 2743object *
2704object::force_find (shstr_tmp name) 2744object::force_find (shstr_tmp name)
2705{ 2745{
2706 /* cycle through his inventory to look for the MARK we want to 2746 /* cycle through his inventory to look for the MARK we want to
2707 * place 2747 * place
2711 return splay (tmp); 2751 return splay (tmp);
2712 2752
2713 return 0; 2753 return 0;
2714} 2754}
2715 2755
2716//-GPL
2717
2718void 2756void
2719object::force_set_timer (int duration) 2757object::force_set_timer (int duration)
2720{ 2758{
2721 this->duration = 1; 2759 this->duration = 1;
2722 this->speed_left = -1.f; 2760 this->speed_left = -1.f;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines