--- deliantra/server/common/object.C 2008/05/06 20:00:12 1.235 +++ deliantra/server/common/object.C 2008/05/06 20:08:37 1.236 @@ -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,16 +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 - ms.bot = above; + // 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;