Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2003:
[Freeciv-Dev] Re: Gold upkeep
Home

[Freeciv-Dev] Re: Gold upkeep

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Gold upkeep
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Tue, 17 Jun 2003 17:17:23 +0000 (GMT)

On Tue, 17 Jun 2003, Remi wrote:
> >+unit_list_iterate(pcity->units_supported, punit) {
> >+  upkeep = utype_gold_cost(unit_type(punit), pgov);
> >
> >So here we should instead use
> >
> >     upkeep = punit->upkeep_gold;
> >
> This fonction is needed! utype_gold_cost returns upkeep * gold_factor
> (field in government.ruleset)

Right. Then it seems you must do this here as well, without using
utype_gold_cost(), since punit->upkeep_gold contains the adjusted upkeep
which you must use (adjusted for government's free units).

> >+  if (pplayer->economic.gold + potential_gold + free_pool < upkeep) {
> >
> >And: if (pplayer->economic.gold < upkeep)
> >
> >
> Do you mean that you prefer disbanding units than selling? If you remove
> potential_gold, you will disband units even if there is building to sell.

I forgot about potential_gold. It should of course be there. My bad.

> >+    assert(pplayer->economic.gold + potential_gold + free_pool >= 0);
> >+
> >
> >Remove this assert. It is perfectly possible that this happens, it is not
> >an error. We just have too many gold upkeeping units.
...
> No! It can't happen! If we have too many units, they will be disbanded
> in previous loops before this happen. If this assert is false, that
> means that after selling all improvements in this city and even if next
> units are disbanded, gold will be negative!

Ok.

  - Per



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