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

On Fri, 7 Sep 2007 Marko Lindqvist wrote:

> On 07/09/07, Egor Vyscrebentsov  wrote:
> >
> > On Thu, 6 Sep 2007 Marko Lindqvist wrote:
> >
> > > On 06/09/07, Egor Vyscrebentsov  wrote:
> > >
> > > > Double "\n\n" at the end of every req line looks not good though.
> > > > I suggest to remove one. (At trunk, at least.)
> > >
> > >  At trunk: definitely. Not sure about S2_1.
> >
> > 9 lines change. I think that they look too not good to be kept.
>
>  They are problem only when there are multiple requirements, which is
> rare situation. But yes, we have to touch many help dialog strings
> before we can release 2.1.0, so translators need to check them anyway.

So done for S2_1.

> > >  Should add one after whole requirement block (unless it is empty).
> > >
> > > > _This_ patch is ready for inclusion into S2_1, however.
> > >
> > >  We have to decide what to do with that outcommented block. Either we
> > > use it, or we remove it (in which case that meaningless has_req
> > > variable must go also).
> >
> > Sure. I prefer first variant.
>
>  Ok, will you update the patch?

Attached. Removed second "\n" symbols, used "Requires: Nothing" when
no reqs found.

PS. Surprisingly, I don't see requirements for governments to be shown
(at least in gtk client...) Investigating.

-- 
Thanks, evyscr

Index: client/helpdata.c
===================================================================
--- client/helpdata.c	(revision 13508)
+++ client/helpdata.c	(working copy)
@@ -163,51 +163,51 @@
   case REQ_LAST:
     break;
   case REQ_TECH:
-    cat_snprintf(buf, bufsz, _("Requires the %s technology.\n\n"),
+    cat_snprintf(buf, bufsz, _("Requires the %s technology.\n"),
 		 advance_name_for_player(game.player_ptr, req->source.value.tech));
     return;
   case REQ_GOV:
-    cat_snprintf(buf, bufsz, _("Requires the %s government.\n\n"),
+    cat_snprintf(buf, bufsz, _("Requires the %s government.\n"),
 		 government_name_translation(req->source.value.gov));
     return;
   case REQ_BUILDING:
-    cat_snprintf(buf, bufsz, _("Requires the %s building.\n\n"),
+    cat_snprintf(buf, bufsz, _("Requires the %s building.\n"),
 		 improvement_name_translation(req->source.value.building));
     return;
   case REQ_SPECIAL:
-    cat_snprintf(buf, bufsz, _("Requires the %s terrain special.\n\n"),
+    cat_snprintf(buf, bufsz, _("Requires the %s terrain special.\n"),
 		 special_name_translation(req->source.value.special));
     return;
   case REQ_TERRAIN:
-    cat_snprintf(buf, bufsz, _("Requires the %s terrain.\n\n"),
+    cat_snprintf(buf, bufsz, _("Requires the %s terrain.\n"),
 		 terrain_name_translation(req->source.value.terrain));
     return;
   case REQ_NATION:
-    cat_snprintf(buf, bufsz, _("Requires the %s nation.\n\n"),
+    cat_snprintf(buf, bufsz, _("Requires the %s nation.\n"),
 		 nation_name_translation(req->source.value.nation));
     return;
   case REQ_UNITTYPE:
-    cat_snprintf(buf, bufsz, _("Only applies to %s units.\n\n"),
+    cat_snprintf(buf, bufsz, _("Only applies to %s units.\n"),
 		 utype_name_translation(req->source.value.unittype));
     return;
   case REQ_UNITFLAG:
-    cat_snprintf(buf, bufsz, _("Only applies to %s units.\n\n"),
+    cat_snprintf(buf, bufsz, _("Only applies to %s units.\n"),
                 unit_flag_rule_name(req->source.value.unitflag));
     return;
   case REQ_UNITCLASS:
-    cat_snprintf(buf, bufsz, _("Only applies to %s units.\n\n"),
+    cat_snprintf(buf, bufsz, _("Only applies to %s units.\n"),
 		 uclass_name_translation(req->source.value.unitclass));
     return;
   case REQ_OUTPUTTYPE:
-    cat_snprintf(buf, bufsz, _("Applies only to %s.\n\n"),
+    cat_snprintf(buf, bufsz, _("Applies only to %s.\n"),
 		 get_output_name(req->source.value.outputtype));
     return;
   case REQ_SPECIALIST:
-    cat_snprintf(buf, bufsz, _("Applies only to %s.\n\n"),
+    cat_snprintf(buf, bufsz, _("Applies only to %s.\n"),
 		 _(get_specialist(req->source.value.specialist)->name));
     return;
   case REQ_MINSIZE:
-    cat_snprintf(buf, bufsz, _("Requires a minimum size of %d.\n\n"),
+    cat_snprintf(buf, bufsz, _("Requires a minimum size of %d.\n"),
 		 req->source.value.minsize);
     return;
   }
@@ -645,6 +645,7 @@
     .type = REQ_BUILDING,
     .value = {.building = which}
   };
+  bool has_req = FALSE;
 
   assert(buf);
   buf[0] = '\0';
@@ -655,11 +656,22 @@
   }
 
   imp = improvement_by_number(which);
-  
+
   if (imp->helptext && imp->helptext[0] != '\0') {
     cat_snprintf(buf, bufsz, "%s\n\n", _(imp->helptext));
   }
 
+  requirement_vector_iterate(&imp->reqs, preq) {
+    insert_requirement(preq, buf, bufsz);
+    has_req = TRUE;
+  } requirement_vector_iterate_end;
+
+  if (has_req) {
+    cat_snprintf(buf, bufsz, "\n");
+  } else {
+    cat_snprintf(buf, bufsz, _("Requires: Nothing\n\n"));
+  }
+
   if (tech_exists(improvement_by_number(which)->obsolete_by)) {
     cat_snprintf(buf, bufsz,
 		 _("* The discovery of %s will make %s obsolete.\n"),
@@ -1264,6 +1276,7 @@
     .type = REQ_GOV,
     .value = {.gov = gov }
   };
+  bool has_req = FALSE;
 
   buf[0] = '\0';
 
@@ -1274,8 +1287,13 @@
   /* Add requirement text for government itself */
   requirement_vector_iterate(&gov->reqs, preq) {
     insert_requirement(preq, buf, bufsz);
+    has_req = TRUE;
   } requirement_vector_iterate_end;
 
+  if (has_req) {
+    cat_snprintf(buf, bufsz, "\n");
+  }
+
   /* Effects */
   sprintf(buf + strlen(buf), _("Features:\n"));
   insert_allows(&source, buf, bufsz);
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to