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

From: Xual (xual@danathara.dhs.org)
Date: 03/19/00


On Sun, 19 Mar 2000, Christopher Daly wrote:

> I looked up structure pointer operators in my C book and it
> said that the value to the left of the operator was a pointer
> declared to point to a structure, and the value on the right
> was actually a name of a member of that structure....
>
> I know i'm missing something, but there are no structures named
> ch...there is no member called player...and i would think that
> if ch was somehow initialized to point to struct char_data
> you could just write  ch->level...

A struct is a user-defined type, you create variables of these types like
you would create any other type of variable. ie:

int foo;
char *bar;
struct char_data *ch;

struct char_data has all kinds of members, including level.  Macros make
life easier by making code easier to read.  GET_LEVEL(ch) is replaced with
ch->level before it goes to the compiler.  The ch part is just a placeholder
(as someone else mentioned), it could be replaced by whatever you like in
the definition.  ch is used because variables of struct char_data are
commonly called that.

> ASk one question and all of a sudden you got ten new ones, and you're
> 11 behind :)

Isn't that the truth...

Xual
--

"When we are happy we are always good, but when we are good, we are
 not always happy"
        -= Oscar Wilde =-


     +------------------------------------------------------------+
     | 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