Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2001:
[Freeciv-Dev] Re: Fundamentalism form of government (PR#931)
Home

[Freeciv-Dev] Re: Fundamentalism form of government (PR#931)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Davide Pagnin <nightmare@xxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Fundamentalism form of government (PR#931)
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 2 Sep 2001 20:08:14 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Sun, Sep 02, 2001 at 07:45:46PM +0200, Davide Pagnin wrote:
> >> +  if (government_has_flag(g, G_REDUCED_RESEARCH)) {
> >> +    if (sci_rate > 50) {
> >> +      tax_rate = 50 - lux_rate;
> >> +      sci_rate = 50;
> >> +    }
> >> +  }
> >
> >I would write this as:
> >
> >> +  if (government_has_flag(g, G_REDUCED_RESEARCH)) {
> >> +    if (sci_rate > 50) {
> >> +      sci_rate = 50;
> >> +      tax_rate = 100 - sci_rate - lux_rate;
> >> +    }
> >> +  }
> 
> I can write it that why, but it is clear that has the same effect...
> tax_rate = 100 - sci_rate - lux_rate ---> 100 - 50 - lux_rate ---> 50 -
> lux_rate

I know. It is just that the "tax_rate = 100 - sci_rate - lux_rate;"
surfaces some lines above. IMHO the same thing should be written in
the same way.

> >> +  if (government_has_flag(g, G_NO_UNHAPPY_CITIZENS)) {
> >> +    pcity->ppl_content[4] += pcity->ppl_unhappy[4];
> >> +    pcity->ppl_unhappy[4] = 0;
> >> +    pcity->ppl_residue[4] = 0;
> >> +  }
> >
> >For robustness this may be written as
> >
> >> +  if (government_has_flag(g, G_NO_UNHAPPY_CITIZENS)) {
> >> +    pcity->ppl_content[4] += pcity->ppl_unhappy[4] + 
> >> pcity->ppl_residue[4];
> >> +    pcity->ppl_unhappy[4] = 0;
> >> +    pcity->ppl_residue[4] = 0;
> >> +  }
> 

> No, you're wrong. For how residue is implemented, it need not to be
> counted. In fact angry citizen are ALREADY counted as unhappy one.

I didn't notice this. Can this be changed?

> ppl_unhappy[4] == 4;
> ppl_residue[4] == 2;
> Don't mean, 4 unhappy and 2 angry
> but 2 unhappy and 2 angry. (Unhappy == unhappy - residue, angry ==
> residue)
> Sorry if this is confusing.
> 
> >>  
> >> /**************************************************************************
> >>  ...
> >>  
> >> **************************************************************************/
> >> +int unit_has_flag(struct unit_type *ut, int flag)
> >> +{
> >> +  assert(flag>=0 && flag<F_LAST);
> >> +  return BOOL_VAL(ut->flags & (1<<flag));
> >> +}
> >
> >This is a nice addition but it should be included separately.
> 

> I can surely include this in a separate file, nontheless, without
> this function is not possible to correctly handle the F_FANATIC
> flag. (Clearly I can use this code and substitute the call of the
> function, but it is more prone to errors)

I mean as a separate patch.

> Of course I leave you the final word on implementation problems, so
> if you think that I've to correct the code in the way you pointed,
> I'll do.

So size = ppl_happy + ppl_content + ppl_unhappy?! But size !=
ppl_happy + ppl_content + ppl_unhappy + ppl_residue?! I think this
should be changed before the patch is included.


        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Many of my assistants were fans of Tolkien, who wrote 'Lord of the Rings'
  and a number of other children's stories for adults.  The first character
  alphabet that was programmed for my plotter was Elvish rather than Latin."
    -- from SAIs "life as a computer for a quarter of a century"


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