Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

coding question




I'm really glad to see that something is being done with the code.
Thanks to all who are making the effort!

Anyway, my question is this:

Suppose a spellcaster creates an object which in turn creates another
object.

Spell-caster -->  object 1  --> object 2

object 1 is owned by the spell-caster
who owns object 2?  spell-caster or object 1?
object 1 calls cast-spell to create object 2.


I wrote a spell once called meteor swarm.  It created a 'swarm' object,
an invsible object which would cast a 'meteor' spell every time it 'moved'.
Now, every time one of the meteors would kill something
the original spellcaster would not register a kill.

I took this to mean that the swarm object was getting the kill.... and
the experience!

This kind of upset me, so I rewrote the set_owner function in (object.c?)
to trace all the way back to the original owner object, so that
object 2 was very definitely owned by spell-caster.

I think this may have had some funny side effects, but i really am
not sure that this is the cause.

What if anything is this change likely to break?

Also, what happens when the owner of an object dies and is removed
from a map?  the "object *owner" field of the object with a defunct owner
is not zeroed is it?  For cones, I've observed, the cone is removed when
the owner is removed.   However, for certain other spells such as fireball,
this does NOT happen.

How does this work?


Regards,

PeterM