--- deliantra/server/socket/item.C 2008/05/05 22:03:22 1.64 +++ deliantra/server/socket/item.C 2008/05/08 20:03:50 1.68 @@ -255,11 +255,10 @@ static void add_object_to_socklist (client &ns, packet &sl, object *head) { - int flags, len, anim_speed; char item_n[MAX_BUF]; const char *item_p; - flags = query_flags (head); + int flags = query_flags (head); if (QUERY_FLAG (head, FLAG_NO_PICK)) flags |= F_NOPICK; @@ -274,6 +273,8 @@ << uint32 (QUERY_FLAG (head, FLAG_NO_PICK) ? -1 : head->client_weight ()) << uint32 (head->face); + int len; + if (!head->custom_name) { strncpy (item_n, query_base_name (head, 0), 127); @@ -296,24 +297,9 @@ sl << data8 (item_n, len) << uint16 (head->animation_id); - anim_speed = 0; - if (QUERY_FLAG (head, FLAG_ANIMATE)) - { - if (head->anim_speed) - anim_speed = head->anim_speed; - else - { - if (fabs (head->speed) < 0.001) - anim_speed = 255; - else if (fabs (head->speed) >= 1.0) - anim_speed = 1; - else - anim_speed = (int) (1.0 / fabs (head->speed)); - } - - if (anim_speed > 255) - anim_speed = 255; - } + int anim_speed = !head->flag [FLAG_ANIMATE] ? 0 + : head->anim_speed ? clamp (head->anim_speed, 1, 255) + : 1. / clamp (fabs (head->speed), 1./255., 1./1.); sl << uint8 (anim_speed) << uint32 (head->nrof); @@ -765,6 +751,9 @@ { std::string s = op->describe (pl->ob); + if (msg_is_special (s.c_str (), false)) + cfperl_expand_cfpod (pl, s); + packet sl ("ex"); sl << ber32 (tag) << s.c_str (); @@ -911,9 +900,7 @@ void esrv_move_object (object *pl, tag_t to, tag_t tag, long nrof) { - object *op, *env; - - op = esrv_get_ob_from_count (pl, tag); + object *op = esrv_get_ob_from_count (pl, tag); if (!op) { LOG (llevDebug, "Player '%s' tried to move an unknown object (%ld)\n", &pl->name, tag); @@ -932,14 +919,10 @@ { int cnt = MAX_ITEM_PER_DROP; - for (object *current = op->inv; current; ) + for (object *current = op->inv; current && cnt--; ) { object *next = current->below; - drop_object (pl, current, 0); - - if (--cnt <= 0) break; - current = next; } @@ -962,7 +945,7 @@ return; } - env = esrv_get_ob_from_count (pl, to); + object *env = esrv_get_ob_from_count (pl, to); if (!env) { LOG (llevDebug, "Player '%s' tried to move object to the unknown location (%d)\n", &pl->name, to);