Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2002:
[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: kaufman@xxxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2521) general effects framework
From: "Raimar Falke via RT" <rt@xxxxxxxxxxxxxx>
Date: Wed, 11 Dec 2002 02:30:41 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Tue, Dec 10, 2002 at 11:33:48AM -0800, Mike Kaufman via RT wrote:
> On Tue, Dec 10, 2002 at 12:44:55AM -0800, Raimar Falke via RT wrote:
> > 
> > The ideal solution is IMHO is there is an
> >   bool is_pending(...);
> > this function can either have the body
> >   return eff->pending
> > or
> >   return (eff->has_nat && eff->has_gov && eff->has_adv
> >           && eff->has_no_equiv && eff->has_eff)
> > 
> > If you abstract the access to it you can implement both alternatives
> > and time them. As seen on the PF thread doubling the memory footprint
> > can make the computation slow down by an factor of 2.
> > 
> > It should be obvious that is_pending should be an inline function or
> > an macro.
> 
> hmm.
> 
> > I'm searching for an alternative. And yes I haven't understood
> > everything yet.
> > 
> > It looks like this is indead a building-only thing. IMHO we should
> > separate this from the effects. Only while both use a variable range
> > which have non-disjoint value sets we shouldn't mix them. Also "Local"
> > is rather pointless for equiv_range?!
> 
> I tend to agree with this. I've had to kludge some things in improvements.c
> as a result. making an enum equiv_range might be a better deal,
> unfortunately, however, we would need another set of access functions, etc.
> It's not worth it, especially as each would decribe the exact same set of
> ranges. I'll add some comments to make it clear who uses what.

It it worth it since the code will be code which have a long
lifetime. If the code lives 5 years (which I think is the minimum
lifetime) and every 6 months someone asked himself why is this so you
can save us all some time by doing it properly.

> > Why do typesafety only benefit assignments?
> 
> when does type-safety matter?

Always. It is a tool to catch programming errors at the compiling
stage. While the gcc isn't very strict about types the intel compiler
and splint are.

> > I wrote non-sense. I mean: if the AI has been teched to understand the
> > effects all correctly the AI should be able to play at the same level
> > under all rulesets if only buildings.ruleset file is changed. If this
> > is true it contradicts your "as smart as long as the default ruleset
> > is used" from above. Or did you want to express the same?
> 
> You still write nonsense as far as I can tell, but I think you understand
> the point at some level.

??

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "These download files are in Microsoft Word 6.0 format. After
  unzipping, these files can be viewed in any text editor, including
  all versions of Microsoft Word, WordPad, and Microsoft Word Viewer."
    -- http://www.microsoft.com/hwdev/pc99.htm




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