MultiMUD: a better renum_world() [suggestion]

From: Katzlberger Thomas (cat@garfield.Vanderbilt.Edu)
Date: 08/19/95


Hi all !

I ran into a bug where EXIT(ch, dir)->to_room was -1.
Of course in a self made spell.
To avoid such, give the database better consistency
as well as creators better feedback I suggest this modification:=20=

[This is no memory leak since done only once per reboot -
 but feel free to free the exit structs if you want]

Greetings, Kilian at MultiMUD (telnet 132.230.36.55 4242).

/* resolve all vnums into rnums in the world */
void=20
renum_world(void)
{
    register int room, door, rnum;

    for (room =3D 0; room <=3D top_of_world; room++)
        for (door =3D 0; door < NUM_OF_DIRS; door++)
            if (world[room].dir_option[door])
                if (world[room].dir_option[door]->to_room !=3D =
NOWHERE)
                {   rnum =3D =
real_room(world[room].dir_option[door]->to_room);
                    world[room].dir_option[door]->to_room =3D =
rnum;
                    if(rnum<0)
                    {   sprintf(buf,"EXIT in room #%d dir %d does =
not exist (removed)",
                                world[room].number,door);
                        errlog(buf);
                        world[room].dir_option[door] =3D 0;
                    }
                }
}



This archive was generated by hypermail 2b30 : 12/18/00 PST