Author Topic: named_livings error and hospital bug causing seg fault?  (Read 2703 times)

Offline petriomelony

  • Acquaintance
  • *
  • Posts: 34
    • View Profile
named_livings error and hospital bug causing seg fault?
« on: August 10, 2010, 11:33:57 PM »
Hi everyone,

I'm using the DW distribution lib with FluffOS 2.20-ds01, on linux, and was wondering if anyone else ran into a problem with mob spawn causing a seg fault, in pumpkin town (on squash street).

This is the trace I get

Code: [Select]
Object: /d/dist/pumpkin/squash/squash4, Program: /d/dist/pumpkin/inherit/cityroom.c
   in make_citymonster() at /d/dist/pumpkin/inherit/cityroom.c:61
arguments were (0)
Object: /d/dist/pumpkin/hospital, Program: /d/dist/pumpkin/hospital.c
   in ok_to_clone() at /d/dist/pumpkin/hospital.c:490
arguments were ()
Object: /secure/simul_efun, Program: /secure/simul_efun/modified_efuns.c
   in named_livings() at /secure/simul_efun/modified_efuns.c:232
arguments were ()
'     <fake>' in '/            <driver>' ('/   secure/simul_efun')

I checked the hospital.c files first (there's a couple of them), and I think the piece of code in question is trying to count the mobs in Ankh-Morpork, which isn't part of the distributed lib:

Code: [Select]
// This function returns 1 if its ok to clone some more npcs and
// false if not.
int ok_to_clone() {
  if(time() > last_check + 300) {
    last_check = time();
    am_npcs = sizeof( filter( named_livings(),
      (: environment( $1 ) && base_name( environment( $1
       ) )[0..4] == "/d/am" :) ) );
  }
  return ( am_npcs < MAX_AM_LIVING );
}

where "/d/am" doesn't exist, but MAX_AM_LIVING is defined in another file alright.  however, there are also 4 hospital files to do with pumpkin, one in /d/dist/pumpkin, and the others in /d/dist/pumpkin/pumpkin, /d/dist/pumpkin/inherit, and /d/dist/pumpkin/hospital.  pumpkin's path.h only points to the one in the base pumpkin folder, though (i also just found a typo where it was referring to hostpial.h, but i don't think that's the issue since each hospital.c has hospital.h included at the top)

i think there's also something wrong with named_livings(), but i have no idea what the trace is saying.  the e_fun code in the trace is simply:

Code: [Select]
/** @ignore yes */
object *named_livings() {
#if efun_defined(named_livings)
  return filter( efun::named_livings(), (: reference_allowed :) );
#else
  return filter( LIV->named_livings(), (: reference_allowed :) );
#endif
} /* named_livings() */

any input would be appreciated!

edit: this doesn't happen all the time, only if i leave the mud running a while (presumably when the number approaches/hits the max?)
« Last Edit: August 10, 2010, 11:35:34 PM by petriomelony »