Re: [Newbie] [CODE]

From: John Woods (JWoodsIII@AOL.COM)
Date: 07/14/98


In a message dated 98-07-13 22:41:38 EDT, siv@CYBERENET.NET writes:

<< what is the GET_RT macro, and do you have any gdb output from the crash?
 the only thing i could suggest (without further info) is to put a check
 for d->character before using the macro to make sure that the descriptor
 has a valid character attached to it.. >>

Function's changed some since last time so I'm sending it again. It now has a
check to see if the player is CON_PLAYING...only problem is as soon as it gets
to asking the sex of a new char (dunno about old chars, did a pwipe), it
crashes at the line "if (STATE(d) == CON_PLAYING) {. roundtime is an int in
struct char_data (structs.h), and in utils.h:

#define GET_RT(ch)                      ((ch)->roundtime)


comm.c--this is called from heartbeat() every 1 second (or is supposed to be,
but seems to be occuring more often than that).

void update_roundtime(void)
{
        struct descriptor_data *d, *next_d;
        log("For statement");
        for (d = descriptor_list; d; d = next_d) {
                log("Playing?");
                if (STATE(d) == CON_PLAYING) {
                        log("next_d = d->next");
                        next_d = d->next;
                        log("Checking to make sure RT >= 0.");
                        if (GET_RT(d->character) < 0) GET_RT(d->character) = 0;
                        log("Subracting 1 from RT");
                        if (GET_RT(d->character) > 0) GET_RT(d->character) -= 1;
                        log("Done.");
                }
        }
}

Any ideas? Thanx for the help. :-)

-Elrelet


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



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