… | |
… | |
429 | } |
429 | } |
430 | |
430 | |
431 | /* |
431 | /* |
432 | * Sets the owner and sets the skill and exp pointers to owner's current |
432 | * Sets the owner and sets the skill and exp pointers to owner's current |
433 | * skill and experience objects. |
433 | * skill and experience objects. |
|
|
434 | * ACTUALLY NO! investigate! TODO |
434 | */ |
435 | */ |
435 | void |
436 | void |
436 | object::set_owner (object *owner) |
437 | object::set_owner (object *owner) |
437 | { |
438 | { |
|
|
439 | // allow objects which own objects |
438 | if (!owner) |
440 | if (owner) |
439 | return; |
|
|
440 | |
|
|
441 | /* next line added to allow objects which own objects */ |
|
|
442 | /* Add a check for ownercounts in here, as I got into an endless loop |
|
|
443 | * with the fireball owning a poison cloud which then owned the |
|
|
444 | * fireball. I believe that was caused by one of the objects getting |
|
|
445 | * freed and then another object replacing it. Since the ownercounts |
|
|
446 | * didn't match, this check is valid and I believe that cause is valid. |
|
|
447 | */ |
|
|
448 | while (owner->owner) |
441 | while (owner->owner) |
449 | owner = owner->owner; |
442 | owner = owner->owner; |
450 | |
443 | |
451 | this->owner = owner; |
444 | this->owner = owner; |
452 | } |
445 | } |
453 | |
446 | |
454 | int |
447 | int |