Ok, it successfully reads and writes the spells, now my problem lies in my do_memorize function. I mem heal, save and quit. Log back in and check pfile, heal is still in pfile as memorized. I use the command memorize and it shows that I have memmed no spells. I save and then check pfile again and it shows no memorized spells.
Here's part of my memorize function. I'm guessing I have to figure out how to call it to read words like in the save.c section:
do_memorize
for (level = 9; level > 0; level--)
{
marker = FALSE;
for (sn = 1; sn < MAX_SKILL; sn++)
{
if ( !skill_table[sn] || skill_table[sn]->spell_level != level )
continue;
total = 0;
for (i = 0; i < MAX_MEM_SPELLS; i++)
{
if ((ch->pcdata->memorized[ i] != 0)
&& (ch->pcdata->memorized[ i] == sn))
{
total++;
none = 0;
}
}
if (total == 0)
continue;
if (marker)
{
if (total < 2)
sprintf(buf, "%s %s\r\n", buf, skill_table[sn]->name);
else
sprintf(buf, "%s %s (x%d)\r\n",buf, skill_table[sn]->name, total);
}
else
{
if (total < 2)
sprintf(buf, "%s (level %2d) %s\r\n", buf, skill_table[sn]->spell_level,
skill_table[sn]->name);
else
sprintf(buf, "%s (level %2d) %s (x%d)\r\n",buf, skill_table[sn]->spell_level,
skill_table[sn]->name, total);
marker = TRUE;
}
}
}
if (none)
sprintf(buf, "%sNone.\r\n\r\n", buf);
else
//sprintf(buf, "%s\r\n", buf);
strcat(buf, "\r\n");
send_to_char(buf, ch);
if (ch->pcdata->memorizing[0] != 0)
{
mudstrlcpy(buf, "", MAX_STRING_LENGTH);
strcat(buf, "And you are currently memorizing the following spells:\r\n");
time_memming = ch->mem_time;
for (i = 0; i < MAX_MEM_SPELLS; i++)
{
if (ch->pcdata->memorizing[ i] != 0)
{
sprintf(buf, "%s %4d seconds (%2d) %s.\r\n",
buf,
time_memming,
skill_table[ch->pcdata->memorizing[ i]]->spell_level,
skill_table[ch->pcdata->memorizing[ i]]->name);
I'm guessing it has to do with the for loops and memorized[ i] parts needing to be called by skill_table[sn]->name again. |