Re: "Room Saving" Snippet and Containers...

From: Patrick J. Dughi (dughi@IMAXX.NET)
Date: 03/06/98


On Fri, 6 Mar 1998, X Schiltz wrote:

> Give objects two new parameters, object num, and container num. When
> something enters a house, assign it an object num, if it's in a container,
> assign it a container num(that of it's container's object num). If it
> leaves the house, remove it's object num, when the house reloads, load all
> object's into the item that has the same object num as the item's
> container num. Sound simple enough? (:

        Would it be just as easy (upon saving) assign a depth to it...
0 being on the floor, 1 being in a container... then when reading in,
just wrap each object with the depth...

        depth           object
          0             dagger
          0             leather armour
          0             bag
          1             torch
          1             torch
          1             bag
          2             bread
          1             scroll of recall
          0             dagger


        Makes life soooo simple... start with an object list structure,
as long as the depth is the same, just assign the next number, if
it goes up, assign the previous item as the currrent container under
review, and continue on as before. If it changes negatively, for each
difference (ie depth 4 to depth 2 means do it twice - you shouldn't have
numbers go positive greater than one step increments), assign the current
object under review as the in_container.

        No more objects, you're done, set the top of the list to the well,
whatever you'd like, room contents, or player inventory, or whatever.

        You end up saving two ints, and you get (apparent) infinite
recursability. Though you'd have to know what you're doing it would be
tighter, faster, and less anything intensive than the afforementioned
version.

                                                        PjD


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



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