--- deliantra/server/include/object.h 2006/12/13 00:42:04 1.50 +++ deliantra/server/include/object.h 2006/12/13 03:28:42 1.51 @@ -252,12 +252,22 @@ object *insert (object *item); // insert into inventory static void free_mortals (); - static bool can_merge (object *op1, object *op2); + static bool can_merge_slow (object *op1, object *op2); + + // this is often used in time-critical code, so optimise + static bool can_merge (object *op1, object *op2) + { + return op1->value != op2->value + && op1->name != op2->name + && can_merge_slow (op1, op2); + } void clear (); bool destroyed () { return QUERY_FLAG (this, FLAG_FREED); } + void set_owner (object *owner); + void instantiate () { if (!uuid.seq) // HACK @@ -266,8 +276,6 @@ attachable::instantiate (); } - void set_owner (object *owner); - // info must hold 256 * 3 bytes currently const char *debug_desc (char *info) const; const char *debug_desc () const; @@ -317,20 +325,6 @@ ~object (); }; -// compatibility functions/macros -#define clear_owner(op) (op)->owner = 0 -#define copy_owner(op,other) (op)->owner = (other)->owner -#define get_owner(op) (op)->owner -#define clear_object(op) (op)->clear () - -static inline void -set_owner (object *op, object *owner) -{ - op->set_owner (owner); -} - -#define CAN_MERGE(op1,op2) ((op1)->value == (op2)->value && (op1)->name == (op2)->name && object::can_merge ((op1), (op2))) - typedef struct oblnk { /* Used to link together several objects */ object_ptr ob;