Crossfire Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: object structure and player structure



>   I've noticed that several things which could go in the
> player structure are in the object structure in structs.h.
> There are lots of objects, but very few players, yes?  So
> we really should stick everything possible in the player
> structure?
> 
>   I'm talking about things which are specific to the player.....
> 
> 
> Regards,
> 
> PeterM
> 

Which things in particular ? I agree that anything that can be moved from
the object struct should be (it is awfully big for something we use a lot).
One idea I have had is to separate the object struct into mostly static and
dynamic parts. The dynamic part will have all the elements that we know will
change. The mostly static part will have elements that for most objects won't
be different from the archetype. 

 Then for an object it will have a dynamic_obj struct and a pointer to a
static_obj struct. For most objects the static_obj struct will point into
the archetype, but for some they will have their own, modified, copy. The 
advantage is that you save memory, the disadvantage is that you now have to
be really carefully about assigning to anything in the static_obj struct. If
you don't make a copy before making a change you will modify the archetype.
For this reason alone it probably isn't worth doing this unless memory becomes
a really bad problem.


Rupert