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.163 by root, Sun Jul 1 05:00:17 2007 UTC vs.
Revision 1.168 by root, Thu Jul 26 00:27:07 2007 UTC

299 return 0; 299 return 0;
300 else if (!compare_ob_value_lists (ob1, ob2)) 300 else if (!compare_ob_value_lists (ob1, ob2))
301 return 0; 301 return 0;
302 } 302 }
303 303
304 //TODO: generate an event or call into perl for additional checks
305 if (ob1->self || ob2->self) 304 if (ob1->self || ob2->self)
306 { 305 {
307 ob1->optimise (); 306 ob1->optimise ();
308 ob2->optimise (); 307 ob2->optimise ();
309 308
310 if (ob1->self || ob2->self) 309 if (ob1->self || ob2->self)
310 if (!cfperl_can_merge (ob1, ob2))
311 return 0; 311 return 0;
312 } 312 }
313 313
314 /* Everything passes, must be OK. */ 314 /* Everything passes, must be OK. */
315 return 1; 315 return 1;
316} 316}
1375 */ 1375 */
1376 if (last && last->below && last != floor) 1376 if (last && last->below && last != floor)
1377 top = last->below; 1377 top = last->below;
1378 } 1378 }
1379 } /* If objects on this space */ 1379 } /* If objects on this space */
1380
1381 if (flag & INS_MAP_LOAD) 1380 if (flag & INS_MAP_LOAD)
1382 top = ms.top; 1381 top = ms.top;
1383 1382
1384 if (flag & INS_ABOVE_FLOOR_ONLY) 1383 if (flag & INS_ABOVE_FLOOR_ONLY)
1385 top = floor; 1384 top = floor;
2640} 2639}
2641 2640
2642const materialtype_t * 2641const materialtype_t *
2643object::dominant_material () const 2642object::dominant_material () const
2644{ 2643{
2645 if (materialtype_t *mat = name_to_material (materialname)) 2644 if (materialtype_t *mt = name_to_material (materialname))
2646 return mat; 2645 return mt;
2647 2646
2648 // omfg this is slow, this has to be temporary :)
2649 shstr unknown ("unknown");
2650
2651 return name_to_material (unknown); 2647 return name_to_material (shstr_unknown);
2652} 2648}
2653 2649
2654void 2650void
2655object::open_container (object *new_container) 2651object::open_container (object *new_container)
2656{ 2652{
2700 esrv_update_item (UPD_FLAGS, this, new_container); 2696 esrv_update_item (UPD_FLAGS, this, new_container);
2701 esrv_send_inventory (this, new_container); 2697 esrv_send_inventory (this, new_container);
2702 } 2698 }
2703} 2699}
2704 2700
2701object *
2702object::force_find (const shstr name)
2703{
2704 /* cycle through his inventory to look for the MARK we want to
2705 * place
2706 */
2707 for (object *tmp = inv; tmp; tmp = tmp->below)
2708 if (tmp->type == FORCE && tmp->slaying == name)
2709 return splay (tmp);
2705 2710
2711 return 0;
2712}
2713
2714void
2715object::force_add (const shstr name, int duration)
2716{
2717 if (object *force = force_find (name))
2718 force->destroy ();
2719
2720 object *force = get_archetype (FORCE_NAME);
2721
2722 force->slaying = name;
2723 force->stats.food = 1;
2724 force->speed_left = -1.f;
2725
2726 force->set_speed (duration ? 1.f / duration : 0.f);
2727 force->flag [FLAG_IS_USED_UP] = true;
2728 force->flag [FLAG_APPLIED] = true;
2729
2730 insert (force);
2731}
2732
2733void
2734object::play_sound (faceidx sound) const
2735{
2736 if (map)
2737 map->play_sound (sound, x, y);
2738}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines