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
➜ Another segmentation fault error
Another segmentation fault error
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Trom
(82 posts) Bio
|
Date
| Thu 02 Sep 2004 10:33 PM (UTC) |
Message
| I know its a general term, probably meaning something is null. I'll paste the function first and the error from gdb/cygwin.
Program received signal SIGSEGV, Segmentation fault.
0x004b1b23 in get_free_order_position (ch=0xa28bb20, tier=8448)
at music.c:1110
warning: Source file is more recent than executable.
1110 if ( ch->pcdata->skills[tier][x][0] < 1 )
(gdb) bt
#0 0x004b1b23 in get_free_order_position (ch=0xa28bb20, tier=8448)
at music.c:1110
#1 0x004b1b75 in trom_giveskill (ch=0xa28bb20, skill_num=-1, percent=1)
at music.c:1123
#2 0x0044e457 in nanny (d=0xa28a4b8, argument=0xa28ae35 "human")
at comm.c:3011
#3 0x00449945 in game_loop_unix (control=4, wwwcontrol=5) at comm.c:862
#4 0x004491ce in main (argc=1, argv=0xa041610) at comm.c:472
This error occurs when the character is being loaded and skills are being placed into the ch structure. The tier is taken from the skills table which i modified accordingly, it should be perfect, no values are under 0. x integer counts from 0 to 19 (thats how big the 2nd part of the array is [skills[4][19][1]]. Now for the function itself
int get_free_order_position ( CHAR_DATA *ch, int tier ) {
if ( tier < 0 || ch->pcdata == NULL )
return -1;
int x = 0;
while ( x <= 19 ) {
// if theres a vacant skill position, return the location!
if ( ch->pcdata->skills[tier][x][0] < 1 )
return x;
x++;
}
// no positions free for the class
return -1;
}
I've been here a while ago asking questions about errors. I've used all the previous methods of error reductions and came across this. I've checked out ch->pcdata and ch->pcdata->skills and they are not null. They are both initialized around the time the name is entered. The process crashes after the name and password is taken and the new character chooses a race. It then goes to class selection i think, or sometime before that it just flops with a segmentation fault error.
If you guys got any suggestions, it would be appreciated. | Top |
|
Posted by
| Trom
(82 posts) Bio
|
Date
| Reply #1 on Sat 04 Sep 2004 11:51 PM (UTC) |
Message
| I figured it out. When they enter the race, around that time the mud adds all the racial skills (found in pc_race_table[]). The while loop checked if the name was null, when your supposed to check for the first char being '\0'. Basically the first racial skill came out null for some reason and that sent a -1 around into the arrays. | 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.
9,834 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top