… | |
… | |
324 | sum_weight (object *op) |
324 | sum_weight (object *op) |
325 | { |
325 | { |
326 | long sum; |
326 | long sum; |
327 | object *inv; |
327 | object *inv; |
328 | |
328 | |
329 | for (sum = 0, inv = op->inv; inv != NULL; inv = inv->below) |
329 | for (sum = 0, inv = op->inv; inv; inv = inv->below) |
330 | { |
330 | { |
331 | if (inv->inv) |
331 | if (inv->inv) |
332 | sum_weight (inv); |
332 | sum_weight (inv); |
|
|
333 | |
333 | sum += inv->carrying + inv->weight * (inv->nrof ? inv->nrof : 1); |
334 | sum += inv->carrying + inv->weight * (inv->nrof ? inv->nrof : 1); |
334 | } |
335 | } |
335 | |
336 | |
336 | if (op->type == CONTAINER && op->stats.Str) |
337 | if (op->type == CONTAINER && op->stats.Str) |
337 | sum = (sum * (100 - op->stats.Str)) / 100; |
338 | sum = (sum * (100 - op->stats.Str)) / 100; |
… | |
… | |
446 | */ |
447 | */ |
447 | while (owner->owner) |
448 | while (owner->owner) |
448 | owner = owner->owner; |
449 | owner = owner->owner; |
449 | |
450 | |
450 | this->owner = owner; |
451 | this->owner = owner; |
|
|
452 | } |
|
|
453 | |
|
|
454 | void |
|
|
455 | object::set_weapon (object *ob) |
|
|
456 | { |
|
|
457 | if (current_weapon == ob) |
|
|
458 | return; |
|
|
459 | |
|
|
460 | current_weapon = ob; |
|
|
461 | new_draw_info_format (NDI_UNIQUE, 0, this, "You switch to your %s.", &ob->name); |
|
|
462 | update_stats (); |
451 | } |
463 | } |
452 | |
464 | |
453 | /* Zero the key_values on op, decrementing the shared-string |
465 | /* Zero the key_values on op, decrementing the shared-string |
454 | * refcounts and freeing the links. |
466 | * refcounts and freeing the links. |
455 | */ |
467 | */ |
… | |
… | |
2583 | } |
2595 | } |
2584 | |
2596 | |
2585 | const char * |
2597 | const char * |
2586 | object::debug_desc () const |
2598 | object::debug_desc () const |
2587 | { |
2599 | { |
2588 | static char info[256 * 4]; |
2600 | static char info[3][256 * 4]; |
|
|
2601 | static int info_idx; |
|
|
2602 | |
2589 | return debug_desc (info); |
2603 | return debug_desc (info [++info_idx % 3]); |
2590 | } |
|
|
2591 | |
|
|
2592 | const char * |
|
|
2593 | object::debug_desc2 () const |
|
|
2594 | { |
|
|
2595 | static char info[256 * 4]; |
|
|
2596 | return debug_desc (info); |
|
|
2597 | } |
2604 | } |
2598 | |
2605 | |
2599 | struct region * |
2606 | struct region * |
2600 | object::region () const |
2607 | object::region () const |
2601 | { |
2608 | { |