ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/object.C
(Generate patch)

Comparing deliantra/server/common/object.C (file contents):
Revision 1.141 by root, Sun Apr 29 21:44:34 2007 UTC vs.
Revision 1.142 by root, Mon Apr 30 04:25:29 2007 UTC

313 313
314 /* Everything passes, must be OK. */ 314 /* Everything passes, must be OK. */
315 return 1; 315 return 1;
316} 316}
317 317
318void
319player::set_range (rangetype r)
320{
321 shoottype = r;
322}
323
324/* 318/*
325 * sum_weight() is a recursive function which calculates the weight 319 * sum_weight() is a recursive function which calculates the weight
326 * an object is carrying. It goes through in figures out how much 320 * an object is carrying. It goes through in figures out how much
327 * containers are carrying, and sums it up. 321 * containers are carrying, and sums it up.
328 */ 322 */
330sum_weight (object *op) 324sum_weight (object *op)
331{ 325{
332 long sum; 326 long sum;
333 object *inv; 327 object *inv;
334 328
335 for (sum = 0, inv = op->inv; inv != NULL; inv = inv->below) 329 for (sum = 0, inv = op->inv; inv; inv = inv->below)
336 { 330 {
337 if (inv->inv) 331 if (inv->inv)
338 sum_weight (inv); 332 sum_weight (inv);
333
339 sum += inv->carrying + inv->weight * (inv->nrof ? inv->nrof : 1); 334 sum += inv->carrying + inv->weight * (inv->nrof ? inv->nrof : 1);
340 } 335 }
341 336
342 if (op->type == CONTAINER && op->stats.Str) 337 if (op->type == CONTAINER && op->stats.Str)
343 sum = (sum * (100 - op->stats.Str)) / 100; 338 sum = (sum * (100 - op->stats.Str)) / 100;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines