if ((get_skill(ch, skill_table[sn].requisite)) < 1)
sh_int * pgsn; /* Pointer to associated gsn */
/*
* Assign gsn's for skills which have them.
*/
{
int sn;
for (sn = 0; sn < MAX_SKILL; sn++)
{
if (skill_table[sn].pgsn != NULL)
*skill_table[sn].pgsn = sn;
}
}
// this is a hackjob
bool has_requisit(CHAR_DATA *ch, sh_int *gsn) {
if(!ch || !gsn) return false;
for(int sn = 0; sn < MAX_SKILL; sn++) {
if(skill_table[sn].requisit == gsn) {
if(ch->pcdata->learned[sn] > 0)
return true;
}
}
return false;
}
// may be &skill_table, too tired to compile it myself.
if(has_requisit(ch, skill_table[skill_lookup("backstab")].requisit)) }
// do something
}
if (get_skill(ch, *skill_table[sn].requisite) < 1)
if (!ch->pcdata->learned[*skill_table[sn].requisite])
if (skill_table[sn].requisite != NULL && !ch->pcdata->learned[*skill_table[sn].requisite])
Here is an example skill in const.c: (&gsn_dagger is the pre-requisite skill necessary for backstab)
This compiles fine until I try to edit the function where you actually go to GAIN the skill in skills.c shown below:
Compiling this returns the error: array subscript is not an integer.
Which is true.
I've also tried it this way:
Which compiles but with a warning, saying: passing arg2 of 'get_skill' makes integer from pointer without a cast.
I've been fiddling with it for a while now but I just can't seem to comprehend what I need to do to fix this, any ideas?