Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2004:
[Freeciv-Dev] Re: (PR#9590) Cleanup of empire size and unhappiness
Home

[Freeciv-Dev] Re: (PR#9590) Cleanup of empire size and unhappiness

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#9590) Cleanup of empire size and unhappiness
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Wed, 13 Oct 2004 15:17:07 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9590 >

An untested patch for gtk1 client. Other clients may also need changes - I
don't know.

  - Per

Index: client/gui-gtk/happiness.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/happiness.c,v
retrieving revision 1.18
diff -u -r1.18 happiness.c
--- client/gui-gtk/happiness.c  16 Jul 2004 19:37:57 -0000      1.18
+++ client/gui-gtk/happiness.c  13 Oct 2004 22:12:48 -0000
@@ -223,32 +223,13 @@
 
   struct city *pcity = pdialog->pcity;
   struct player *pplayer = &game.players[pcity->owner];
-  struct government *g = get_gov_pcity(pcity);
-  int cities = city_list_size(&pplayer->cities);
-  int content = game.unhappysize;
-  int basis = game.cityfactor + g->empire_size_mod;
-  int step = g->empire_size_inc;
-  int excess = cities - basis;
-  int penalty = 0;
-
-  if (excess > 0) {
-    if (step > 0)
-      penalty = 1 + (excess - 1) / step;
-    else
-      penalty = 1;
-  } else {
-    excess = 0;
-    penalty = 0;
-  }
+  int penalty, content, cities;
 
-  my_snprintf(bptr, nleft,
-             _("Cities: %d total, %d over threshold of %d cities.\n"),
-             cities, excess, basis);
-  bptr = end_of_strn(bptr, &nleft);
+  calculate_happiness(pplayer, &cities, &content, &penalty);
 
   my_snprintf(bptr, nleft, _("%d content before penalty with "), content);
   bptr = end_of_strn(bptr, &nleft);
-  my_snprintf(bptr, nleft, _("%d additional unhappy citizens."), penalty);
+  my_snprintf(bptr, nleft, _("%d unhappy due to size of empire."), penalty);
   bptr = end_of_strn(bptr, &nleft);
 
   gtk_set_label(pdialog->hlabels[CITIES], buf);

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