Re: NEWBIE[CODE] making a new macro for spell types

From: Ron Martin (rmartin@cps.cmich.edu)
Date: 03/19/00


> --<SNIP>--
> #define GET_LEVEL(ch)   ((ch)->player.level)
>
> What i don't get is where does ch come in? i know it is a structure of
--<SNIP>--

#defines simply tell the preprocessor to expand certain text to other
things.  I'm sure that clears it up, so later.

Just kidding!!!!  The above example tells the computer to change all the
instances of "GET_LEVEL(ch)" to "((ch)->player.level)".  The "ch" could
be replaced by "x" or "character_player".  It just acts as a place
holder, in a way.  Whenever you put in your code

some_integer = GET_LEVEL(some_character);

it turns into:

some_integer = ((some_character)->player.level);

Now, how exactly your practice function works to get the data type from
the spell_info structure is hidden in your mind.  Perhaps you could
share a little more of that?

Ron Martin
rmartin@cps.cmich.edu


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



This archive was generated by hypermail 2b30 : 04/10/01 PDT