Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2004:
[Freeciv-Dev] (PR#8904) dangerous terrains need documentation
Home

[Freeciv-Dev] (PR#8904) dangerous terrains need documentation

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: mburda@xxxxxxxxx
Cc: freeciv-data@xxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#8904) dangerous terrains need documentation
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 23 Nov 2004 23:19:23 -0800
Reply-to: rt@xxxxxxxxxxx

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

Here's a better patch.  It generates the helptext for the terrain
automatically.  I also added support for some other terrain flags.

jason

Index: client/helpdata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/helpdata.c,v
retrieving revision 1.85
diff -u -r1.85 helpdata.c
--- client/helpdata.c   20 Nov 2004 08:25:19 -0000      1.85
+++ client/helpdata.c   24 Nov 2004 07:18:27 -0000
@@ -1097,12 +1097,45 @@
     freelog(LOG_ERROR, "Unknown terrain %d.", i);
     return;
   }
-
   pt = &tile_types[i];
+
+  if (terrain_has_flag(i, TER_NO_POLLUTION)) {
+    sprintf(buf + strlen(buf),
+           _("* Pollution cannot be generated on this terrain."));
+    strcat(buf, "\n");
+  }
+  if (terrain_has_flag(i, TER_NO_CITIES)) {
+    sprintf(buf + strlen(buf),
+           _("* You cannot build cities on this terrain."));
+    strcat(buf, "\n");
+  }
+  if (terrain_has_flag(i, TER_UNSAFE_COAST)
+      && !is_ocean(i)) {
+    sprintf(buf + strlen(buf),
+           _("* The coastline of this terrain is unsafe."));
+    strcat(buf, "\n");
+  }
+  if (terrain_has_flag(i, TER_UNSAFE)) {
+    sprintf(buf + strlen(buf),
+           _("* This terrain is unsafe for units to travel on."));
+    strcat(buf, "\n");
+  }
+  if (terrain_has_flag(i, TER_OCEANIC)) {
+    sprintf(buf + strlen(buf),
+           _("* Only naval units can travel on oceanic terrains."));
+    strcat(buf, "\n");
+  }
+
   if (pt->helptext[0] != '\0') {
-    sprintf(buf, "%s\n\n", _(pt->helptext));
+    if (buf[0] != '\0') {
+      strcat(buf, "\n");
+    }
+    sprintf(buf + strlen(buf), "%s", _(pt->helptext));
+  }
+  if (user_text && user_text[0] != '\0') {
+    strcat(buf, "\n\n");
+    strcat(buf, user_text);
   }
-  strcat(buf, user_text);
   wordwrap_string(buf, 68);
 }
 

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