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: Kai Sterker
Subject: Re: [Adonthell-devel] Adjustments to items.h ?
Date: Fri, 15 Feb 2002 20:40:21 +0100 (CET)

On 15 Feb 2002 18:11:44 +0100 Alexandre Courbot wrote
> The dummy tries to understand his mails, take II! ;)

Yeah, we're heading in the right direction :).
 

> This class could be assigned to any kind of potion. Their behavior
> could, in certain cases, be tuned by constructor time parameters. Just
> like schedules. Whenever you need to specialise one action for one
> special potion, just inherit from this class, and overload the function
> you need to change. Most often, you'll have to call the base function
> too, so it will be available anyway.
> 
> Advantages:
> - One behavior can fit to many, many kind of different objects
> - All actions can be grouped into the same file
> - Very generic and flexible
> - Looks a lot like schedules

Yes, that sounds very well.
 

> This makes me think we can push the system one step further again. Each
> object has a slot (or rather Python method pointer) that can be NULL
> (action not possible) or point to the corresponding method to call when
> the action is triggered. When you set the behavior of an object, all the
> possible slots are filled with the corresponding function of the class.
> But say you want to specialize a (stupid example) chocolate sword. You
> can fight with it, but also eat it. All the actions belong to the weapon
> class, excepted that you'd also need the 'consume' method of the 'food'
> class. That's it: you could set the behavior to 'weapon', but then after
> call a set_eat_function ('food') method that would only fill the 'eat'
> slot with the 'eat' function of the 'food' class. That way, you have a
> sword you can eat, and the same flexibility as Kai's initial proposal, a
> bit less messy maybe ;)
> 
> This is globally Kai's initial idea, with small parts from mine - I
> don't know whether you like it, but it seems to me that it would satisfy
> all our needs, and it the right thing to do!(C) ;)

Sorry, but I can only agree ;). Guess it's my turn now to think about it
for a day or so, and see if I find any flaws. But it's definately looking
good!

Kai





reply via email to

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