[NEWBIE][CODE] Simple Coding Question.

From: Justin Adler (spam@WORLD-DOMINATION.COM.AU)
Date: 08/21/02


Hi Folks.

   a very simple question here.

If i have the following ....

[pure@echobase src]$ grep "GET_SPELL_BEING_MEMORISED" *.h
utils.h:432:#define GET_SPELL_BEING_MEMORISED(ch) (ch)->pc-
>spell_being_memorised

Only players (player structs) have a spell_being_memorised field.

Now, if i have the following code ..
if (!IS_NPC(victim) && GET_SPELL_BEING_MEMORISED(victim)) {
...
}

is that bad coding form?  Like, the second argument above will CRASH for
my mobs (my mobs ALL have *ch->pc == NULL, not the stock method).

So with the above IF statement, should it just LEAVE the 'if statement' at
the first argument if the victim is a mob, so then it won't crash becuase
it will not bother checking the second argumement becuase it's already
failed?

i hope i have explained myself clearly ;)

Thank you in advance for any n00b help.

-PK-

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT