OK now this is really bugging me. I changed the spell_parser to use function pointers which were stored in spell_info and were initialized by the cal to spello. The code worked fine until I changed my file extensions to .cpp. I would appeciate any help. The code follows: struct spell_info_type { byte min_position; /* Position for caster */ int mana_min; /* Min amount of mana used by a spell (highest lev) */ int mana_max; /* Max amount of mana used by a spell (lowest lev) */ int mana_change; /* Change in mana used by spell from lev to lev */ bool is_innate[NUM_RACES]; int min_level[NUM_CLASSES]; byte violent; int targets; /* See below for use with TAR_XXX */ void (*spell_function) (int level, struct char_data *ch, struct char_data *victim, struct obj_data *obj, int spellnum); }; void spello(int spl, int max_mana, int min_mana, int mana_change, int minpos, int targets, int violent, void (*func)) { int i; for (i = 0; i < NUM_CLASSES; i++) spell_info[spl].min_level[i] = LVL_IMMORT; spell_info[spl].mana_max = max_mana; spell_info[spl].mana_min = min_mana; spell_info[spl].mana_change = mana_change; spell_info[spl].min_position = minpos; spell_info[spl].targets = targets; spell_info[spl].violent = violent; *spell_info[spl].spell_function = func; //ERROR points here } spello(SPELL_ACID_BLAST, 40, 30, 2, POS_FIGHTING, TAR_CHAR_ROOM | TAR_FIGHT_VICT, TRUE, spell_acid_blast); Now heres the error that popped up after the file extension change: error C2440: '=' : cannot convert from 'void *' to 'void (__cdecl *)(int,struct char_data *,struct char_data *,struct obj_data *,int)' Conversion from 'void*' to pointer to non-'void' requires an explicit cast This error points to line 911 in the spello function. It looks to me like it thinks func is just a normal void pointer and spell_function is a void function pointer and it cant convert. I have experimented casting it, but can you cast to a function pointer. Anyway, Im out of ideas. Thanks for the help. +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST