Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2001:
[Freeciv-Dev] Re: Settlers turns left calculation in GUI is wrong. (PR#9
Home

[Freeciv-Dev] Re: Settlers turns left calculation in GUI is wrong. (PR#9

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: andreas.beckmann@xxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Settlers turns left calculation in GUI is wrong. (PR#981)
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 27 Sep 2001 11:21:33 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Wed, Sep 26, 2001 at 03:23:14PM -0700, andreas.beckmann@xxxxxxxxxxxxxxxxxxxx 
wrote:
> Full_Name: Andreas Beckmann
> Version: 1.12.1-devel
> Distribution: Built from source
> Client: Gtk+
> OS: Linux
> Submission from: (NULL) (217.226.252.168)
> 
> 
> There is a bug in the new GTK addition that shows the remaining turns 
> of settler activity: 
> 
> (1) Units with 0 moves left do not do any activity in the current turn but
> were treated as units with moves left. The calculation could show 1 turn
> less than actually needed. (This happens only in the first turn, when the 
> activity has been assigned, the result in the following turns will be 
> correct.)
> Note: This doesn't alter the duration of any settler activity, only the
> duration in the middle-click popup will be incorrect.
> 
> (2) By assigning an activity to too much settlers the remaining turns could
> become <= 0 (not testet, I just re-read the patch).
> 
> Index: client/climisc.c
> ===================================================================
> RCS file: /home/freeciv/CVS/freeciv/client/climisc.c,v
> retrieving revision 1.61
> diff -u -u -r1.61 climisc.c
> --- client/climisc.c  2001/09/20 11:07:28     1.61
> +++ client/climisc.c  2001/09/21 22:24:24
> @@ -562,16 +562,19 @@
>    int activity_total[ACTIVITY_LAST];
>    int activity_units[ACTIVITY_LAST];
>    int num_activities = 0;
> -  int remains, i, mr;
> +  int remains, turns, i, mr, au;

What stands au for?

>    struct tile *ptile = map_get_tile(x, y);
>  
>    memset(activity_total, 0, sizeof(activity_total));
>    memset(activity_units, 0, sizeof(activity_units));
>  
>    unit_list_iterate(ptile->units, punit) {
> -    activity_total[punit->activity] += punit->activity_count;
>      mr = get_unit_type(punit->type)->move_rate;
> -    activity_units[punit->activity] += mr ? mr / SINGLE_MOVE : 1;

Mhh what kinds of values does the term "mr ? mr / SINGLE_MOVE : 1" can
get? Can mr really be 0? Yes this isn't in your patch and I should
have catched this in the old patch.

> +    au = mr ? mr / SINGLE_MOVE : 1;
> +    activity_total[punit->activity] += punit->activity_count;
> +    if (punit->moves_left)
> +      activity_total[punit->activity] += au; /* current turn */
> +    activity_units[punit->activity] += au;
>    }
>    unit_list_iterate_end;

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  reality.sys corrupt. Reboot Universe? (y,n,q)


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