Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2005:
[Freeciv-Dev] (PR#12264) Government helptext
Home

[Freeciv-Dev] (PR#12264) Government helptext

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12264) Government helptext
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Tue, 15 Feb 2005 08:11:13 -0800
Reply-to: bugs@xxxxxxxxxxx

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

Finally, dynamically created government helptexts :)

I think perhaps the output is more interesting to most than the
patch itself, so please read the below and comment. The text will be in
addition to and after any helptext in the ruleset.

Anarchy :
"Has unlimited science/tax/luxuries rates.

Chance of civil war is 90% if you lose your capital.

First unhappy citizen due to civilization size will come when you
have 9 cities.  Every 6 cities after this will result in one more
unhappy citizen in each city.

Features:
* You may impose martial law.  Each military unit inside a city, up
to a maximum of 100, will keep 1 unhappy citizen(s) content.  (Or at
least, unhappy citizens will act content, and will not cause
disorder.)
* Each of your cities will support as many units without paying
their Shield upkeep as its city size.
* You pay normal Food upkeep for your units.
* You pay normal Shield upkeep for your units.
* You do not pay Gold upkeep for any of your units.
* Each worked tile will yield a maximum of 2 Food when not
celebrating.
* Each worked tile will yield a maximum of 2 Shield when not
celebrating.
* Each worked tile will yield a maximum of 2 Trade when not
celebrating.
* Trade production will suffer waste."

Communism:
"Requires Communism.

The maximum rate you can set for science, tax or luxuries is 80%.

Chance of civil war is 50% if you lose your capital.

First unhappy citizen due to civilization size will come when you
have 12 cities.

Features:
* You may impose martial law.  Each military unit inside a city, up
to a maximum of 3, will keep 2 unhappy citizen(s) content.  (Or at
least, unhappy citizens will act content, and will not cause
disorder.)
* Each of your cities will support 3 units without paying their
Shield upkeep.
* You pay normal Food upkeep for your units.
* You pay normal Shield upkeep for your units.
* You pay normal Gold upkeep for your units.
* Each worked tile will yield 1 additional Trade when celebrating.
* Trade production will suffer waste.
* Diplomats will be veteran when built.
* Partisans may appear when cities are taken by the enemy.

Democracy:
"Requires Democracy.

Has unlimited science/tax/luxuries rates.

Chance of civil war is 30% if you lose your capital.

First unhappy citizen due to civilization size will come when you
have 14 cities.  Every 16 cities after this will result in one more
unhappy citizen in each city.

Features:
* Military units may cause unhappiness.
* Military cause 2 times normal unhappiness.
* You pay 2 times normal Food upkeep for your units.
* You pay normal Shield upkeep for your units.
* You pay normal Gold upkeep for your units.
* Each worked tile will yield 1 additional Trade.
* You may grow your cities by means of celebrations.  Your cities
must be at least size 3 before they can grown in this manner.
* Government will fall if any city is in disorder more than two
turns in a row.
* Units and cities cannot be bribed or incited.
* Partisans may appear when cities are taken by the enemy.
* Has a senate that may throw the government into anarchy if war is
declared while reputation is low."

...

The waste message is quite uninformative, but turning the insane
parameters of the waste options into something intelligible on the fly is
IMHO a rather difficult task.

   - Per

Index: client/helpdata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/helpdata.c,v
retrieving revision 1.94
diff -u -r1.94 helpdata.c
--- client/helpdata.c   22 Jan 2005 19:45:39 -0000      1.94
+++ client/helpdata.c   15 Feb 2005 16:05:57 -0000
@@ -1160,6 +1160,20 @@
 void helptext_government(char *buf, int i, const char *user_text)
 {
   struct government *gov;
+  bool active_types[O_MAX];
+  int j;
+
+  /* Try to guess which output types that are active in this 
+   * game by checking if _any_ government uses it. */
+  memset(active_types, FALSE, sizeof(active_types));
+  government_iterate(g) {
+    for (j = 0; j < O_MAX; j++) {
+      if (g->unit_upkeep_factor[j] > 0
+          || g->free_upkeep[j]) {
+        active_types[j] = TRUE;
+      }
+    }
+  } government_iterate_end;
   
   buf[0] = '\0';
 
@@ -1172,6 +1186,169 @@
   if (gov->helptext[0] != '\0') {
     sprintf(buf, "%s\n\n", _(gov->helptext));
   }
+  if (gov->required_tech != A_NONE) {
+    sprintf(buf + strlen(buf), _("Requires %s.\n\n"), 
+            advances[gov->required_tech].name);
+  }
+  if (gov->max_rate < 100 && game.rgame.changable_tax) {
+    sprintf(buf + strlen(buf), 
+            _("The maximum rate you can set for science, "
+            "tax or luxuries is %d%%.\n\n"), gov->max_rate);
+  } else if (game.rgame.changable_tax) {
+    sprintf(buf + strlen(buf), 
+            _("Has unlimited science/tax/luxuries rates.\n\n"));
+  }
+  sprintf(buf + strlen(buf), 
+          _("Chance of civil war is %d%% if you lose your capital.\n\n"),
+          gov->civil_war);
+  sprintf(buf + strlen(buf), _("First unhappy citizen due to "
+          "civilization size will come when you have %d cities."),
+          game.cityfactor + gov->empire_size_mod);
+  if (gov->empire_size_inc > 0) {
+    sprintf(buf + strlen(buf), _("  Every %d cities after this will "
+            "result in one more unhappy citizen in each city."),
+            gov->empire_size_inc);
+  }
+
+  sprintf(buf + strlen(buf), _("\n\nFeatures:\n"));
+  if (gov->martial_law_max > 0) {
+    sprintf(buf + strlen(buf), _("* You may impose martial law.  Each "
+            "military unit inside a city, up to a maximum of %d, will "
+            "keep %d unhappy citizen(s) content.  (Or at least, unhappy "
+            "citizens will act content, and will not cause disorder.)\n"),
+            gov->martial_law_max, gov->martial_law_per);
+  }
+  if (gov->unit_happy_cost_factor > 0) {
+    sprintf(buf + strlen(buf), _("* Military units may cause unhappiness.\n"));
+    if (gov->free_happy == G_CITY_SIZE_FREE) {
+      sprintf(buf + strlen(buf), _("* Each of your cities will tolerate "
+              "as many units that would otherwise cause unhappiness as its "
+              "city size"));
+    } else if (gov->free_happy > 0) {
+      sprintf(buf + strlen(buf), _("* Each of your cities will tolerate %d "
+              "units that would otherwise cause unhappiness.\n"), 
+              gov->free_happy);
+    }
+  }
+  output_type_iterate(ot) {
+    if (gov->free_upkeep[ot] == G_CITY_SIZE_FREE) {
+      sprintf(buf + strlen(buf), _("* Each of your cities will support "
+              "as many units without paying their %s upkeep as its city "
+              "size.\n"), get_output_name(ot));
+    } else if (gov->free_upkeep[ot] > 0) {
+      sprintf(buf + strlen(buf), _("* Each of your cities will support "
+              "%d units without paying their %s upkeep.\n"), 
+              gov->free_upkeep[ot], get_output_name(ot));
+    }
+  } output_type_iterate_end;
+  if (gov->unit_happy_cost_factor > 1) {
+    sprintf(buf + strlen(buf), _("* Military cause %d times normal "
+            "unhappiness.\n"), gov->unit_happy_cost_factor);
+  }
+  output_type_iterate(ot) {
+    if (!active_types[ot]) {
+      continue;
+    }
+    if (gov->unit_upkeep_factor[ot] == 1) {
+      sprintf(buf + strlen(buf), _("* You pay normal %s upkeep for "
+              "your units.\n"), get_output_name(ot));
+    } else if (gov->unit_upkeep_factor[ot] > 1) {
+      sprintf(buf + strlen(buf), _("* You pay %d times normal %s "
+              "upkeep for your units.\n"), gov->unit_upkeep_factor[ot],
+              get_output_name(ot));
+    } else if (gov->unit_upkeep_factor[ot] == 0) {
+      sprintf(buf + strlen(buf), _("* You do not pay %s upkeep for "
+              "any of your units.\n"), get_output_name(ot));
+    }
+  } output_type_iterate_end;
+  output_type_iterate(ot) {
+    if (gov->output_before_penalty[ot] > 0
+        && gov->output_before_penalty[ot] 
+           == gov->celeb_output_before_penalty[ot]) {
+      sprintf(buf + strlen(buf), _("* Each worked tile will yield "
+              "a maximum of %d %s.\n"), 
+              gov->output_before_penalty[ot], get_output_name(ot));
+    } else if (gov->output_before_penalty[ot] > 0) {
+      sprintf(buf + strlen(buf), _("* Each worked tile will yield "
+              "a maximum of %d %s when not celebrating.\n"), 
+              gov->output_before_penalty[ot], get_output_name(ot));
+    }
+  } output_type_iterate_end;
+  output_type_iterate(ot) {
+    if (gov->celeb_output_before_penalty[ot] > 0
+        && gov->celeb_output_before_penalty[ot] 
+           != gov->output_before_penalty[ot]) {
+      sprintf(buf + strlen(buf), _("* Each worked tile will yield "
+              "a maximum of %d %s when celebrating.\n"), 
+              gov->celeb_output_before_penalty[ot], get_output_name(ot));
+    }
+  } output_type_iterate_end;
+  output_type_iterate(ot) {
+    if (gov->output_inc_tile[ot] > 0
+        && gov->output_inc_tile[ot] == gov->celeb_output_inc_tile[ot]) {
+      sprintf(buf + strlen(buf), _("* Each worked tile will yield "
+              "%d additional %s.\n"), 
+              gov->output_inc_tile[ot], get_output_name(ot));
+    } else if (gov->output_inc_tile[ot] > 0) {
+      sprintf(buf + strlen(buf), _("* Each worked tile will yield "
+              "%d additional %s when not celebrating.\n"), 
+              gov->output_inc_tile[ot], get_output_name(ot));
+    }
+  } output_type_iterate_end;
+  output_type_iterate(ot) {
+    if (gov->celeb_output_inc_tile[ot] > 0
+        && gov->celeb_output_inc_tile[ot] != gov->output_inc_tile[ot]) {
+      sprintf(buf + strlen(buf), _("* Each worked tile will yield "
+              "%d additional %s when celebrating.\n"), 
+              gov->celeb_output_inc_tile[ot], get_output_name(ot));
+    }
+  } output_type_iterate_end;
+  output_type_iterate(ot) {
+    if (gov->waste[ot].level > 0) {
+      sprintf(buf + strlen(buf), _("* %s production will suffer "
+              "waste.\n"), get_output_name(ot));
+    }
+  } output_type_iterate_end;
+  if (government_has_flag(gov, G_RAPTURE_CITY_GROWTH)) {
+    sprintf(buf + strlen(buf), _("* You may grow your cities by "
+            "means of celebrations.  Your cities must be at least "
+            "size %d before they can grown in this manner.\n"),
+            gov->rapture_size);
+  }
+  if (government_has_flag(gov, G_BUILD_VETERAN_DIPLOMAT)) {
+    sprintf(buf + strlen(buf), _("* Diplomats will be veteran when "
+            "built.\n"));
+  }
+  if (government_has_flag(gov, G_REVOLUTION_WHEN_UNHAPPY)) {
+    sprintf(buf + strlen(buf), _("* Government will fall if any "
+            "city is in disorder more than two turns in a row.\n"));
+  }
+  if (government_has_flag(gov, G_UNBRIBABLE)) {
+    sprintf(buf + strlen(buf), _("* Units and cities cannot be "
+            "bribed or incited.\n"));
+  }
+  if (government_has_flag(gov, G_INSPIRES_PARTISANS)) {
+    sprintf(buf + strlen(buf), _("* Partisans may appear when "
+            "cities are taken by the enemy.\n"));
+  }
+  if (government_has_flag(gov, G_FANATIC_TROOPS)) {
+    sprintf(buf + strlen(buf), _("* Pays no upkeep for fanatics.\n"));
+  }
+  if (government_has_flag(gov, G_HAS_SENATE)) {
+    sprintf(buf + strlen(buf), _("* Has a senate that may throw "
+            "the government into anarchy if war is declared while "
+            "reputation is low.\n"));
+  }
+  if (government_has_flag(gov, G_NO_UNHAPPY_CITIZENS)) {
+    sprintf(buf + strlen(buf), _("* Has no unhappy citizens.\n"));
+  }
+  if (government_has_flag(gov, G_CONVERT_TITHES_TO_MONEY)) {
+    sprintf(buf + strlen(buf), _("* Buildings that normally confer "
+            "bonuses against unhappiness will instead give gold.\n"));
+  }
+  if (government_has_flag(gov, G_REDUCED_RESEARCH)) {
+    sprintf(buf + strlen(buf), _("* Research costs doubled.\n"));
+  }
   unit_type_iterate(ut) {
     struct unit_type *utype = get_unit_type(ut);
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12264) Government helptext, Per I. Mathisen <=