[Freeciv-Dev] (PR#15007) Improving civmanual
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=15007 >
This second patch fixes the terrain part of civmanual. Instead of
three tables with some mistakes (no, mountains do not give x10
defense), there is only one table now. Yet it is clearer and it
contains even more data than before.
The patch also does some slight modifications to the buildings/wonders
part, in order to improve the visual quality in a wiki. In fact, I
have noticed that mediawiki deals quite well with a subset of html, so
there is no need to go to great lengths to teach civmanual the pipe
syntax of mediawiki. As an example, I have put some shortened versions
of the generated manual here:
http://www.freeciv.org/index.php/User:Silene
--- manual/civmanual.c-1 2005-12-28 09:53:58.000000000 +0100
+++ manual/civmanual.c 2005-12-28 16:08:23.000000000 +0100
@@ -218,85 +218,68 @@
case MANUAL_TERRAIN:
fprintf(doc, _("<h1>Freeciv %s terrain help</h1>\n\n"),
VERSION_STRING);
- fprintf(doc, _("<table border=1><tr><th>Terrain</th>"));
- fprintf(doc, _("<th>Food/ Shield/ Trade</th>"));
- fprintf(doc, _("<th>Resources</th>"));
- fprintf(doc, _("<th>Move cost</th><th>Defense</th><th>Road "
- "+trade</th>\n"));
- fprintf(doc, _("<th>Irrigation +food</th><th>Mining +shields</th>\n"));
- fprintf(doc, _("<th>Transform to</th>"));
- fprintf(doc, "</tr>\n");
+ fprintf(doc, "<table><tr bgcolor=#9bc3d1><th colspan=2>%s</th>",
_("Terrain"));
+ fprintf(doc, "<th>F/P/T</th><th>%s</th>", _("Resources"));
+ fprintf(doc, "<th>%s<br/>%s</th>", _("Move cost"), _("Defense bonus"));
+ fprintf(doc, "<th>%s<br/>%s<br/>%s<br/>%s<br/>(%s)</th>",
+ _("Irrigation"), _("Mining"), _("Road"), _("Transform"),
_("turns"));
+ fprintf(doc, "<th>%s<br/>%s<br/>%s<br/>%s<br/>%s</th></tr>\n\n",
+ _("Airbase"), _("Fortress"), _("Rail"),
+ _("Clean pollution"), _("Clean fallout"));
terrain_type_iterate(pterrain) {
const struct resource **r;
- if (pterrain->defense_bonus == 0) {
+ if (pterrain->name[0] == '\0') {
/* Must be a disabled piece of terrain */
continue;
}
- fprintf(doc, "<tr><td>%s%s%s %s</td>", IMAGE_BEGIN,
- pterrain->graphic_str,
- IMAGE_END, get_name(pterrain));
- fprintf(doc, "<td>%d / %d / %d</td>",
+ fprintf(doc, "<tr><td>" IMAGE_BEGIN "%s" IMAGE_END "</td><td>%s</td>",
+ pterrain->graphic_str, get_name(pterrain));
+ fprintf(doc, "<td>%d/%d/%d</td>\n",
pterrain->output[O_FOOD], pterrain->output[O_SHIELD],
pterrain->output[O_TRADE]);
- fprintf (doc, "<td>");
+ fprintf(doc, "<td><table width=\"100%%\">\n");
for (r = pterrain->resources; *r; r++) {
- fprintf (doc, "%s%s%s %s", IMAGE_BEGIN,
- (*r)->graphic_str, IMAGE_END, (*r)->name);
+ fprintf(doc, "<tr><td>" IMAGE_BEGIN "%s" IMAGE_END "</td><td>%s</td>"
+ "<td align=\"right\">%d/%d/%d</td></tr>\n",
+ (*r)->graphic_str, (*r)->name, (*r)->output[O_FOOD],
+ (*r)->output[O_SHIELD], (*r)->output[O_TRADE]);
}
- fprintf (doc, "</td>");
+ fprintf(doc, "</table></td>\n");
- fprintf(doc, "<td>%d</td>\n", pterrain->movement_cost);
- fprintf(doc, "<td>%d0%%</td><td>%d</td><td>%d</td><td>%d</td>\n",
- pterrain->defense_bonus, pterrain->road_trade_incr,
- pterrain->irrigation_food_incr, pterrain->mining_shield_incr);
- fprintf(doc, "<td>%s</td></tr>\n\n",
- get_name(pterrain->transform_result));
- } terrain_type_iterate_end;
- fprintf(doc, _("</table><br><br><br><table border=1>"));
- fprintf(doc, _("<caption>Time to perform action</caption>"));
- fprintf(doc, _("<tr><th>Terrain</th>\n"));
- fprintf(doc, _("<th>Road</th><th>Irrigation</th>\n"));
- fprintf(doc, _("<th>Mining</th><th>Rail</th>\n"));
- fprintf(doc, _("<th>Airbase</th><th>Fortress</th>\n"));
- fprintf(doc, _("<th>Clean pollution</th><th>Clean fallout</th>\n"));
- fprintf(doc, _("<th>Transform</th></tr>\n"));
- terrain_type_iterate(pterrain) {
- const char *name = get_name(pterrain);
+ fprintf(doc, "<td align=\"center\">%d<br/>+%d%%</td>\n",
+ pterrain->movement_cost, pterrain->defense_bonus);
- if (pterrain->name[0] == '\0') {
- /* Must be a disabled piece of terrain */
- continue;
+ fprintf(doc, "<td><table width=\"100%%\">\n");
+ if (pterrain->irrigation_result == pterrain) {
+ fprintf(doc, "<tr><td>+%d F</td><td align=\"right\">(%d)</td></tr>\n",
+ pterrain->irrigation_food_incr, pterrain->irrigation_time);
+ } else if (pterrain->irrigation_result == T_NONE) {
+ fprintf(doc, "<tr><td>%s</td></tr>\n", _("impossible"));
+ } else {
+ fprintf(doc, "<tr><td>%s</td><td align=\"right\">(%d)</td></tr>\n",
+ get_name(pterrain->irrigation_result),
pterrain->irrigation_time);
}
-
- fprintf(doc, "<tr><td>%s%s%s %s</td><td>%d</td>\n",
- IMAGE_BEGIN, pterrain->graphic_str, IMAGE_END, name,
- pterrain->road_time);
- fprintf(doc, "<td>%d</td><td>%d</td><td>%d</td><td>%d</td>\n",
- pterrain->irrigation_time, pterrain->mining_time,
- pterrain->rail_time, pterrain->airbase_time);
- fprintf(doc, "<td>%d</td><td>%d</td><td>%d</td><td>%d</td>\n",
- pterrain->fortress_time, pterrain->clean_pollution_time,
- pterrain->clean_fallout_time, pterrain->transform_time);
- fprintf(doc, "</tr>\n\n");
+ if (pterrain->mining_result == pterrain) {
+ fprintf(doc, "<tr><td>+%d P</td><td align=\"right\">(%d)</td></tr>\n",
+ pterrain->mining_shield_incr, pterrain->mining_time);
+ } else if (pterrain->mining_result == T_NONE) {
+ fprintf(doc, "<tr><td>%s</td></tr>\n", _("impossible"));
+ } else {
+ fprintf(doc, "<tr><td>%s</td><td align=\"right\">(%d)</td></tr>\n",
+ get_name(pterrain->mining_result), pterrain->mining_time);
+ }
+ fprintf(doc, "<tr><td>+%d T</td><td align=\"right\">(%d)</td></tr>\n",
+ pterrain->road_trade_incr, pterrain->road_time);
+ fprintf(doc, "<tr><td>%s</td><td
align=\"right\">(%d)</td></tr>\n</table></td>\n",
+ get_name(pterrain->transform_result), pterrain->transform_time);
+
+ fprintf(doc, "<td align=\"center\">%d / %d / %d / %d /
%d</td></tr>\n\n",
+ pterrain->airbase_time, pterrain->fortress_time,
pterrain->rail_time,
+ pterrain->clean_pollution_time, pterrain->clean_fallout_time);
} terrain_type_iterate_end;
-
- fprintf(doc, "</table>\n");
-
- fprintf(doc, _("<table border=1><tr><th>Resource</th>"));
- fprintf(doc, _("<th>Food/ Shield/ Trade</th>"));
-
- resource_type_iterate (presource) {
- fprintf(doc, "<tr><td>%s%s%s %s</td>", IMAGE_BEGIN,
- presource->graphic_str, IMAGE_END, presource->name);
- fprintf(doc, "<td>%d / %d / %d</td>",
- presource->output[O_FOOD], presource->output[O_SHIELD],
- presource->output[O_TRADE]);
- fprintf(doc, "</tr>");
- } resource_type_iterate_end;
-
fprintf(doc, "</table>\n");
break;
@@ -309,9 +292,9 @@
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>"
+ fprintf(doc, "<table>\n<tr bgcolor=#9bc3d1><th colspan=2>%s</th>"
"<th>%s<br/>%s</th><th>%s<br/>%s</th><th>%s</th></tr>\n\n",
- _("Graphics"), _("Name"), _("Cost"), _("Upkeep"),
+ _("Name"), _("Cost"), _("Upkeep"),
_("Requirement"), _("Obsolete by"), _("More info"));
impr_type_iterate(id) {
@@ -324,8 +307,8 @@
helptext_building(buf, sizeof(buf), id, NULL);
- 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>",
+ fprintf(doc, "<tr><td>" IMAGE_BEGIN "%s" IMAGE_END "</td><td>%s</td>\n"
+ "<td align=\"center\"><b>%d</b><br/>%d</td>\n<td>",
pimpr->graphic_str, get_improvement_name(id),
pimpr->build_cost, pimpr->upkeep);
@@ -339,7 +322,7 @@
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);
+ fprintf(doc, "<td>%s</td>\n</tr>\n\n", buf);
} impr_type_iterate_end;
break;
|
|