[CODE] Some freeky advance problems

From: Phillip A Ames (kirk47@juno.com)
Date: 08/22/99


Hi all,
I recently coded a multiclassing system for my MUD and I'm having the
toughest time getting it to work with the 'advance' command.  The way I
have it set up is that you use the 'set' command to set the classnumber
that you'll be advancing them in(i.e. 'set Grathol advance 0' would set
Grathol's class that he'd be advancing in to #0, or the 'Command' class).
 Then, do_advance is supposed to level them up in that class by fetching
how much XP it should give them from level_exp.  Since all the levels for
each of the classes need the same EXP to level, I made level_exp's
declaration void level_exp(int level) and this is how I'm calling it from
do_advance...

  log("(GC) %s has advanced %s to level %d (from %d)",
          GET_NAME(ch), GET_NAME(victim), newlevel, oldlevel);
  advance_xp(victim, (level_exp(newlevel) - GET_EXP(victim)),
GET_ADVANCE_CLASS(victim));

  save_char(victim, NOWHERE);

And here's the function 'advance_xp'

void advance_xp(struct char_data * ch, int gain, int classnum)
{
        GET_EXP(ch) += gain;

  if (GET_EXP(ch) < 0)
    GET_EXP(ch) = 0;

  while(level_exp((GET_CLASS_LEV(ch, classnum) + 1) - GET_EXP(ch)) < 0)
        advance_level(ch, classnum);
}

Now, I've been going over this for the better part of today and I simply
can't figure out whats wrong.  This is what comes up in the syslogs after
I type 'advance grathol {level}'  and his level doesn't change at all.
Can anyone shed some light on this?

Aug 22 21:50:01 :: (GC) Gowron has advanced Grathol to level 10 (from 1)
Aug 22 21:50:01 :: SYSERR: Requesting exp for invalid level!
Aug 22 21:50:18 :: (GC) Gowron has advanced Grathol to level 25 (from 1)
Aug 22 21:50:18 :: SYSERR: Requesting exp for invalid level!
Aug 22 21:50:36 :: (GC) Gowron has advanced Grathol to level 50 (from 1)
Aug 22 21:50:36 :: SYSERR: Requesting exp for invalid level!
Aug 22 21:50:41 :: (GC) Gowron has advanced Grathol to level 60 (from 1)
Aug 22 21:50:41 :: SYSERR: Requesting exp for invalid level!

Thanks in advance...

-Phillip

Phillip Ames    | Implementor of Apocalypse MUD
kirk47@juno.com | telnet://startrek.circlemud.net:1701
ICQ: 8778335    | AOL IM: Grathol
http://members.xoom.com/Gowron/index.html

___________________________________________________________________
Get the Internet just the way you want it.
Free software, free e-mail, and free Internet access for a month!
Try Juno Web: http://dl.www.juno.com/dynoget/tagj.


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST