Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2001:
[Freeciv-Dev] Re: BUG/PATCH: Overproduction problems (PR#670)
Home

[Freeciv-Dev] Re: BUG/PATCH: Overproduction problems (PR#670)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx (Freeciv developers)
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: BUG/PATCH: Overproduction problems (PR#670)
From: Reinier Post <rp@xxxxxxxxxx>
Date: Thu, 25 Jan 2001 21:01:44 +0100

On Thu, Jan 25, 2001 at 05:38:55AM -0800, Joona Kiiski wrote:

(bug in 'production type' penalty': the penalty is only applied when
the *last* change was a change of type)

Interesting, I've played many games and never noticed this.
As far I'm concerned it's just a bug.

> If you agree with me that this kind of behaviour is totally against the spirit
> of Civ2, please put this patch in CVS. In Civ2 you lose all shields which are
> over the limit, but I think that 50 per cent penalty is enough. That's the 
> same
> penalty when you for example change production from temple to warrior.

I think the penalty should ideally be configurable with a 'prodloss'
variable.  (Without such a variable we should at least document it - but
where?)  There is a related Civ II incompatibility; in Civ II, if you
produce a settler in a size 1 city, you lose all shields!

> The patch is made against CVS 23-jan.
> 
> Waiting for your reactions/opinions,

Very welcome ...
> 
Content-Description: fix_production_owerflow.diff
> diff -ruN -Xdiff_ignore freeciv_cvs/server/cityturn.c 
> freeciv/server/cityturn.c
> --- freeciv_cvs/server/cityturn.c     Wed Jan 24 16:39:15 2001
> +++ freeciv/server/cityturn.c Wed Jan 24 17:27:26 2001
> @@ -1276,7 +1276,8 @@
>    struct government *g = get_gov_pplayer(pplayer);
>    int space_part;
>    int city_built_city_builder;
> -
> +  int production_overflow;
> +  
>    while (pcity->shield_surplus<0) {
>      unit_list_iterate(pcity->units_supported, punit) {
>        if (utype_shield_cost(get_unit_type(punit->type), g)) {
> @@ -1290,7 +1291,18 @@
>      unit_list_iterate_end;
>    }
>  
> -  pcity->shield_stock+=pcity->shield_surplus;
> +  if (!pcity->is_building_unit &&
> +      pcity->shield_stock > improvement_value (pcity->currently_building))
> +    production_overflow = pcity->shield_stock -
> +      improvement_value (pcity->currently_building);
> +  else if (pcity->is_building_unit &&
> +      pcity->shield_stock > unit_value (pcity->currently_building))
> +    production_overflow = pcity->shield_stock -
> +      unit_value (pcity->currently_building);
> +  else
> +    production_overflow = 0;
> +     
> +  pcity->shield_stock+=pcity->shield_surplus;
>    if (!pcity->is_building_unit) {
>      if (pcity->currently_building==B_CAPITAL) {
>        pplayer->economic.gold+=pcity->shield_surplus;
> @@ -1441,7 +1453,11 @@
>  
>      }
>    }
> -return 1;
> +
> +  if (pcity->turn_last_built == game.year && production_overflow)
> +    pcity->shield_stock -= (production_overflow + 1) / 2;
> +
> +  return 1;
>  }
>  
>  /**************************************************************************

-- 
Reinier



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