--- deliantra/server/include/object.h 2007/05/17 20:27:01 1.123 +++ deliantra/server/include/object.h 2007/05/18 12:13:02 1.124 @@ -299,24 +299,6 @@ do_remove (); } - // move this object to the top of its env's inventory to speed up - // searches for it. - MTH object *inv_splay () - { - if (env && env->inv != this) - { - if (above) above->below = below; - if (below) below->above = above; - - above = 0; - below = env->inv; - below->above = this; - env->inv = this; - } - - return this; - } - static bool can_merge_slow (object *op1, object *op2); // this is often used in time-critical code, so optimise @@ -510,6 +492,25 @@ ~object (); }; +// move this object to the top of its env's inventory to speed up +// searches for it. +static object * +splay (object *ob) +{ + if (ob->env && ob->env->inv != ob) + { + if (ob->above) ob->above->below = ob->below; + if (ob->below) ob->below->above = ob->above; + + ob->above = 0; + ob->below = ob->env->inv; + ob->below->above = ob; + ob->env->inv = ob; + } + + return ob; +} + typedef object_vector objectvec; typedef object_vector activevec;