Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2003:
[Freeciv-Dev] Re: (PR#4769) Re: Re: (PR#4761) civserver get_invention cr
Home

[Freeciv-Dev] Re: (PR#4769) Re: Re: (PR#4761) civserver get_invention cr

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: chrisk@xxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#4769) Re: Re: (PR#4761) civserver get_invention crash
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 6 Aug 2003 15:43:37 -0700
Reply-to: rt@xxxxxxxxxxxxxx

Per I. Mathisen wrote:
> On Wed, 6 Aug 2003, Jason Short wrote:
> 
>>Of course there are no UNDISBANDABLE units with upkeep in the default
>>ruleset, so it's a bug that we hit this code at all.The logic in
>>city_distribute_surplus_shields is faulty and will cause population loss
>>any time you have to disband more than one unit from a city at a time.
>>
>>Fix attached; this is in addition to the other (memory corruption)
>>patch.You can see the current code is faulty by adding in the 'assert'
>>line from this patch all by itself: the assertion will trigger.
> 
> 
> What about this? Untested.

I think it's bad for 2 reasons:

- All disbandable units should be disbanded before any undisbandable 
units are considered.  I.e., you shouldn't lose population if there is a 
disbandable unit waiting later in the list.

- handle_unit_disband will recalculate pcity->shield_surplus from 
scratch, which loses any manual changes that have already been done in 
the function (this isn't a problem if undisbandable units are all 
handled last).

jason




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