Skip to content

Commit

Permalink
Update skills.c
Browse files Browse the repository at this point in the history
  • Loading branch information
ozgyilmaz committed Nov 13, 2021
1 parent 61fdeeb commit 17576e8
Showing 1 changed file with 0 additions and 91 deletions.
91 changes: 0 additions & 91 deletions src/skills.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,94 +352,3 @@ void check_improve( CHAR_DATA *ch, int sn, bool success, int multiplier )
}
}
}

/* recursively adds a group given its number -- uses group_add */
void gn_add( CHAR_DATA *ch, int gn)
{
int i;

ch->pcdata->group_known[gn] = TRUE;
for ( i = 0; i < MAX_IN_GROUP; i++)
{
if (group_table[gn].spells[i] == NULL)
break;
group_add(ch,group_table[gn].spells[i],FALSE);
}
}

/* recusively removes a group given its number -- uses group_remove */
void gn_remove( CHAR_DATA *ch, int gn)
{
int i;

ch->pcdata->group_known[gn] = FALSE;

for ( i = 0; i < MAX_IN_GROUP; i ++)
{
if (group_table[gn].spells[i] == NULL)
break;
group_remove(ch,group_table[gn].spells[i]);
}
}

/* use for processing a skill or group for addition */
void group_add( CHAR_DATA *ch, const char *name, bool deduct)
{
int sn,gn;

if (IS_NPC(ch)) /* NPCs do not have skills */
return;

sn = skill_lookup(name);

if (sn != -1)
{
if (ch->pcdata->learned[sn] == 0) /* i.e. not known */
{
ch->pcdata->learned[sn] = 1;
if (deduct)
ch->pcdata->points += skill_table[sn].rating;
}
return;
}

/* now check groups */

gn = group_lookup(name);

if (gn != -1)
{
if (ch->pcdata->group_known[gn] == FALSE)
{
ch->pcdata->group_known[gn] = TRUE;
if (deduct)
ch->pcdata->points += group_table[gn].rating;
}
gn_add(ch,gn); /* make sure all skills in the group are known */
}
}

/* used for processing a skill or group for deletion -- no points back! */

void group_remove(CHAR_DATA *ch, const char *name)
{
int sn, gn;

sn = skill_lookup(name);

if (sn != -1)
{
ch->pcdata->learned[sn] = 0;
return;
}

/* now check groups */

gn = group_lookup(name);

if (gn != -1 && ch->pcdata->group_known[gn] == TRUE)
{
ch->pcdata->group_known[gn] = FALSE;
gn_remove(ch,gn); /* be sure to call gn_add on all remaining groups */
}
}

0 comments on commit 17576e8

Please sign in to comment.