[Code] Syntax Explanations

From: DJ Pure (pure@ozramp.net.au)
Date: 01/18/97


G'day All,
	  I've got a few lines of code which I need to be explained .. I hope this
all makes sense ...


Question 1.
What is the difference in these two lines :-

*Line 1*		obj->spell_info = object.spell_info;
*Line 2*	
memcpy(&obj->spell_info,object.spell_info,sizeof(obj->spell_info));

Do they do the same thing? I was told that they do.


Question 2.
Becuase obj->spell_info is NOT a pointer to a structure, but spell_info is
a structure itself 
[struct obj_spell_info spell_info;		// The Spell Book Information ], how do
i make the entire structure [spell_info] equal NULL, zero, etc. Becuase
like someone pointed out in a previous post, have every object with this
structure (which would be redundant) is A LOT of wasted memory.


Question 3.
I have this if statement in my code.
The following variables (with their current values) are this [taken from
printf AND the MSVC *watch* command]

GET_CLASS(ch) returns the number 9.
#define CLASS_CONJURER 9

	// First check to see that they can scroll spells.
	if ( (GET_CLASS(ch) != CLASS_CONJURER) ||
		 (GET_CLASS(ch) != CLASS_INVOKER) ||
		 (GET_CLASS(ch) != CLASS_ILLUSIONIST) ||
		 (GET_CLASS(ch) !=CLASS_NECROMANCER) ||
		 (GET_CLASS(ch) != CLASS_SORCERER)) {
		// Not a valid class to scroll, so leave please.
		send_to_char ("Only those with the ability to cast arcane spells can
scribe scrolls.\n", ch);
		return;
	}
Now this statement goes INSIDE this if statement, which it shouldn't as i
told it to only go inside if it DOESN'T equal one of the classes. Why is it
going inside ??? I've gone over it SO many times .. it shouldn't be going
inside. Those are simple logical OR i have used, right?

Thanks to all those who give some advice. All flames go into recyling.
Jussy.


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



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