Re: [ Descriptors ] What happens at switch!?

From: Daniel Koepke (dkoepke@CALIFORNIA.COM)
Date: 09/02/97


On Tue, 2 Sep 1997, David Klasinc wrote:

-+ How to transfer the descriptor back? Sure there is ch->desc->original,
-+but whole desc-> was moved to the mob and now we have ch w/o desc and we
-+have mob->desc Am I right here?

The character is in the 'd->character' structure; that is, the active
character.  So to switch back from the character to the 'orginal' you
simply use 'ch->desc->original' as the original character.  If this
isn't what you're looking for, then I don't understand your question.
And you'd probably be better off to look at the do_switch() function,
anyway.

-+ if (ch->possessing) {
-+   ch->desc = ch->possessing->desc;

Why would you need to transfer back the original descriptor?  It's
a pointer, and isn't (to my knowledge) explicitly cleared, so it is
still pointing to the same place as it was before.  Hence, ch->desc
and ch->original->desc should be the same.  If this isn't true (and
it might not be), then I would suggest looking at the do_switch()
code.

-+   ch->possessing->desc = NULL;

I don't understand the need for "possessing", either.  d->character
is the active character data (mobile or otherwise); d->original is
the original character (always a PC, because mobs don't have descriptors
unless switched into).  Possessing would take the same place as
d->character; and it certainly doesn't belong in the char_data struct
unless you want mobiles to be able to possess other characters; and then
that requires a different infrastructure than the switch command
entirely.


--
Daniel Koepke -:- dkoepke@california.com -:-  [Shadowlord/Nether]
"Just being near you, sets my skin afire...
 Bitch, put down the flame thrower." -- A poem by Daniel Koepke


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST