The Dark One writes:
> I've attached the problem area in OasicOLC medit.c.
> This is WHERE ALL crashes origonate, on my mud and
> I believe on everyones mud who uses OasisOLC and is curently
> experiencing crashes.
>
> Every time this function (save_internaly) is called, a seg fault
> core dump results.
>
> Additional information:
>
> a) It only crashes on a NEW mob internal save, not a save of a
> previously created MOB.
> b) I do not believe that olc_at_save_to_list(), but I could be wrong.
I've included a copy of our version of this routine below. It does
not crash or corrupt the zone table (another old problem with Oasis).
I leave it to the astute reader to compare it with their version and
to decide what action to take.
Edward Almasy
Axis Data
almasy@axisdata.com
#define ZCMD zone_table[zone].cmd[cmd_no]
void medit_save_internally(struct descriptor_data *d)
{ int rmob_num, found = 0, new_mob_num = 0, zone, cmd_no, shop;
struct char_data *new_proto;
struct index_data *new_index;
struct char_data *live_mob;
struct descriptor_data *dsc;
rmob_num = real_mobile(OLC_NUM(d));
/*. Mob exists? Just update it .*/
if (rmob_num != -1)
{ copy_mobile((mob_proto + rmob_num), OLC_MOB(d));
/*. Update live mobiles .*/
for(live_mob = character_list; live_mob; live_mob = live_mob->next)
if(IS_MOB(live_mob) && GET_MOB_RNUM(live_mob) == rmob_num)
{ /*. Only really need update the strings, since these can cause
protection faults. The rest can wait till a reset/reboot .*/
GET_ALIAS(live_mob) = GET_ALIAS(mob_proto + rmob_num);
GET_SDESC(live_mob) = GET_SDESC(mob_proto + rmob_num);
GET_LDESC(live_mob) = GET_LDESC(mob_proto + rmob_num);
GET_DDESC(live_mob) = GET_DDESC(mob_proto + rmob_num);
}
}
/*. Mob does not exist, hafta add it .*/
else
{ CREATE(new_proto, struct char_data, top_of_mobt + 2);
CREATE(new_index, struct index_data, top_of_mobt + 2);
for (rmob_num = 0; rmob_num <= top_of_mobt; rmob_num++)
{ if (!found)
{ /*. Is this the place? .*/
if ((rmob_num > top_of_mobt) ||
(mob_index[rmob_num].vnumber > OLC_NUM(d)))
{ /*. Yep, stick it here .*/
found = 1;
new_index[rmob_num].vnumber = OLC_NUM(d);
new_index[rmob_num].number = 0;
new_index[rmob_num].func = NULL;
new_mob_num = rmob_num;
GET_MOB_RNUM(OLC_MOB(d)) = rmob_num;
copy_mobile((new_proto + rmob_num), OLC_MOB(d));
/*. if there's an entry that should go here, put it in .*/
new_index[rmob_num + 1] = mob_index[rmob_num];
new_proto[rmob_num + 1] = mob_proto[rmob_num];
GET_MOB_RNUM(new_proto + rmob_num + 1) = rmob_num + 1;
} else
{ /*. Nope, copy over as normal.*/
new_index[rmob_num] = mob_index[rmob_num];
new_proto[rmob_num] = mob_proto[rmob_num];
}
} else
{
/*. We've already found it, copy the rest over .*/
new_index[rmob_num + 1] = mob_index[rmob_num];
new_proto[rmob_num + 1] = mob_proto[rmob_num];
GET_MOB_RNUM(new_proto + rmob_num + 1) = rmob_num + 1;
}
}
if (!found)
{ /*. Still not found, must add it to the top of the table .*/
new_index[rmob_num].vnumber = OLC_NUM(d);
new_index[rmob_num].number = 0;
new_index[rmob_num].func = NULL;
new_mob_num = rmob_num;
GET_MOB_RNUM(OLC_MOB(d)) = rmob_num;
copy_mobile((new_proto + rmob_num), OLC_MOB(d));
}
/*. Replace tables .*/
free(mob_index);
free(mob_proto);
mob_index = new_index;
mob_proto = new_proto;
top_of_mobt++;
/*. Update live mobile rnums .*/
for(live_mob = character_list; live_mob; live_mob = live_mob->next)
if(GET_MOB_RNUM(live_mob) >= new_mob_num)
GET_MOB_RNUM(live_mob)++;
/*. Update zone table .*/
for (zone = 0; zone <= top_of_zone_table; zone++)
for (cmd_no = 0; ZCMD.command != 'S'; cmd_no++)
if (ZCMD.command == 'M')
if (ZCMD.arg1 >= new_mob_num)
ZCMD.arg1++;
/*. Update shop keepers .*/
for(shop = 0; shop < top_shop; shop++)
if(SHOP_KEEPER(shop) >= new_mob_num)
SHOP_KEEPER(shop)++;
/*. Update keepers in shops being edited .*/
for(dsc = descriptor_list; dsc; dsc = dsc->next)
if(dsc->connected == CON_SEDIT)
if(S_KEEPER(OLC_SHOP(dsc)) >= new_mob_num)
S_KEEPER(OLC_SHOP(dsc))++;
}
olc_add_to_save_list(zone_table[OLC_ZNUM(d)].number, OLC_SAVE_MOB);
}
+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
| http://cspo.queensu.ca/~fletcher/Circle/list_faq.html |
+-----------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/18/00 PST