Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2001:
[Freeciv-Dev] Re: Tech cost patch v3
Home

[Freeciv-Dev] Re: Tech cost patch v3

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Juha Litola <slave@xxxxxxxxxxxx>
Cc: Petr Baudis <pasky@xxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Tech cost patch v3
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 28 Nov 2001 16:41:39 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Wed, Nov 28, 2001 at 04:52:14PM +0200, Juha Litola wrote:
> On Wed, Nov 28, 2001 at 03:05:29PM +0100, Petr Baudis wrote:
> > It doesn't look bad, only the coding style needs to be fined a bit, IMHO.
> It would help to know what it currently is ;)
> 
> Included is modified patch with following chages:
> - Converted c++-style comments to c-style
> - Add capability tech_cost
> - Added cost field to advance-structure
> - Calculate costs only once
> - Converted if in tech_cost to switch
> - Got rid of floats
> - Changed for (i = 0; i < players; ++i) to player_iterate
> 
> > Shouldn't you also modify ai/advmilitary.c ? >:)
> I hope not, I haven't got faintest idea what happens there. Someone
> more familiar with ai should probably check if modifications are
> needed.
> 
> --
> // Juha Litola

> diff -u -b -r1.89 capstr.c
> --- common/capstr.c   2001/10/12 12:22:18     1.89
> +++ common/capstr.c   2001/11/28 14:55:25
> @@ -71,7 +71,7 @@
>   */
>  
>  #define CAPABILITY "+1.11.6 conn_info pop_cost turn attributes 
> new_bonus_tech"\
> -" fund_added processing_packets angrycitizen tile_trade init_techs"
> +" fund_added processing_packets angrycitizen tile_trade init_techs tech_cost"

You have to add a description below. I would also choose tech_cost_style.

> +/**************************************************************************
> + Count cost for technology recursively. 
> + Do no call this function directly, use tech_cost instead.
> + Result is researchcost*(1+numparents)
> +**************************************************************************/
> +int tech_cost_rec(struct player *pplayer, int tech)

Replace with 
  int tech_cost_rec(struct player *pplayer, Tech_Type_id tech)

> +{
> +  int price = game.researchcost;

> +  if (tech == 0)
A_NONE

Also shouldn't this function be called "deep_num_of_requirements" or
similar?

> +  int cost;

You should document this field.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  One nuclear bomb can ruin your whole day.


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