--- deliantra/server/server/c_object.C 2007/12/17 08:35:49 1.63 +++ deliantra/server/server/c_object.C 2008/04/20 00:44:13 1.64 @@ -252,10 +252,6 @@ static void pick_up_object (object *pl, object *op, object *tmp, int nrof) { - /* buf needs to be big (more than 256 chars) because you can get - * very long item names. - */ - char buf[HUGE_BUF]; object *env = tmp->env; uint32 weight, effective_weight_limit; int tmp_nrof = tmp->nrof ? tmp->nrof : 1; @@ -282,10 +278,7 @@ if (tmp->inv) weight += tmp->carrying * (100 - tmp->stats.Str) / 100; - if (pl->stats.Str <= MAX_STAT) - effective_weight_limit = weight_limit[pl->stats.Str]; - else - effective_weight_limit = weight_limit[MAX_STAT]; + effective_weight_limit = weight_limit [min (MAX_STAT, pl->stats.Str)]; if ((pl->weight + pl->carrying + weight) > effective_weight_limit) { @@ -327,11 +320,9 @@ } if (QUERY_FLAG (tmp, FLAG_UNPAID)) - sprintf (buf, "%s will cost you %s.", query_name (tmp), query_cost_string (tmp, pl, F_BUY | F_SHOP)); + new_draw_info_format (NDI_UNIQUE, 0, pl, "%s will cost you %s.", query_name (tmp), query_cost_string (tmp, pl, F_BUY | F_SHOP)); else - sprintf (buf, "You pick up the %s.", query_name (tmp)); - - new_draw_info (NDI_UNIQUE, 0, pl, buf); + new_draw_info_format (NDI_UNIQUE, 0, pl, "You pick up the %s.", query_name (tmp)); tmp = insert_ob_in_ob (tmp, op); @@ -374,6 +365,7 @@ new_draw_info_format (NDI_UNIQUE, 0, op, "You can't pick up the %s.", &alt->name); goto leave; } + tmp = alt; } else @@ -392,6 +384,7 @@ tmp = stop_item (tmp); if (tmp == NULL) goto leave; + need_fix_tmp = 1; if (!can_pick (op, tmp)) goto leave; @@ -406,7 +399,9 @@ count = tmp->nrof; /* container is open, so use it */ - if (op->container) + if (tmp->flag [FLAG_STARTEQUIP]) + alt = op; + else if (op->container) { alt = op->container; if (alt != tmp->env && !sack_can_hold (op, alt, tmp, count)) @@ -435,6 +430,7 @@ */ alt = op; } + #ifdef PICKUP_DEBUG LOG (llevDebug, "Pick_up(): %s picks %s (%d) and inserts it %s.\n", op->name, tmp->name, op->contr->count, alt->name); #endif @@ -535,10 +531,7 @@ for (tmp = op->below; tmp; tmp = tmp->below) if (!tmp->invisible) { - char buf[MAX_BUF]; - - sprintf (buf, "You can't pick up a %s.", &tmp->name); - new_draw_info (NDI_UNIQUE, 0, op, buf); + new_draw_info_format (NDI_UNIQUE, 0, op, "You can't pick up a %s.", &tmp->name); break; }