--- deliantra/server/common/object.C 2006/12/13 00:42:03 1.65 +++ deliantra/server/common/object.C 2006/12/13 03:28:42 1.66 @@ -185,21 +185,23 @@ * replaces - this is mostly for clarity - a decent compiler should hopefully * reduce this to the same efficiency. * - * Check nrof variable *before* calling CAN_MERGE() + * Check nrof variable *before* calling can_merge() * * Improvements made with merge: Better checking on potion, and also * check weight */ -bool object::can_merge (object *ob1, object *ob2) +bool object::can_merge_slow (object *ob1, object *ob2) { /* A couple quicksanity checks */ - if ((ob1 == ob2) || (ob1->type != ob2->type)) - return 0; - - if (ob1->speed != ob2->speed) + if (ob1 == ob2 + || ob1->type != ob2->type + || ob1->speed != ob2->speed + || ob1->value != ob2->value + || ob1->name != ob2->name) return 0; + //TODO: this ain't working well, use nicer and correct overflow check /* Do not merge objects if nrof would overflow. We use 1UL<<31 since that * value could not be stored in a sint32 (which unfortunately sometimes is * used to store nrof). @@ -262,7 +264,7 @@ return 0; /* Now check to see if the two inventory objects could merge */ - if (!CAN_MERGE (ob1->inv, ob2->inv)) + if (!object::can_merge (ob1->inv, ob2->inv)) return 0; /* inventory ok - still need to check rest of this object to see @@ -1202,7 +1204,8 @@ { if (top == op) continue; - if (CAN_MERGE (op, top)) + + if (object::can_merge (op, top)) { top->nrof += op->nrof; @@ -1345,7 +1348,7 @@ */ if (op->nrof && !(flag & INS_NO_MERGE)) for (tmp = GET_MAP_OB (op->map, x, y); tmp != NULL; tmp = tmp->above) - if (CAN_MERGE (op, tmp)) + if (object::can_merge (op, tmp)) { op->nrof += tmp->nrof; tmp->destroy (); @@ -1757,7 +1760,7 @@ if (op->nrof) { for (tmp = inv; tmp != NULL; tmp = tmp->below) - if (CAN_MERGE (tmp, op)) + if (object::can_merge (tmp, op)) { /* return the original object and remove inserted object (client needs the original object) */