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.295 by root, Fri Nov 6 13:03:34 2009 UTC vs.
Revision 1.296 by root, Fri Nov 6 13:31:47 2009 UTC

439 439
440char * 440char *
441object::as_string () 441object::as_string ()
442{ 442{
443 return dump_object (this); 443 return dump_object (this);
444}
445
446/*
447 * get_nearest_part(multi-object, object 2) returns the part of the
448 * multi-object 1 which is closest to the second object.
449 * If it's not a multi-object, it is returned.
450 */
451static object *
452get_nearest_part (object *op, const object *pl)
453{
454 object *tmp, *closest;
455 int last_dist, i;
456
457 if (!op->more)
458 return op;
459
460 for (last_dist = distance (op, pl), closest = op, tmp = op->more;
461 tmp;
462 tmp = tmp->more)
463 if ((i = distance (tmp, pl)) < last_dist)
464 closest = tmp, last_dist = i;
465
466 return closest;
467} 444}
468 445
469/* 446/*
470 * Returns the object which has the count-variable equal to the argument. 447 * Returns the object which has the count-variable equal to the argument.
471 * VERRRY slow. 448 * VERRRY slow.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines