Greetings,
I've decided to change all classes on my mud last night, so I went crazy on
const.c adding everything. I added the new classes in class_table,
added/replaced stuff in group_table and change every item in skills_table
putting levels and learning difficulties to all the skills and spells. In
total, I have now 14 all-new classes. Also I incremented MAX_CLASS and
MAX_GROUP in merc.h and some other needed stuff here and there.
So I did a clean compile and ran it. It was ok, I created a new char and all
the classes were there, with no creation points problems (like reseting to 0
after 40 cps). I got one of the new classes, customized the char heavilly
adding lots of skills and booya, they were all there. When I type
skill/spell all, it's all fine. But I got problems with my immortal char.
I thought it would be something related to pfile, but it isn't. When I enter
with my imm and type 'spell all' ('skill all' command works fine), the mud
crashes. Also if I set all skills/spells in a mortal char (using set skill)
and he/she types 'spell all', the mud also crashes.
I ran gdb on it and I got this line:
#0 0x80950db in do_spells (ch=0x3031477b, argument=0x5c <Address 0x5c out
of bounds>) at skills.c:334
334 if ((level = skill_table[sn].skill_level[ch->class]) <
LEVEL_HERO + 1
It looks like an out-of-range problem. Working around this code, before this
line I've put a code to add in a debug file the values of sn, ch->class and
MAX_SKILL just to make sure I wasn't doing something wrong. The last line on
my debug file I get before the mud crashes is this:
[15014] Ryu: [140] Spell: fire breath (92). Class: 2.
Where 140 is MAX_SKILL, 92 is the spell position in the skill_table, and
class is... the class.
Strangely, when a mortal without all spells type 'spell all' and the mud
doens't crash, the last line I get is:
[ 3700] Ralf: [140] Spell: wands (139). Class: 8.
...that's just fine, it passes through frost breath spell and nothing wrong
happens. But when I set this normal char with 'set spell char all 100' the
mud crashes when he/she type 'spell all', and the last line I get is just
the 'fire breath (92)' one.
The portion of the skill table with the fire/frost breath is located:
{
"fire breath",
{99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99},
{1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2},
spell_fire_breath, TAR_CHAR_OFFENSIVE, POS_FIGHTING,
NULL, SLOT (201), 200, 24,
"blast of flame", "The smoke leaves your eyes.", ""},
{
"frost breath",
{99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99},
{1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2},
spell_frost_breath, TAR_CHAR_OFFENSIVE, POS_FIGHTING,
NULL, SLOT (202), 125, 24,
"blast of frost", "!Frost Breath!", ""},
{
"gas breath",
{99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99},
{1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2},
spell_gas_breath, TAR_IGNORE, POS_FIGHTING,
NULL, SLOT (203), 175, 24,
"blast of gas", "!Gas Breath!", ""},
.... and so on (I've set the spells to level 99 for testing purposes).
Also I noticed that only chars with the spell frost_breath learned crash the
mud, but I may be wrong...
I guess this explains my problem pretty well :)
Thans in advance,
-- Kakeru