Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2004:
[Freeciv-Dev] Re: (PR#7236) removal of most direct references to build_c
Home

[Freeciv-Dev] Re: (PR#7236) removal of most direct references to build_c

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: use_less@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7236) removal of most direct references to build_cost
From: "Raimar Falke" <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Mon, 2 Feb 2004 03:08:05 -0800
Reply-to: rt@xxxxxxxxxxx

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

On Mon, Feb 02, 2004 at 02:03:22AM -0800, James Canete wrote:
> >  - the *_buy_gold_cost. I think you got side-tracked here with the
> >  factor of 2. I have restored some of the users you added for these to
> >  use the *_build_shield_cost one and apply the factor of 2 by
> >  themself. The reason here is that these users doesn't want to know
> >  the real buy cost but some estimate.
> 
> Here are the 3 locations I chose *_buy_gold_cost that differ from your
> patch and why:
> 
> ai/aicity.c, line ~452:
> 
>     if (bestchoice.type == CT_ATTACKER 
>         && buycost > unit_types[bestchoice.choice].build_cost * 2) {
>        /* Too expensive for an offensive unit */
>        continue;
>     }
> 
> I chose unit_buy_gold_cost here because buycost is a gold cost.  Later
> on it appears in the expression pplayer->economic.gold -
> pplayer->ai.est_upkeep >= buycost on line ~462.
> 
> 
> server/cityturn.c, line ~1200
> 
>   unit_list_iterate(map_get_tile(pcity->x,pcity->y)->units, punit) {
>     cost += unit_type(punit)->build_cost * game.incite_cost.unit_factor;
>   } unit_list_iterate_end;
> 
>   /* Buildings */
>   built_impr_iterate(pcity, i) {
>     if (!is_wonder(i)) {
>       cost += improvement_value(i) * game.incite_cost.improvement_factor;
>     } else {
>       cost += improvement_value(i) * 2 *
> game.incite_cost.improvement_factor;
>     }
>   } built_impr_iterate_end;
> 
> I set these to buy costs because I wanted to make sure the calculation
> for inciting the city was independent of the number of shields and more
> a reflection of the buying cost.  If my accelerated production patch
> were applied here, the price of inciting a city would drop.  If I recall
> correctly, Civ 3 kept buy prices and diplomat action prices the same
> regardless of shield cost under accelerated production.  I could be
> wrong though.  Perhaps another function, *_bribe_gold_cost() or
> *_spy_action_base_gold_cost(), is in order.

Both are AI estimates. I think the original code was already a
kludge.

Per, Gregory please comment. Do you want these estimations:
 - based on *_build_shield_cost() (this would keep the current code)
 or
 - replaced with something like *_buy_gold_cost(...,0) (this would be
 the most exact) or
 - a new function *_ai_value() or similar.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "This is Linux Country. On a quiet night, you can hear Windows reboot."




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