Please post the values of the problem variables when you post gdb
output, it makes it easier to figure out why it's doing what it's doing
:) if you don't know how to do this, then once you bt and get your
stack, chances are you'll be going to frame 0 (sometimes it may crash
down the line in a library function and you'll actually have to jump to
frame 3 or 4 to see the line that caused it), so type "frame 0", and
it'll show you line 1057 in this case, which was:
if (!IS_IMMORTAL(ch) && !IS_NPC(ch) &&
ch->in_room->sector_type == SECT_WATER_DEEP)
so in this case, type "print ch" to get the value of that variable... if
it's 0x0, that means it's NULL and that's why it's crashing, if it's not
that, then you can try printing other values that it's referencing like
"print ch->in_room"... although in these cases it's not going to print
anything readable, so you may want to try referencing a field that has
readable data, like "print ch->name" and "print ch->in_room->vnum"...
anyway, capture all that kind of stuff and post it with your gdb output
:)
wavewave
Richard Lindsey.
-----Original Message-----
From: Rick St Jean [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 27, 2004 1:09 PM
To: [email protected]
Subject: Re: tier/remort
You guys are all really awesome, thanks for helping.
I changed the ascend function to extract the char then to load it.
when I extract it ... I get a bug log saying the char is null,
here is the new function. It now bombs in a different place. in
update.c
(gdb) bt
#0 0x080bdba8 in char_update () at update.c:1057
#1 0x080c045a in update_handler () at update.c:2483
#2 0x0807a1f5 in game_loop_unix (control=6) at comm.c:1485
#3 0x08079876 in main (argc=2, argv=0xbffff964) at comm.c:916
#4 0x40086c57 in ?? ()
void ascend_complete(CHAR_DATA * ch)
{
DESCRIPTOR_DATA *d;
char player_name[MAX_INPUT_LENGTH];
if (IS_NPC(ch) || (d = ch->desc) == NULL)
return;
if (ch->pcdata->confirm_remort) {
stop_fighting(ch, TRUE);
ch->tier++;
char_from_room(ch);
ch->level = 1;
ch->exp = 0;
ch->max_hit /= 10;
ch->max_mana /= 10;
ch->max_move /= 10;
ch->hit = UMIN(ch->hit, ch->max_hit);
ch->mana = UMIN(ch->mana, ch->max_mana);
ch->move = UMIN(ch->move, ch->max_move);
ch->pcdata->perm_hit = ch->max_hit;
ch->pcdata->perm_mana = ch->max_mana;
ch->pcdata->perm_move = ch->max_move;
ch->pcdata->confirm_remort = FALSE;
save_char_obj(ch);
sprintf( player_name, "%s", capitalize( ch->name ));
extract_char( ch, TRUE );
load_char_obj( d, player_name );
d->connected = CON_BEGIN_ASCEND;
return;
}
}
it bombs at
if (!IS_IMMORTAL(ch) && !IS_NPC(ch) &&
ch->in_room->sector_type == SECT_WATER_DEEP)
{
OBJ_DATA *obj;
/* Is his boat Sea Worthy? Probably not for
long >=> */
if ((obj = get_boat(ch)) != NULL
&& (number_percent() < 30))
{
obj->item_type = ITEM_TRASH;
if (IS_SET(obj->extra_flags,
ITEM_FLOATS))
{
REMOVE_BIT(obj->extra_flags,
ITEM_FLOATS);
}
obj_from_char(obj);
obj_to_room(obj, ch->in_room);
act("$n's $p is leaking!!", ch, obj,
NULL,
TO_ROOM);
act("Your $p is leaking!!", ch, obj,
NULL,
TO_CHAR);
}
}
so I am guessing that I should put in something to continue the for loop
if
connected
> CON_PLAYING.?
Is this just a spaghetti code fix or something practical?
Rick
At 10:18 AM 7/27/2004, you wrote:
>That shouldn't change anything. If it was blowing up assigning
>wch->next_player to wch_next, then it should blow up assigning it to a
>different variable.
>
>The for statement appears valid:
>
> >> for (wch = player_list; wch != NULL; wch = wch_next)
> >> > > {
> >> > > wch_next = wch->next_player; <=== bombs her
>
>The only way it could blow up on this line is if wch itself was null,
or
>if wch->next_player was pointing to memory it shouldn't be. The former
>can be ruled out by the condition of the for loop. The latter, on the
>other hand, is not checked until the next iteration of the loop, and is
>also the likely candidate based on what Rick has told us he's working
on.
>
>It sounds like the problem is the way you are removing the character
from
>the list. If you post that piece of code to the list maybe we can help
>you out.
>
>Just as an idea, the way our remort code works is by calling
>extract_char(), then unlinking the file, then calling load_char_obj().
>Basically that results in a cleaned out CHAR_DATA structure that we
>restore the stats we want to retain into before pushing the character
into
>a remort step of creation.
>
> > The player not being valid is probably right.
> >
> > instead of using "wch->next_player" in the for statement, add
"CHAR_DATA
> > *next_player;" at the top of your function. Put "wch = next_player"
> > instead
> > of "wch = wch->next_player" in the for statement, and add
"next_player =
> > wch->next_player;" as the first line inside the for { }.
> >
> > - Valnir
> >
> > ----- Original Message -----
> > From: "Krayzie K" <[EMAIL PROTECTED]>
> > To: <[email protected]>
> > Sent: Tuesday, July 27, 2004 1:15 AM
> > Subject: RE: tier/remort
> >
> >
> >> I am thinking that wch->next_player; is not valid any more as the
> > character
> >> has been taken out of the player_list when put into the remort
process.
> >>
> >> I have had this problem before, actually when trying to re-do my
remort
> >> system as well.
> >>
> >> -----Original Message-----
> >> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
Rick St
> > Jean
> >> Sent: Monday, July 26, 2004 10:53 PM
> >> To: [email protected]
> >> Subject: Re: tier/remort
> >>
> >> Undefined command: "qt". Try "help".
> >> (gdb) bt
> >> #0 aggr_update () at update.c:2151
> >> #1 0x080c030f in update_handler () at update.c:2517
> >> #2 0x0807a1f5 in game_loop_unix (control=6) at comm.c:1485
> >> #3 0x08079876 in main (argc=2, argv=0xbffff964) at comm.c:916
> >> #4 0x40086c57 in ?? ()
> >>
> >>
> >> line 2151 is wch_next = wch->next_player;
> >>
> >> At 11:45 PM 7/26/2004, you wrote:
> >> >You say it's crashing on an update? Why does GDB say that it's
crashing
> >> >over?
> >> >
> >> >
> >> >----- Original Message -----
> >> >From: "Rick St Jean" <[EMAIL PROTECTED]>
> >> >To: <[email protected]>
> >> >Sent: Monday, July 26, 2004 9:21 PM
> >> >Subject: tier/remort
> >> >
> >> >
> >> > > I am totally stumped, and I know I am getting in over my head.
> >> > >
> >> > > I am trying to put in new tier code, that resets a player to
level 1
> > and
> >> > > allows them
> >> > > to choose a new path. I was trying to modify some existing
tier and
> >> >remort
> >> > > code.
> >> > > The remort code deletes a player file and all data, which is no
good
> >> since
> >> > > I want
> >> > > to keep all my skills/spells/stats. It works some of the time
as
> > long
> >> as
> >> > > the update
> >> > > doesn't hit while you are in the tier process. If there is a
tick,
> > and
> >> > > update runs,
> >> > > then the code blows up when ever something accesses the
player_list.
> > I
> >> >cannot
> >> > > figure how to pull someone out of the list. I set d->connected
=
> >> > > CON_BEGIN_ASCEND;
> >> > >
> >> > >
> >> > > void ascend_complete(CHAR_DATA * ch)
> >> > > {
> >> > > DESCRIPTOR_DATA *d;
> >> > >
> >> > > if (IS_NPC(ch) || (d = ch->desc) == NULL)
> >> > > return;
> >> > >
> >> > > if (ch->pcdata->confirm_remort)
> >> > > {
> >> > > save_char_obj(ch);
> >> > > stop_fighting(ch, TRUE);
> >> > > reduce_known_skills(ch);
> >> > > ch->pcdata->class_remort[ch->class] = TRUE;
> >> > > ch->pcdata->tier_list[class_table[ch->class].class_type]++;
> >> > >
> >> > > d->character = ch;
> >> > >
> >> > > ch->level = 1;
> >> > > ch->exp = 0;
> >> > > ch->max_hit /= 10;
> >> > > ch->max_mana /= 10;
> >> > > ch->max_move /= 10;
> >> > > ch->max_blood /= 10;
> >> > > ch->hit = UMIN(ch->hit, ch->max_hit);
> >> > > ch->mana = UMIN(ch->mana, ch->max_mana);
> >> > > ch->move = UMIN(ch->move, ch->max_move);
> >> > > ch->blood = UMIN(ch->blood, ch->max_blood);
> >> > > ch->pcdata->perm_hit = ch->max_hit;
> >> > > ch->pcdata->perm_mana = ch->max_mana;
> >> > > ch->pcdata->perm_move = ch->max_move;
> >> > >
> >> > > write_to_buffer( d, "Now beginning the ascention
process.\n\r\n\r",
> > );
> >> > >
> >> > > d->connected = CON_BEGIN_ASCEND;
> >> > > ch->pcdata->confirm_remort = FALSE;
> >> > > return;
> >> > > }
> >> > > }
> >> > >
> >> > > It bombs on the code below when I am in the nanny
CON_BEGIN_ASCEND
> >> > >
> >> > > CREF(wch_next, CHAR_NEXT);
> >> > > for (wch = player_list; wch != NULL; wch = wch_next)
> >> > > {
> >> > > wch_next = wch->next_player; <=== bombs here.
> >> > > if (wch->in_room == NULL || IS_NPC(wch) || wch->level >=
> >> >LEVEL_IMMORTAL
> >> > > || wch->in_room == NULL || wch->in_room->area->empty)
> >> > > continue;
> >> > >
> >> > >
> >> > > --
> >> > > ROM mailing list
> >> > > [email protected]
> >> > > http://www.rom.org/cgi-bin/mailman/listinfo/rom
> >> > >
> >>
> >>
> >> --
> >> ROM mailing list
> >> [email protected]
> >> http://www.rom.org/cgi-bin/mailman/listinfo/rom
> >>
> >>
> >> --
> >> ROM mailing list
> >> [email protected]
> >> http://www.rom.org/cgi-bin/mailman/listinfo/rom
> >>
> >
> >
> >
> > --
> > ROM mailing list
> > [email protected]
> > http://www.rom.org/cgi-bin/mailman/listinfo/rom
> >
>
>
>--
>ROM mailing list
>[email protected]
>http://www.rom.org/cgi-bin/mailman/listinfo/rom
--
ROM mailing list
[email protected]
http://www.rom.org/cgi-bin/mailman/listinfo/rom