John Flanagan wrote: > Here is my problem. I used to imm on a mud where you could lets say, > put several items in a bag, clone the bag, and each bag would have the > same items inside. Great help for quest and newbie packages. Anyway, I > read the archive as well as the faq, and haven't found any way to do this. Look at the autoeq code in the stock CircleMUD source. It has code which both saves and restores all the objects in a person's inventory or equipped and restoring them back to the same positions (which includes restoring objects in a container back to that container). That should give you more than enough code examples and info to be able to write your own container-clone code. As a general outline... Use a recursive function. First you call the function for the container object. The function makes a copy of the empty container. Then you loop through each object in the container and call the function on it (recursively, from inside the function) and add each item to the new container. Then have the function return a pointer to the container object it just cloned. Lastly, you add that object to the player's inventory who called the function to begin with. Regards, Peter -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/04/01 PST