--- deliantra/server/common/object.C 2008/05/06 18:47:32 1.233 +++ deliantra/server/common/object.C 2008/05/06 20:08:37 1.236 @@ -408,7 +408,7 @@ sum += op->total_weight (); } - sum = weight_adjust (this, sum); + sum = weight_adjust_for (this, sum); if (sum != carrying) { @@ -1059,10 +1059,13 @@ adjust_weight (env, -total_weight ()); + // make sure cmov optimisation is applicable *(above ? &above->below : &env->inv) = below; + *(below ? &below->above : &above ) = above; // &above is just a dummy - if (below) - below->above = above; + above = 0; + below = 0; + env = 0; /* we set up values so that it could be inserted into * the map, but we don't actually do that - it is up @@ -1071,9 +1074,6 @@ map = env->map; x = env->x; y = env->y; - above = 0; - below = 0; - env = 0; /* NO_FIX_PLAYER is set when a great many changes are being * made to players inventory. If set, avoiding the call @@ -1110,25 +1110,9 @@ } /* link the object above us */ - if (above) - above->below = below; - else - ms.top = below; /* we were top, set new top */ - - /* Relink the object below us, if there is one */ - if (below) - below->above = above; - else - { - /* Nothing below, which means we need to relink map object for this space - * use translated coordinates in case some oddness with map tiling is - * evident - */ - if (GET_MAP_OB (map, x, y) != this) - LOG (llevError, "remove_ob: GET_MAP_OB does not return object to be removed even though it appears to be on the bottom? %s\n", debug_desc ()); - - ms.bot = above; /* goes on above it. */ - } + // re-link, make sure compiler can easily use cmove + *(above ? &above->below : &ms.top) = below; + *(below ? &below->above : &ms.bot) = above; above = 0; below = 0;