Re: [Newbie]Copying current object stuff over old object stuff.

From: Thomas Arp (
Date: 02/10/03

From: "Abraham Dizon" <soldier2003@HOTMAIL.COM>
I've just rearranged your mail a bit:
> ...
> And when I open the same object again, have the same ones I put in stay?
> ...
This is the _first_ question you need to ask yourself. Saving the info is
extremely easy, if you know how you want to read it. In this case, I suggest
you look at how db.c loads object abilities (+str/-hit etc.), and use the
same approach. Then, when you get to the save part, below, you'll know the
format to write.

> ... I want to save the values for the Damage Dice, Rate, and Range.
> I defined those things like this in utils.h:
> #define IS_GUN(obj)                     ((obj)->gun)
> #define GET_GUN_INFO(obj)               ((obj)->gun)
> #define GET_GUN_DICE_NUM(obj)           (GET_GUN_INFO(obj)->dice.number)
> #define GET_GUN_DICE_SIZE(obj)          (GET_GUN_INFO(obj)->dice.size)
> #define GET_GUN_RATE(obj)               (GET_GUN_INFO(obj)->rate)
> #define GET_GUN_RANGE(obj)              (GET_GUN_INFO(obj)->range)
> Like if the current values for these: Damage Number is 2,
> Damage Size is 2, Rate is 3, and Range is 5 How do I save them into oedit?

This part pertains to saving to disk:
   in genobj.c, add something along the lines of (mailercode)
   if (IS_GUN(obj)) {
     fprintf(objfile, "G %d %d %d %d\n",

   in the part where you save abilities. (The 'G' in the format above is
   just my choice - You decide what the code should be).

Before that, though, you should copy the gun info from the edited object
to the prototype for that object, in oedit_save_internally(), if you
don't already.


   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/26/03 PDT