Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] (PR#11572) building targets for is_req_active
Home

[Freeciv-Dev] (PR#11572) building targets for is_req_active

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11572) building targets for is_req_active
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 28 Mar 2005 17:00:51 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=11572 >

> [vasc - Fri Dec 17 18:32:05 2004]:
> 
> On Fri, 17 Dec 2004, Jason Short wrote:
> 
> >
> > <URL: http://bugs.freeciv.org/Ticket/Display.html?id=11572 >
> >
> > The building target passed in to is_req_active really needs to be a
> > pointer rather than an integer value.  The problem with an integer value
> > is it's not typesafe.  It will be very easy for a caller to pass in 0
> > for the integer value (as one would pass in 0 for the pointer values)
> > thinking that this means there is no building target.  But in fact it
> > means the opposite: you have to pass in B_LAST to get no building
target.
> >
> > The only impediment to changing this is that there is no impr->index
> > value in the impr_type struct.  Since most functions require an
> > improvement index there is no way to call them from a pointer value.
> > This should be changed (simply by adding an index field).
> 
> This will make the code even slower...

I don't think so.  Since you have to do a lookup on the building before
you can do anything with it, passing in the value with the lookup
already done can potentially make things faster.  For instance when the
same change was made to the tile structure the code became significantly
faster.  However for buildings the amount of lookups is much smaller so
I doubt there will be a measurable difference either way.

-jaosn




[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#11572) building targets for is_req_active, Jason Short <=