[Freeciv-Dev] Re: build_cost_prime (PR#1194)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Thu, Jan 03, 2002 at 05:45:37AM -0800, Gregory Berkolaiko wrote:
> Hi,
>
> the variable with an expressive name "fprime" is calculated in the same
> way in 3 different places. I propose to separate the calculation into a
> function and supply it with a comment. The patch is attached.
Can you create a better name? Or can you explain the "prime"?
You may also remove the fprime variable in the callers.
> /**************************************************************************
> +In the words of Syela:
> +"Using funky fprime variable instead of f in the denom, so
> +that def=1 units are penalized correctly."
> +Translation (GB):
> +build_cost_prime is used in the denominator of the want equation (see, e.g.
> +find_something_to_kill) instead of just build_cost to make AI build more
> +balanced units.
> +**************************************************************************/
> +int build_cost_prime(Unit_Type_id i)
> +{
> + int res;
> +
> + res = 2 * unit_types[i].build_cost * unit_types[i].attack_strength /
> + (unit_types[i].attack_strength + unit_types[i].defense_strength);
> + return res;
> +}
Make it a simple return statement.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"With a PC, I always felt limited by the software available.
On Unix, I am limited by my knowledge."
-- Peter J. Schoenster <pschon@xxxxxxxxxxxxxxxxx>
|
|