Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2001:
[Freeciv-Dev] Re: Tech cost patch v16 (PR#1082)
Home

[Freeciv-Dev] Re: Tech cost patch v16 (PR#1082)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Juha Litola <slave@xxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Tech cost patch v16 (PR#1082)
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 16 Dec 2001 16:57:05 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Thu, Dec 13, 2001 at 06:11:28PM +0200, Juha Litola wrote:
> On Thu, Dec 13, 2001 at 04:17:34PM +0100, Raimar Falke wrote:
> > On Sun, Dec 09, 2001 at 01:40:42PM +0200, Juha Litola wrote:
> 
> > > +  if(has_capability("turn", aconnection.capability)) {
> > This "turn" looks odd.
> Yes, it should be tech_cost_style. Fixed.
> 
> > > +  req[tech]++;
> > Is this equvialant to "req[tech]=1"?
> Yes. Changed.
> 
> > find_unknown_req_techs and num_req_techs_rec perform the same
> > task. Can you unify them to:
> I'm not sure that this is too elegant, but I merged them
> to find_requirements-function.
> 
> > It is more robust to do
> > case 0:
> > ...
> > case 1:
> > case 2:
> >   return goal_tech_cost_rec(pplayer, goal);
> > default:
> >   assert(0);
> >   exit(1);
> Changed.
> 
> Also changed goal_tech_cost to tech_cost_for_reaching_goal and
> num_unknown_req_techs to num_requirements.

Can't precalc_tech_data use num_requirements?

find_requirements, num_requirements should get a "tech_" as prefix.

Type of "tech" in precalc_tech_data should be Tech_Type_id.

I agree that a

  int is_tech_a_requirement_tech_for(struct player *pplayer, Tech_Type_id goal, 
Tech_Type_id to_test);

would be nice. This allows to make find_requirements a static
function. is_tech_a_requirement_tech_for could be implemented brute
force or with a cache which is contained in the player struct.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "When C++ is your hammer, everything looks like a thumb."
    -- Steven M. Haflich


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