[Freeciv-Dev] Re: (PR#12841) city_luxury_need function
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12841 >
On Thu, 21 Apr 2005, Benoit Hudson wrote:
> There's a comment that the celebrate code is buggy, but now I'm not sure
> I believe the order code either: it doesn't take account of happy
> citizens -- if the city has more happy than unhappy, it still says we
> need luxuries.
Huh? Only the comment is wrong.
+ /* Find out how much luxuries we need to make everyone content. */
+ result = MAX((angry * 2 + unhappy - happy) * HAPPY_COST, 0);
This code will make the city orderly, not all content. Happy citizens will
keep unhappy citizens in line. The comment was not updated when the code
was...
+ /* Find out how much extra luxuries we will need to make enough
+ * citizens happy that we can celebrate. */
+ result += MAX(((pcity->size - happy + 1) / 2) * HAPPY_COST, 0);
So this will then be wrong, since IIRC you cannot celebrate if there are
_any_ unhappy people in the city. It should be
+ result += MAX(((pcity->size - MAX(happy - (unhappy + angry * 2), 0)
+ + 1) / 2) * HAPPY_COST, 0);
Since you must additionally make content those we did not make content in
the first calculation.
Tricky...
- Per
- [Freeciv-Dev] Re: (PR#12841) city_luxury_need function, Per I. Mathisen, 2005/04/19
- [Freeciv-Dev] (PR#12841) city_luxury_need function, Jason Short, 2005/04/20
- [Freeciv-Dev] Re: (PR#12841) city_luxury_need function, Per I. Mathisen, 2005/04/21
- [Freeciv-Dev] Re: (PR#12841) city_luxury_need function, Benoit Hudson, 2005/04/21
- [Freeciv-Dev] Re: (PR#12841) city_luxury_need function, Benoit Hudson, 2005/04/21
- [Freeciv-Dev] Re: (PR#12841) city_luxury_need function, Benoit Hudson, 2005/04/21
- [Freeciv-Dev] Re: (PR#12841) city_luxury_need function,
Per I. Mathisen <=
- [Freeciv-Dev] Re: (PR#12841) city_luxury_need function, Benoit Hudson, 2005/04/21
- [Freeciv-Dev] Re: (PR#12841) city_luxury_need function, Jason Short, 2005/04/21
- [Freeciv-Dev] Re: (PR#12841) city_luxury_need function, Jason Short, 2005/04/21
- [Freeciv-Dev] Re: (PR#12841) city_luxury_need function, Per I. Mathisen, 2005/04/21
- [Freeciv-Dev] Re: (PR#12841) city_luxury_need function, Brian Dunstan, 2005/04/21
- [Freeciv-Dev] Re: (PR#12841) city_luxury_need function, Benoit Hudson, 2005/04/21
|
|