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: rf13@xxxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Fundamentalism form of government (PR#931)
From: Davide Pagnin <nightmare@xxxxxxxxxx>
Date: Sun, 02 Sep 2001 19:45:46 +0200

>> +  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

>> +  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. 
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)

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.

Thanks.

        Ciao, Davide


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