



Geomancer

GroupAdministrators
Posts1,992
JoinedJul 26, 2005
sometime I need to check and see what all the temps etc can modify just to see if there is a good reason not to stop them at the max needed for the highest lol


Magician

GroupMembers
Posts128
JoinedApr 9, 2010
lol that would probably be a good idea
although right now I'm trying to implement some housing code and I need a bit of help
this is the housing snippet off of mudbytes I found a link to in a forum on here
which would be here:
http://www.mudbytes.net/index.php?a=files&s=viewfile&fid=2399
I've gotten quite a few of the errors and warnings gone, but one is stumping me
this is the line the error is complaining about
here is the whole thing
this is the error it is giving me and I'm kind of at a loss on how to fix it
also
my mud doesn't have levels so I would appreciate any ideas on how to fix this as well.
although right now I'm trying to implement some housing code and I need a bit of help
this is the housing snippet off of mudbytes I found a link to in a forum on here
which would be here:
http://www.mudbytes.net/index.php?a=files&s=viewfile&fid=2399
I've gotten quite a few of the errors and warnings gone, but one is stumping me
this is the line the error is complaining about
for ( mreset = addloc->area->first_reset; mreset; mreset = mreset_next ) { mreset_next = mreset->next; if ( is_room_reset( mreset, addloc, addloc->area ) ) delete_reset( addloc->area, mreset ); }
here is the whole thing
bool remove_house( CHAR_DATA *ch) { HOME_DATA *homedata = NULL; ROOM_INDEX_DATA *location, *addloc = NULL; OBJ_INDEX_DATA *key = NULL; OBJ_DATA *obj = NULL; CHAR_DATA *mob, *mob_next = NULL; EXIT_DATA *pexit = NULL; char filename[256]; sh_int i = 0; RESET_DATA *mreset, *mreset_next = NULL; for (homedata=first_home; homedata; homedata=homedata->next) { if (!str_cmp( homedata->name, ch->name)) break; } if (!homedata) return FALSE; if ((location = get_room_index(homedata->vnum[0])) == NULL) return FALSE; while ( (obj = location->first_content) != NULL) extract_obj(obj); for ( mob = location->first_person; mob; mob = mob_next) { mob_next = mob->next; if ( IS_NPC(mob)) extract_char( mob, TRUE); } sprintf( filename, "%s%s", HOUSE_DIR, capitalize( homedata->name ) ); remove( filename ); STRFREE(homedata->name); if (homedata->vnum[1] > 0) { for ( i=1; i < MAX_HOUSE_ROOMS; i++) { if (homedata->vnum[i] <= 0) continue; if((addloc = get_room_index(homedata->vnum[i])) == NULL) { homedata->vnum[i] = 0; continue; } for ( pexit = addloc->first_exit; pexit; pexit = pexit->next ) { if (pexit->rexit) extract_exit(pexit->to_room, pexit->rexit); } for ( mreset = addloc->area->first_reset; mreset; mreset = mreset_next ) { mreset_next = mreset->next; if ( is_room_reset( mreset, addloc, addloc->area ) ) delete_reset( addloc->area, mreset ); } homedata->vnum[i] = 0; delete_room(addloc);
this is the error it is giving me and I'm kind of at a loss on how to fix it
house.c:1664: error: âAREA_DATAâ has no member named âfirst_resetâ
also
for (i=0; i < MAX_HOUSE_ROOMS; i++) { if (homedata->vnum[i] > 0 && (location = get_room_index(homedata->vnum[i])) != NULL) { obj = location->last_content; j=supermob->level; supermob->level=MAX_LEVEL; if (obj) fwrite_obj(supermob, obj, fpout, 0, OS_CARRY ); supermob->level=j; } }
my mud doesn't have levels so I would appreciate any ideas on how to fix this as well.



Geomancer

GroupAdministrators
Posts1,992
JoinedJul 26, 2005
for ( mreset = addloc->area->first_reset; mreset; mreset = mreset_next ) { mreset_next = mreset->next; if ( is_room_reset( mreset, addloc, addloc->area ) ) delete_reset( addloc->area, mreset ); }
resets are room based and the delete_room will take care of the resets so you dont need that part

change
for (i=0; i < MAX_HOUSE_ROOMS; i++) { if (homedata->vnum[i] > 0 && (location = get_room_index(homedata->vnum[i])) != NULL) { obj = location->last_content; j=supermob->level; supermob->level=MAX_LEVEL; if (obj) fwrite_obj(supermob, obj, fpout, 0, OS_CARRY ); supermob->level=j; } }
to
for (i=0; i < MAX_HOUSE_ROOMS; i++) { if (homedata->vnum[i] > 0 && (location = get_room_index(homedata->vnum[i])) != NULL) { obj = location->last_content; if (obj) fwrite_obj(supermob, obj, fpout, 0, OS_CARRY ); } }



Magician

GroupMembers
Posts128
JoinedApr 9, 2010
So I understand you just deleted the whole reference to supermob
what did the supermob do?
and I can't believe I didn't think of just removing it. lol
what did the supermob do?
and I can't believe I didn't think of just removing it. lol


Geomancer

GroupAdministrators
Posts1,992
JoinedJul 26, 2005
not the whole reference just the changing its level. In smaug you have to give it max level to make sure it saves all objects since it wouldn't save any object that was over the supermobs level.



Magician

GroupMembers
Posts128
JoinedApr 9, 2010
So now I seem to have a problem with copyover
In another thread Zeno said this:
But honestly I have no idea how to go about doing this .... I know that makes me sound like a retard lol
There is only one instance of load_char_obj in house.c
In another thread Zeno said this:
As for load_char_obj, hotboot was put in, so you'll need to fix those to work with hotboot. (It requires adding one more bool)
But honestly I have no idea how to go about doing this .... I know that makes me sound like a retard lol
There is only one instance of load_char_obj in house.c
CHAR_DATA *load_player( char *name ) { CHAR_DATA *onlinechar = NULL; DESCRIPTOR_DATA *d = NULL; struct stat fst; char buf[MAX_STRING_LENGTH]; int oldvnum = 0; sprintf( buf, "%s%c/%s", PLAYER_DIR, LOWER(name[0]), capitalize(name) ); for ( onlinechar = first_char; onlinechar; onlinechar = onlinechar->next ) { if ( IS_NPC(onlinechar) ) continue; if ( !str_cmp( onlinechar->name, name ) ) return onlinechar; } if ( !check_parse_name( name, FALSE) ) return NULL; if ( stat( buf, &fst ) == -1 ) return NULL; CREATE( d, DESCRIPTOR_DATA, 1 ); d->next = NULL; d->prev = NULL; d->connected = CON_GET_NAME; d->outsize = 2000; CREATE( d->outbuf, char, d->outsize ); load_char_obj( d, name, FALSE ); add_char( d->character ); oldvnum = ((get_room_index(d->character->in_room->vnum)) != NULL) ? d->character->in_room->vnum : ROOM_VNUM_LIMBO; char_to_room( d->character, get_room_index(oldvnum)); d->character->retran = oldvnum; d->character->desc = NULL; d->character = NULL; DISPOSE( d->outbuf ); DISPOSE( d ); for ( onlinechar = first_char; onlinechar; onlinechar = onlinechar->next ) { if ( IS_NPC(onlinechar) ) continue; if ( !str_cmp( onlinechar->name, name ) ) return onlinechar; } return NULL; }



Geomancer

GroupAdministrators
Posts1,992
JoinedJul 26, 2005
it isn't really needed to do that. if no problems just continue on. It is only really used to keep from showing you the last site you were connected from, at least in LoP lol



Magician

GroupMembers
Posts128
JoinedApr 9, 2010
Hmm I'm thinking I did something else wrong
because I can't savearea, can't copyover, hmm
I guess I must have really borked something up lol
because I can't savearea, can't copyover, hmm
I guess I must have really borked something up lol



Magician

GroupMembers
Posts128
JoinedApr 9, 2010
trying to decipher the core dump right now thought I'd post it up here so other people could look at it as well and possibly help me decipher
Program terminated with signal 6, Aborted. #0 0x00007f1b623fa715 in raise () from /lib64/libc.so.6 (gdb) bt #0 0x00007f1b623fa715 in raise () from /lib64/libc.so.6 #1 0x00007f1b623fb9af in abort () from /lib64/libc.so.6 #2 0x00000000004bc29d in sig_handler (sig=11) at comm.c:3909 #3 <signal handler called> #4 0x00007f1b6242f3a7 in fclose () from /lib64/libc.so.6 #5 0x000000000049b34d in fold_area (tarea=0x15b7250, filename=0x7fff83384bb0 "../building/Aasterinian.are", install=0 '\000') at build.c:7366 #6 0x000000000049d987 in do_savearea (ch=0x15b79b0, argument=0x7fff833859a8 ""at build.c:8013 #7 0x00000000005126b7 in interpret (ch=0x15b79b0, argument=0x7fff833859a8 "", forced=0 '\000') at interp.c:447 #8 0x00000000004b2c7e in game_loop () at comm.c:681 #9 0x00000000004b1daf in main (argc=2, argv=0x7fff83385f98) at comm.c:335 (gdb) list 149 150 #ifdef WIN32 151 int mainthread( int argc, char **argv ) 152 #else 153 int main( int argc, char **argv ) 154 #endif 155 { 156 struct timeval now_time; 157 char hostn[128]; 158 bool fCopyOver = FALSE; (gdb) up #1 0x00007f1b623fb9af in abort () from /lib64/libc.so.6 (gdb) list 159 #ifdef IMC 160 int imcsocket = -1; 161 #endif 162 163 /* 164 * Memory debugging if needed. 165 */ 166 #if defined(MALLOC_DEBUG) 167 malloc_debug( 2 ); 168 #endif (gdb) up #2 0x00000000004bc29d in sig_handler (sig=11) at comm.c:3909 3909 abort( ); (gdb) list 3904 bug( "Signal SIGABRT.", 0 ); 3905 case SIGSEGV: 3906 bug( "Signal SIGSEGV.", 0 ); 3907 } 3908 log_string( "Crashguard is OFF. Dumping core..." ); 3909 abort( ); 3910 } 3911 3912 switch ( sig ) 3913 { (gdb) up #3 <signal handler called> (gdb) list 3914 case SIGBUS: 3915 bug( "Sig handler SIGBUS.", 0 ); 3916 do_crashguard( ); 3917 break; 3918 case SIGTERM: 3919 bug( "Sig handler SIGTERM.", 0 ); 3920 do_crashguard( ); 3921 break; 3922 case SIGABRT: 3923 bug( "Sig handler SIGABRT.", 0 ); (gdb) up #4 0x00007f1b6242f3a7 in fclose () from /lib64/libc.so.6 (gdb) list 3924 do_crashguard( ); 3925 break; 3926 case SIGSEGV: 3927 bug( "Sig handler SIGSEGV.", 0 ); 3928 do_crashguard( ); 3929 break; 3930 } 3931 } 3932 3933 /* End of Signal Handler - Josh */ (gdb) up #5 0x000000000049b34d in fold_area (tarea=0x15b7250, filename=0x7fff83384bb0 "../building/Aasterinian.are", install=0 '\000') at build.c:7366 7366 fclose( fpReserve ); (gdb) list 7361 /* sprintf( buf, "Saving %s...", tarea->filename ); 7362 log_string_plus( buf, LOG_BUILD, 0 ); */ 7363 7364 sprintf( buf, "%s.bak", filename ); 7365 rename( filename, buf ); 7366 fclose( fpReserve ); 7367 if( ( fpout = fopen( filename, "w" ) ) == NULL ) 7368 { 7369 bug( "fold_area: fopen", 0 ); 7370 perror( filename ); (gdb) up #6 0x000000000049d987 in do_savearea (ch=0x15b79b0, argument=0x7fff833859a8 ""
at build.c:8013 8013 fold_area( tarea, filename, FALSE ); (gdb) list 8008 return; 8009 } 8010 8011 sprintf( filename, "%s%s", BUILD_DIR, tarea->filename ); 8012 send_to_char( "Saving area...\n\r", ch ); 8013 fold_area( tarea, filename, FALSE ); 8014 send_to_char( "Done.\n\r", ch ); 8015 } 8016 8017 void do_genarea( CHAR_DATA * ch, char *argument ) (gdb) up #7 0x00000000005126b7 in interpret (ch=0x15b79b0, argument=0x7fff833859a8 "", forced=0 '\000') at interp.c:447 447 ( *cmd->do_fun ) ( ch, argument ); (gdb) list 442 */ 443 444 ch->prev_cmd = ch->last_cmd; /* haus, for automapping */ 445 ch->last_cmd = cmd->do_fun; 446 start_timer( &time_used ); 447 ( *cmd->do_fun ) ( ch, argument ); 448 end_timer( &time_used ); 449 450 /* 451 * Command's done, send the outputsuffix if they want it -- Scion (gdb) up #8 0x00000000004b2c7e in game_loop () at comm.c:681 681 interpret( d->character, cmdline, FALSE ); (gdb) list 676 nanny( d, cmdline ); 677 break; 678 case CON_PLAYING: 679 if( d->character && !IS_NPC( d->character ) ) 680 d->character->pcdata->alias_used = 0; 681 interpret( d->character, cmdline, FALSE ); 682 break; 683 case CON_EDITING: 684 edit_buffer( d->character, cmdline ); 685 break; (gdb) up #9 0x00000000004b1daf in main (argc=2, argv=0x7fff83385f98) at comm.c:335 335 game_loop( ); (gdb) list 330 { 331 log_string( "Running copyover_recover." ); 332 copyover_recover( ); 333 } 334 335 game_loop( ); 336 337 /* 338 * Save the world's position -- Scion 339 */ (gdb) up Initial frame selected; you cannot go up. (gdb)



Geomancer

GroupAdministrators
Posts1,992
JoinedJul 26, 2005
ah so its crashing on closing the fpreserve.


Geomancer

GroupAdministrators
Posts1,992
JoinedJul 26, 2005
It had been awhile, but thought id check into it just to make sure. You don't need to have the fpreserve anymore anyways lol. And since I don't see it in the cm3 that means its already removed from the codebase so just remove the opening and closing of the fpreserve in the stuff you added.


Magician

GroupMembers
Posts128
JoinedApr 9, 2010
If you don't mind me asking (because honestly I'm trying to understand gdb and how to read it) would you mind explaining to me how you came to understand that
I mean I see #4 5 and 6, and I mean of course I figured that it had something to do with do_save, but I figured that because when I tried to savearea it crashed
I'm really not trying to be a bother I just want to understand everything, and maybe one day I won't have to ask for so much help
I mean I see #4 5 and 6, and I mean of course I figured that it had something to do with do_save, but I figured that because when I tried to savearea it crashed
I'm really not trying to be a bother I just want to understand everything, and maybe one day I won't have to ask for so much help



Geomancer

GroupAdministrators
Posts1,992
JoinedJul 26, 2005
Program terminated with signal 6, Aborted. #0 0x00007f1b623fa715 in raise () from /lib64/libc.so.6 (gdb) bt #0 0x00007f1b623fa715 in raise () from /lib64/libc.so.6 #1 0x00007f1b623fb9af in abort () from /lib64/libc.so.6 #2 0x00000000004bc29d in sig_handler (sig=11) at comm.c:3909 #3 <signal handler called> #4 0x00007f1b6242f3a7 in fclose () from /lib64/libc.so.6 #5 0x000000000049b34d in fold_area (tarea=0x15b7250, filename=0x7fff83384bb0 "../building/Aasterinian.are", install=0 '\000') at build.c:7366 #6 0x000000000049d987 in do_savearea (ch=0x15b79b0, argument=0x7fff833859a8 ""at build.c:8013 #7 0x00000000005126b7 in interpret (ch=0x15b79b0, argument=0x7fff833859a8 "", forced=0 '\000') at interp.c:447 #8 0x00000000004b2c7e in game_loop () at comm.c:681 #9 0x00000000004b1daf in main (argc=2, argv=0x7fff83385f98) at comm.c:335
Well 0, 1, 2, 3, 4 all seem to be after the actuall issue so 5 was a great spot to look at, 4 is good to see that the part in 5 is calling fclose though.
#5 0x000000000049b34d in fold_area (tarea=0x15b7250, filename=0x7fff83384bb0 "../building/Aasterinian.are", install=0 '\000') at build.c:7366 7366 fclose( fpReserve ); (gdb) list 7361 /* sprintf( buf, "Saving %s...", tarea->filename ); 7362 log_string_plus( buf, LOG_BUILD, 0 ); */ 7363 7364 sprintf( buf, "%s.bak", filename ); 7365 rename( filename, buf ); 7366 fclose( fpReserve ); 7367 if( ( fpout = fopen( filename, "w" ) ) == NULL ) 7368 { 7369 bug( "fold_area: fopen", 0 ); 7370 perror( filename );
Now 5 shows that it is calling fclose on fpReserve which hasn't been used in quite some time and through experience I've seen it crash muds back when it was used lol. People do enjoy doing up and list as well as info locals etc... i normally just use frame <#> and then maybe a list to see what is around the issue and then I use print
frame 5 list print fpReserve print *fpReserve
at the very least



Magician

GroupMembers
Posts128
JoinedApr 9, 2010
Hah I wasn't sure what I was doing, but I took a chance lol and removed all references to fpreserve and it let me save and do a copyover
Reading over your post while I was working I will definitely try and remember to do the prints
so basically looking at the gdb you could tell that the first few we're after the crash, which I guess I can see
so you just basically (through experience) saw that #4 and 5 was a good place to start
and then of course once you do list you can see where it all takes place
and then once again through experience you know that fpreserve hasn't been used in forever so that really tipped your hat off to whats wrong
Reading over your post while I was working I will definitely try and remember to do the prints
so basically looking at the gdb you could tell that the first few we're after the crash, which I guess I can see
so you just basically (through experience) saw that #4 and 5 was a good place to start
and then of course once you do list you can see where it all takes place
and then once again through experience you know that fpreserve hasn't been used in forever so that really tipped your hat off to whats wrong


Geomancer

GroupAdministrators
Posts1,992
JoinedJul 26, 2005
nice
Yep
no worries you will learn lots as you go

Yep




Magician

GroupMembers
Posts128
JoinedApr 9, 2010
I feel I'm actually learning pretty quickly
I added and changed a lot of that snippet from what I've learned without having to ask for help
so I'm a bit happy about that
I added and changed a lot of that snippet from what I've learned without having to ask for help
so I'm a bit happy about that



Geomancer

GroupAdministrators
Posts1,992
JoinedJul 26, 2005
you should be
just takes lots of time lol



Magician

GroupMembers
Posts128
JoinedApr 9, 2010
and sometime while I was at work my mud crashed
and when I go to load it back up segmentation fault
GDB:
I'm looking it over right now trying to figure it out, but in case anybody wants to take a gander at it before I post again
My process of thought is that it has something to do with loading the houses.... because that's what I changed, and it's giving the fault when starting the mud
and when I start the mud so I can see whats happening I get this
and when I go to load it back up segmentation fault
GDB:
Program terminated with signal 11, Segmentation fault. #0 0x00000000005b01c0 in load_house_file (name=0x860ee0 <word.11806> "END"at house.c:2043 2043 while ( (obj = supermob->first_carrying) != NULL) (gdb) bt #0 0x00000000005b01c0 in load_house_file (name=0x860ee0 <word.11806> "END"
at house.c:2043 #1 0x00000000005aff3e in load_homedata () at house.c:1958 #2 0x00000000004bc5d3 in boot_db () at db.c:394 #3 0x00000000004b1cab in main (argc=2, argv=0x7fff6b307e18) at comm.c:297 (gdb) list 2038 } 2039 2040 fclose( fp ); 2041 fp = NULL; 2042 2043 while ( (obj = supermob->first_carrying) != NULL) 2044 { 2045 obj_from_char( obj ); 2046 obj_to_room( obj, get_room_index(vnum)); 2047 } (gdb) print fp $1 = (FILE *) 0x0 (gdb) print obj_from_char $2 = {void (OBJ_DATA *)} 0x505c3f <obj_from_char> (gdb) pring obj Undefined command: "pring". Try "help". (gdb) print obj $3 = (OBJ_DATA *) 0x0 (gdb) up #1 0x00000000005aff3e in load_homedata () at house.c:1958 1958 if ( !load_house_file( filename ) ) (gdb) list 1953 filename = feof( fpList ) ? "$" : fread_word( fpList ); 1954 1955 if ( filename[0] == '$' ) 1956 break; 1957 1958 if ( !load_house_file( filename ) ) 1959 { 1960 sprintf( buf, "Cannot load house file: %s", filename ); 1961 bug( buf, 0 ); 1962 } (gdb) up #2 0x00000000004bc5d3 in boot_db () at db.c:394 394 load_homedata(); (gdb) list 389 log_string( "Loading books" ); 390 load_books( ); 391 392 log_string("Loading Housing System, Home Accessories Data," 393 " and Home Auctioning System"
; 394 load_homedata(); 395 load_accessories(); 396 load_homebuy(); 397 398 fBootDb = TRUE; (gdb) print load_homedata $4 = {void ()} 0x5afe65 <load_homedata> (gdb) print fBootDb $5 = 0 '\000' (gdb) up #3 0x00000000004b1cab in main (argc=2, argv=0x7fff6b307e18) at comm.c:297 297 boot_db( ); (gdb) list 292 signal( SIGTERM, ( void * )bailout ); 293 } 294 #endif /* WIN32 */ 295 296 log_string( "Booting Database" ); 297 boot_db( ); 298 log_string( "Initializing socket" ); 299 if( !fCopyOver ) /* We have already the port if copyover'ed */ 300 control = init_socket( port ); 301 (gdb) up Initial frame selected; you cannot go up. (gdb)
I'm looking it over right now trying to figure it out, but in case anybody wants to take a gander at it before I post again
My process of thought is that it has something to do with loading the houses.... because that's what I changed, and it's giving the fault when starting the mud
and when I start the mud so I can see whats happening I get this
mystickdreamer@boogeyman ~/cm3/src $ ./rmexe 6501 Mon Aug 26 14:36:22 2013 :: Booting Database 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Mon Aug 26 14:36:22 2013 :: [*****] BOOT: ---------------------[ Boot Log ]-------------------- Mon Aug 26 14:36:22 2013 :: Loading commands Mon Aug 26 14:36:22 2013 :: Loading sysdata configuration... Mon Aug 26 14:36:22 2013 :: Loading socials Mon Aug 26 14:36:22 2013 :: Loading skill table Mon Aug 26 14:36:22 2013 :: Sorting skill table... Mon Aug 26 14:36:22 2013 :: Remapping slots to sns Mon Aug 26 14:36:22 2013 :: Loading herb table Mon Aug 26 14:36:22 2013 :: Loading clans Mon Aug 26 14:36:22 2013 :: Loading channels Mon Aug 26 14:36:22 2013 :: Loading bits Mon Aug 26 14:36:22 2013 :: Loading help files Mon Aug 26 14:36:22 2013 :: Loading books Mon Aug 26 14:36:22 2013 :: Loading Housing System, Home Accessories Data, and Home Auctioning System Segmentation fault



Geomancer

GroupAdministrators
Posts1,992
JoinedJul 26, 2005
can you post what is in the house file and in frame 1 do a print supermob and if it isn't 0x0 do a print *supermob