[Home] [Groups] - Message: [Prev in Group] [Next in Group]

nu.kanga.list.mud-dev

16731: Re: [MUD-Dev] data structure design in a new mud

[Full Header] [Plain Text]
From: "Ben Chambers" <bjchambers@phoenixdsl.com>
Newsgroups: nu.kanga.list.mud-dev
Date: Thu, 15 Mar 2001 22:05:27 -0800
References: [1] [2] [3] <-newest
Organization: Kanga.Nu
From: "J. Coleman" <stormknight@alltel.net>
> pauli.saksa@ztango.com wrote:
>>> From: "Justin Coleman" <JMCOLE@ENOREE.DJJ.STATE.SC.US>

>> A central list allows some operations that smaller lists do not,
>> e.g. fast searching of items.  Also general administrating of items
>> would be trivial to implement with a central list. There are down
>> sides as well.  How the indexing would be done? I.e. How to make a
>> difference between two similar items. I'd hate to force my
>> immortals to 'add item #24562 to this mob'.

Yes, it does allow some more operations, but the key is that these are
never the same.  Have each smaller list have numbers or something
similar.  Then, when those are removed, remove the item from the big
list using the number as an index to an array or something similar.
The central list is never going to be operated upon directly, and when
it is, it will edit the data from the smaller list.  Another
possibility, have the item data be something like

    item data //whatever your data is
    item *small_instance //pointer to the small instance it exists in.

Central list can then access small list if necessary.  The obvious
easiest way, however, is to have something along the lines of

    item data//whatever data
    item *small_instance //pointer to the small instance it exists in.
    int index //index in central list.

have a default deconstructor that removes it completely, i.e

    small_instance->remove();
    central_list->remove(index); //central list is the same for all objects

Basically, the two are seperate but contain data referencing each
other.  The key is, instead of pointers back forth and all over, you
simply link to the subset of data that it is stored under, and the
location in that subset.

_______________________________________________
MUD-Dev mailing list
MUD-Dev@kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev