Hello again. I am trying to put the finishing touches on my weapons-can-cast-spells in combat addition to the bpl8 code, but I hvae run into a slight problem in the hit() function. I am trying to check to see if my test object has a spell attached to it, but when the test tries to do the same thing for a npc, I'm getting what appears to be a deref. of a NULL pointer. Here is where my code is crashing: in fight.c: void hit(struct char_data * ch, struct char_data * victim, int type) { struct obj_data *wielded = GET_EQ(ch, WEAR_WIELD); int w_type, victim_ac, calc_thaco, dam, diceroll; extern int thaco[NUM_CLASSES][LVL_IMPL+1]; extern byte backstab_mult[]; extern struct str_app_type str_app[]; extern struct dex_app_type dex_app[]; /*This is HACK code thru here...I wanna see if I can deref the Lbolt correctly*//* THIS LINE SIGSEVS WHEN IT HITS A NPC...NO IDEA WHY.... */ fprintf(stderr, "The spell being used is: %d\n", wielded->spell_affect[0].spelltype); /*END OF HACK!!*/ And here is the relevant stuff from structs.h: /* Used in obj_file_elem *DONT CHANGE* */ struct obj_spell_type { ush_int spelltype; /*number of spell*/ ush_int level; /*level of spell*/ ush_int percentage; /*percentage of success*/ }; /* ================== Memory Structure for Objects ================== */ struct obj_data { obj_num item_number; /* Where in data-base */ room_num in_room; /* In what room -1 when conta/carr */ struct obj_flag_data obj_flags;/* Object information */ struct obj_affected_type affected[MAX_OBJ_AFFECT]; /* affects */ struct obj_spell_type spell_affect[MAX_SPELL_AFFECT]; I have no idea what is going on. Even if I give NPCs my test item to wield and use, I still get a crash. I know I'm missing SOMETHING, but I have not a clue of what it is. If I can get the $%^&* thing fixed, I will definitely post some diffs if the demand is great enough. TIA Mark Crichton P.S. I really hope this isn't some stupid pointer error I've overlooked....
This archive was generated by hypermail 2b30 : 12/07/00 PST