Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2004:
[Freeciv-Dev] Re: (PR#2521) general effects framework
Home

[Freeciv-Dev] Re: (PR#2521) general effects framework

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] Re: (PR#2521) general effects framework
From: "Mike Kaufman" <kaufman@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 20 Apr 2004 22:08:02 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=2521 >

On Tue, Apr 20, 2004 at 08:20:36PM -0700, Jason Short wrote:
> >>
> >>- I don't understand why can_xxx is needed when we could just check
> >>game.global_wonders[id] (where id is determined by some flag).  Is it
> >>because the effect need not always come from a wonder?
> > 
> > 
> > This seem like a reasonable assumption. It makes no sense to check for a
> > specific building if you are doing things from an effect centric
> > perspective. However, I think we should use a bitvector of global effects
> > here. Sort of like the unit flags, rather than having zillions of
> > different struct fields, one per effect.
> 
> I agree.  Mike has special-cased these effects because they are the only 
> "surviving" effects (others effects are generated as a list from the 
> list of existing units and buildings).  I don't see why surviving 
> effects can't just have general made-up flags.  But this hasn't been 
> implemented.

when jason and I last had this conversation I was sure this was a
bad/unworkable idea. I can't seem to remember exactly why I felt so. Ah, I
do seem to remember some problems... One problem here is that most of the
effects cannot fit comfortably into a bitvector type solution. For example:
how would you store in a savegame: global effect Spy Resistant +20% has
survived AND global effect Spy Resistant +50% has also survived? You can't.
A bit vector can only store whether some Spy Resistant effect is on or off.
It can't describe any of the other 12 parameters making up the effect.

That's not to say that only Enable_Nuke and Enable_Space do not have this
problem. Any_Government, Have_Embassies, No_Anarchy, No_Sink_Deep, and a
couple of other effects whose parameters are totally ignored can be used
this way. Using such a bitvector though means that savegames might be
corrupted if the order of enum effect_type_id changes. Better would be to
save a list of the effects names that survive in the savegame and using
effect_type_from_str() to look up the effect. Hmm. I don't know if there's
much point. comments?

-mike




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