Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2005:
[Freeciv-Dev] (PR#15007) Improving civmanual
Home

[Freeciv-Dev] (PR#15007) Improving civmanual

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#15007) Improving civmanual
From: "Guillaume Melquiond" <guillaume.melquiond@xxxxxxxxx>
Date: Wed, 28 Dec 2005 01:10:13 -0800
Reply-to: bugs@xxxxxxxxxxx

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

I will use this report to post patches for improving civmanual until
it can be used to update the current wiki documentation (Freeciv 2.0
*beta*, it still contains older graphics and translations).

This first patch factors buildings and wonders generation (they are
both improvements, there is no reason to duplicate the code), so that
next patches are easier to write/review. It also modifies the output
so that it matches the current wiki structure: everything in one big
table.

This patch does not change the output style: it still is a mix of html
and wiki sequences. Next patches will improve the control sequences so
that the non-html mode purely generates mediawiki control sequences.

Index: manual/civmanual.c
===================================================================
--- manual/civmanual.c  (révision 11408)
+++ manual/civmanual.c  (copie de travail)
@@ -302,64 +302,44 @@
       break;
 
     case MANUAL_BUILDINGS:
-      fprintf(doc, _("<h1>Freeciv %s buildings help</h1>\n\n"), 
VERSION_STRING);
+    case MANUAL_WONDERS:
+      if (manuals == MANUAL_BUILDINGS)
+       fprintf(doc, _("<h1>Freeciv %s buildings help</h1>\n\n"), 
VERSION_STRING);
+      else
+       fprintf(doc, _("<h1>Freeciv %s wonders help</h1>\n\n"), VERSION_STRING);
+
+
+      fprintf(doc, "<table>\n<tr bgcolor=#9bc3d1><th>%s</th><th>%s</th>"
+                  "<th>%s<br/>%s</th><th>%s<br/>%s</th><th>%s</th></tr>\n\n",
+             _("Graphics"), _("Name"), _("Cost"), _("Upkeep"),
+             _("Requirement"), _("Obsolete by"), _("More info"));
+
       impr_type_iterate(id) {
        struct impr_type *pimpr = get_improvement_type(id);
        char buf[64000];
 
-       if (is_great_wonder(id)) {
+       if (is_great_wonder(id) == (manuals == MANUAL_BUILDINGS)) {
          continue;
        }
 
        helptext_building(buf, sizeof(buf), id, NULL);
-       fprintf(doc, "%s%s%s\n\n", SECTION_BEGIN, get_improvement_name(id),
-               SECTION_END);
-       fprintf(doc, "<table>\n");
-       fprintf(doc, _("<tr><td>Cost: <td>%d</tr>\n"), pimpr->build_cost);
-       fprintf(doc, _("<tr><td>Upkeep: <td>%d</tr>\n"), pimpr->upkeep);
+
+       fprintf(doc, "<tr>\n<td align=center>" IMAGE_BEGIN "%s" IMAGE_END
+                    "</td><td>%s</td><td 
align=center><b>%d</b><br/>%d</td>\n<td>",
+               pimpr->graphic_str, get_improvement_name(id),
+               pimpr->build_cost, pimpr->upkeep);
+
        requirement_vector_iterate(&pimpr->reqs, req) {
          char text[512];
-
-         if (req->source.type != REQ_NONE) {
-           fprintf(doc, _("<tr><td>Requires: <td>%s</tr>\n"),
-                   get_req_source_text(&req->source, text, sizeof(text)));
-         }
+         fprintf(doc, "%s<br/>",
+                 req->source.type != REQ_NONE ?
+                 get_req_source_text(&req->source, text, sizeof(text)) : 
_("None"));
        } requirement_vector_iterate_end;
-       if (tech_exists(pimpr->obsolete_by)) {
-         fprintf(doc, _("<tr><td>Obsoleted by: <td>%s</tr>\n"),
-                 advances[pimpr->obsolete_by].name);
-       }
-       fprintf(doc, "</table>\n\n");
-       fprintf(doc, "<pre>%s</pre>\n\n", buf);
-      } impr_type_iterate_end;
-      break;
 
-    case MANUAL_WONDERS:
-      fprintf(doc, _("<h1>Freeciv %s wonders help</h1>\n\n"), VERSION_STRING);
-      impr_type_iterate(id) {
-       struct impr_type *pimpr = get_improvement_type(id);
-       char buf[64000];
-
-       if (!is_great_wonder(id)) {
-         continue;
-       }
-
-       helptext_building(buf, sizeof(buf), id, NULL);
-       fprintf(doc, "%s%s%s\n\n", SECTION_BEGIN, get_improvement_name(id),
-               SECTION_END);
-       fprintf(doc, "<table>\n");
-       fprintf(doc, _("<tr><td>Cost: <td>%d</tr>\n"), pimpr->build_cost);
-       fprintf(doc, _("<tr><td>Upkeep: <td>%d</tr>\n"), pimpr->upkeep);
-       if (tech_exists(pimpr->obsolete_by)) {
-         fprintf(doc, _("<tr><td>Obsoleted by: <td>%s</tr>\n"),
-                 advances[pimpr->obsolete_by].name);
-       }
-       if (tech_exists(pimpr->obsolete_by)) {
-         fprintf(doc, _("<tr><td>Obsoleted by: <td>%s</tr>\n"),
-                 advances[pimpr->obsolete_by].name);
-       }
-       fprintf(doc, "</table>\n\n");
-       fprintf(doc, "<pre>%s</pre>\n\n", buf);
+       fprintf(doc, "<em>%s</em></td>\n",
+               tech_exists(pimpr->obsolete_by) ?
+               advances[pimpr->obsolete_by].name : _("None"));
+       fprintf(doc, "<td><pre>%s</pre></td>\n</tr>\n\n", buf);
       } impr_type_iterate_end;
       break;
 


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#15007) Improving civmanual, Guillaume Melquiond <=