adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Adonthell-devel] Adjustments to items.h ?


From: Alexandre Courbot
Subject: Re: [Adonthell-devel] Adjustments to items.h ?
Date: 14 Feb 2002 14:28:02 +0100

> > That would mean that item or character attributes are stored in a map,
> > not as simple ints, so they can be accessed by name.
> 
> Actually, the more I think about it, the more convinced I am that item
> attributes or modifiers shouldn't be hardcoded into the items.
> 
> Like the character or quest variables, they should be stored as
> string/value pairs. To do that, you only need to inherit from the storage
> class defined in storage.h. Then each item can have exactly the attributes
> it needs, no more and no less.
> 
> That will make it much easier to add new items with new attributes at
> later points without the need to change any existing code. It keeps the
> classes smaller and reduces them to item handling. The items themselves
> would come as data (in the date package), which only adds to our policy of
> keeping code and data seperate.

Ah, just sent my previous mail when I see this one. I totally agree with
you, this time! ;) (see previous mail) The storage class could then be
the base class others object inherit from.

> With an item's possible actions delegated to python, we'll get an item
> system that can easily be tailored to individual needs by providing the
> according scripts and feeding items with the required attributes, whatever
> those might be.

That's it. Perfect. Now tell me what would be the problem of having
items defined as a Python class :p

You could have:

# base_item is the base C++ class with storage capabilities
class healing_potion (base_item)

It would make it very easy to design objects!

Alex.
-- 
http://www.gnurou.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]