Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ Programming ➜ General ➜ Wierd problem

Wierd problem

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Trom   (82 posts)  Bio
Date Tue 24 Feb 2004 01:49 AM (UTC)

Amended on Tue 24 Feb 2004 01:50 AM (UTC) by Trom

Message
This is an error which seemed to come out of nowhere, i didn't touch the is_dark function thing and thats were the error started.

I've been doing a lot of work every day now since the last prob (which you guys helped me fix). Currently i've looked over the code in gdb, backtraced and changed it a bit to see if it was maybe a syntax thing.

Cygwin error:
Program received signal SIGSEGV, Segmentation fault.
0x00414fac in do_look (ch=0x102a95c8, argument=0x451113 "") at act_info.c:1387
1387 send_to_char ( ch->in_room->name, ch );

BackTrace:
#0 0x00414fac in do_look (ch=0x102a95c8, argument=0x451113 "")
at act_info.c:1387
#1 0x00452c9c in nanny (d=0x102a7f60, argument=0x102a88dd " ") at comm.c:3364
#2 0x0044d88f in game_loop_unix (control=4, wwwcontrol=5) at comm.c:909
#3 0x0044d118 in main (argc=1, argv=0x100213a8) at comm.c:472

The error occurs after motd is loaded (the welcome screen for mortals). It originally had to do with a dark room check, so i commented out hte entire function to see if it was that. Now it seems to point to ch->in_room variable as the error.

As for the character, on creation its allocated new_char() so it shouldnt be that type of memory error. If you have any ideas, please post.

Top

Posted by Trom   (82 posts)  Bio
Date Reply #1 on Tue 24 Feb 2004 01:53 AM (UTC)
Message
This was the function causing the error originally before i commented it out.

bool room_is_dark ( ROOM_INDEX_DATA *pRoomIndex )
{
/*if ( pRoomIndex->light > 0 )
return FALSE;

if ( IS_SET ( pRoomIndex->room_flags, ROOM_DARK ) )
return TRUE;

if ( pRoomIndex->sector_type == SECT_INSIDE ||
pRoomIndex->sector_type == SECT_CITY )
return FALSE;

if ( weather_info.sunlight == SUN_SET ||
weather_info.sunlight == SUN_DARK )
return TRUE;*/

return FALSE;
}
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #2 on Tue 24 Feb 2004 02:48 AM (UTC)

Amended on Tue 24 Feb 2004 08:35 PM (UTC) by David Haley

Message
Chances are ch->in_room is null. Check out the code that's setting ch->in_room in your character loading routines.

Also, what's with the following?
1387 send_to_char ( ch->in_room->name, ch );

Why are you sending "ch" to "ch"?

Edit:
Duhhhhh... umm... never mind. That will teach me to post when I am on sleep and food deprivation. :/ I'm so used to my new format of send_to_char where the destination comes first, and the text second, that when I saw "ch" in second position I figured you were sending ch. Ah well. :)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Trom   (82 posts)  Bio
Date Reply #3 on Tue 24 Feb 2004 03:18 AM (UTC)
Message
thats sending the rooms title (a string) to the char.
Top

Posted by Nick Gammon   Australia  (23,140 posts)  Bio   Forum Administrator
Date Reply #4 on Tue 24 Feb 2004 04:27 AM (UTC)
Message
When you get to that point in gdb, try printing out all the things on the line in error. The line is:

1387 send_to_char ( ch->in_room->name, ch );


So, I would do this:

p ch
p ch->in_room
p ch->in_room->name

Now if one of those turns out to be zero, or some other nonsense, you have found the reason for the crash. Why it is bad, you would need to find out.


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


15,223 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.