<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40389 >

 After rates are adjusted, message about rate exceeding is sent about
all changed values - also those which took excess from other values.

 Fix attached.


 - ML

diff -Nurd -X.diff_ignore freeciv/common/player.c freeciv/common/player.c
--- freeciv/common/player.c     2008-04-16 22:05:32.000000000 +0300
+++ freeciv/common/player.c     2008-07-21 19:17:31.000000000 +0300
@@ -610,14 +610,15 @@
 it adjusts rates automatically adding the extra to the 2nd highest rate,
 preferring science to taxes and taxes to luxuries.
 (It assumes that for any government maxrate>=50)
+Returns actual max rate used.
 **************************************************************************/
-void player_limit_to_government_rates(struct player *pplayer)
+int player_limit_to_government_rates(struct player *pplayer)
 {
   int maxrate, surplus;
 
   /* ai players allowed to cheat */
   if (pplayer->ai.control) {
-    return;
+    return 100;
   }
 
   maxrate = get_player_bonus(pplayer, EFT_MAX_RATES);
@@ -652,7 +653,7 @@
     surplus -= 10;
   }
 
-  return;
+  return maxrate;
 }
 
 /**************************************************************************
diff -Nurd -X.diff_ignore freeciv/common/player.h freeciv/common/player.h
--- freeciv/common/player.h     2008-01-15 04:04:30.000000000 +0200
+++ freeciv/common/player.h     2008-07-21 19:14:52.000000000 +0300
@@ -259,7 +259,7 @@
                             enum tech_flag_id flag);
 int player_get_expected_income(const struct player *pplayer);
 
-void player_limit_to_government_rates(struct player *pplayer);
+int player_limit_to_government_rates(struct player *pplayer);
 
 struct city *find_palace(const struct player *pplayer);
 
diff -Nurd -X.diff_ignore freeciv/server/plrhand.c freeciv/server/plrhand.c
--- freeciv/server/plrhand.c    2008-05-16 01:50:15.000000000 +0300
+++ freeciv/server/plrhand.c    2008-07-21 19:26:27.000000000 +0300
@@ -417,22 +417,20 @@
 void check_player_government_rates(struct player *pplayer)
 {
   struct player_economic old_econ = pplayer->economic;
-  bool changed = FALSE;
-  player_limit_to_government_rates(pplayer);
-  if (pplayer->economic.tax != old_econ.tax) {
-    changed = TRUE;
+  int maxrate;
+
+  maxrate = player_limit_to_government_rates(pplayer);
+  if (old_econ.tax > maxrate) {
     notify_player(pplayer, NULL, E_NEW_GOVERNMENT,
                  _("Tax rate exceeded the max rate for %s; adjusted."), 
                  government_name_for_player(pplayer));
   }
-  if (pplayer->economic.science != old_econ.science) {
-    changed = TRUE;
+  if (old_econ.science > maxrate) {
     notify_player(pplayer, NULL, E_NEW_GOVERNMENT,
                  _("Science rate exceeded the max rate for %s; adjusted."), 
                  government_name_for_player(pplayer));
   }
-  if (pplayer->economic.luxury != old_econ.luxury) {
-    changed = TRUE;
+  if (old_econ.luxury > maxrate) {
     notify_player(pplayer, NULL, E_NEW_GOVERNMENT,
                  _("Luxury rate exceeded the max rate for %s; adjusted."), 
                  government_name_for_player(pplayer));
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to