Re: Saved Rooms

From: Daniel Koepke (dkoepke@california.com)
Date: 12/15/96


On Sun, 15 Dec 1996, The Dark One wrote:

> where do I put it so its updates as time goes on?

Look at comm.c, heart_beat().

> how do I make a file if none exists

  fopen(filename, "wb");

It'll create a binary file if it doesn't exist (remove the "b" for a text
file).

> how do i deal with objs in objs ?

Hrm, when you are writing out the objects, write them like VNUM and then
the vnum of the object it's in.  So you get:

  2045 -1 * object is in room if it's -1
  3941 2045 * object is in object "bag" (2045)

So you essentially will create object 2045 in the room, then when you
create 3941, you find the first object in the room with vnum 2045 and
put 3941 into it.  There is probably a better way to do this, though.
Anyone else?

> and finaly I need to save all objs in room into the before mentioned
> file ...

Just save their vnums and load them when they come back.  It's easier
and less space consuming.  The only problem you'll run into is if the
objects have been changed or removed.  In which case, if you want to be
absolutely safe, you can look at how this is done in standard house.c
code.  Perhaps I ought to do a patch for this, too...


--
Daniel Koepke
dkoepke@california.com
Forgive me father, for I am sin.


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



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