Re: [CODE] crash-bug with medit on pl21-dg8-oasis201

From: Thomas Arp (
Date: 09/30/02

From: "Ronald Evers" <>
> Hey folks,
> I've found a bug in medit that I can't seem to fix. Whenever I
> alter a mob that has a script set I get a seg fault when I exit
> the medit menu and save it.
> I'm using bpl21 with this dg_scripts_pl8_with_oasis_bpl21.patch
> patch from the ftp site installed.
> The mob I tried this on was the wandering spirit (1202). I gave
> him one trigger (greet) that simply makes him say hi. Then just
> "medit 1202;l;0;q;y" and there's your seg fault..

Change your free_mobile() to look like this:
 * Free a mobile structure that has been edited.
 * Take care of existing mobiles and their mob_proto!
int free_mobile(struct char_data *mob)
  int i;

  if (mob == NULL)
    return FALSE;

   * Non-prototyped mobile.  Also known as new mobiles.
  if ((i = GET_MOB_RNUM(mob)) == NOBODY) {
    free_proto_script(mob, MOB_TRIGGER);
  } else { /* Prototyped mobile. */
    if (mob-> && mob-> != mob_proto[i]
    if (mob->player.title && mob->player.title != mob_proto[i].player.title)
    if (mob->player.short_descr && mob->player.short_descr !=
    if (mob->player.long_descr && mob->player.long_descr !=
    if (mob->player.description && mob->player.description !=
    if (mob->proto_script && mob->proto_script != mob_proto[i].proto_script)
      free_proto_script(mob, MOB_TRIGGER);
  while (mob->affected)
    affect_remove(mob, mob->affected);

  return TRUE;

I made buggy code in the first place, by having the check at [1] below
the code where i is sure to have meaning. This causes strange behaviour
and occasional crashes.

Also, remember to add the line

  OLC_MOB(d)->proto_script = OLC_SCRIPT(d);

in medit_save_internally(), to make your changes show in medit.

I'll have pl9 out within a week - at most 10 days. Got swamped with work,
and had to postpone the deadline.


   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/25/03 PDT