Unique id's

Chris Gray cg at ami-cg.GraySage.Edmonton.AB.CA
Wed Apr 9 07:00:54 New Zealand Standard Time 1997


[Shawn H:]

:Any magical algorithms? :)

Chris L is almost certainly different in details, so I'll just outline
what my stuff does. The unique id on anything is just its database id.
This is an index into a descriptor table that gives the offset and length
of the actual data in the database. Slots in the descriptor table are
reused when they are freed (there is space in them to make a simple
linked-list of the freed ones). When more are needed, the table just grows
on the end, so until freeing happens, dbids just start at 1 and go up.

Some systems specifically avoid re-using ids, in order to better catch
dangling pointers.

--
Chris Gray   cg at ami-cg.GraySage.Edmonton.AB.CA



More information about the MUD-Dev mailing list