--- deliantra/server/common/object.C 2008/07/16 14:29:40 1.250 +++ deliantra/server/common/object.C 2008/08/31 01:17:11 1.254 @@ -188,12 +188,9 @@ || ob1->name != ob2->name) return 0; - /* Do not merge objects if nrof would overflow. First part checks - * for unsigned overflow (2c), second part checks whether the result - * would fit into a 32 bit signed int, which is often used to hold - * nrof values. - */ - if (~ob1->nrof < ob2->nrof || ob1->nrof + ob2->nrof > (1UL << 31)) + /* Do not merge objects if nrof would overflow, assume nrof + * is always 0 .. 2**31-1 */ + if (ob1->nrof > 0x7fffffff - ob2->nrof) return 0; /* If the objects have been identified, set the BEEN_APPLIED flag. @@ -772,7 +769,7 @@ || (m.move_off | op->move_off ) != m.move_off || (m.move_slow | op->move_slow) != m.move_slow /* This isn't perfect, but I don't expect a lot of objects to - * to have move_allow right now. + * have move_allow right now. */ || ((m.move_block | op->move_block) & ~op->move_allow) != m.move_block || 1) // the above is not strong enough a test to skip updating. los maybe? TODO (Schmorp) @@ -1117,6 +1114,8 @@ above = 0; below = 0; + ms.flags_ = 0; + if (map->in_memory == MAP_SAVING) return; @@ -1158,13 +1157,6 @@ last = tmp; } - /* last == NULL if there are no objects on this space */ - //TODO: this makes little sense, why only update the topmost object? - if (!last) - map->at (x, y).flags_ = 0; - else - update_object (last, UP_OBJ_REMOVE); - if (flag [FLAG_BLOCKSVIEW] || glow_radius) update_all_los (map, x, y); } @@ -1537,10 +1529,9 @@ nr = min (nr, nrof); - nrof -= nr; - - if (nrof) + if (nrof > nr) { + nrof -= nr; adjust_weight (env, -weight * max (1, nr)); // carrying == 0 if (object *pl = visible_to ())