RE: Help with some Code debugging

"Richard Lindsey" <[email protected]>
Newsgroups gmane.games.devel.mud.rom
Message-ID <[email protected]>
Ok, a couple things I noticed, and some more info as well please :D
first of all, this wouldn't cause the crash, but it's something you can
condense:

In void train_skill:

---->     if (ch->skill_training == -1)
                    return;
         
          if (!IS_SET (ch->comm, COMM_IS_TRAINING))
          {
                    return;
          }
         
---->     temp = ch->skill_training;
         
---->     if (temp == 0)
                    return;
         
couldn't this be crunched into something like:

          if (ch->skill_training <= 0)

before the check for COMM_IS_TRAINING?     

I'd like to see the calculate_time_tnl and return_time_remaining
functions also please, especially return_time_remaining is crashing...

In do_train, you should probably change this:

                    int sn = skill_num_lookup(arg2);

to this:

                    int sn;

                    if ( ( sn = skill_num_lookup(arg2) ) > 0 )

to ensure it doesn't return a -1 or 0 (as per the check in
train_skill)... also I'm assuming you have checks in place for if
arg2[0] == '\0', if their
return_time_remaining(ch->skill_experience[sn])) > 0 (and not let them
use the train command right now if that's the case), etc. and just
didn't post those with your do_train function... but if not, you should
add those kinds of checks... also, what does this mean exactly?

"the bob is just a temp thing, it 'worked' for a second before i 
recalculated the time"

and one more thing, how often is skill_update called? Once per tick,
pulse, 2 ticks, etc?  and if you could crash it once and post the gdb
info (with backtrace) that'd probably be helpful also :D

Richard Lindsey.
-- 
ROM mailing list
[email protected]
Unsubscribe here ->>> http://www.rom.org/cgi-bin/mailman/listinfo/rom
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.