<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40505 >
Thanks for bringing this to attention. The government help text buffer was being truncated by a bug that was introduced in revision 14233 (tickets 40012, 40013)[1]. The attached patch is a minimal fix for the problem, and also fixes the misleading comment header for the function insert_allows (which I guess may have contributed to the original bug). It would be wonderful if someone could clean up the help text code to remove static buffers, macros and general inefficiencies, and make it more translator friendly (i.e. no stitching together of sentence fragements), but I will not cry [much] if it does not happen any time soon. (For bored freeciv-dev lurkers only:) [1] For a nice WTF compare the patches (du2.14230, du2.14228) in the aforementioned tickets to the actual changes in r14233 http://svn.gna.org/viewcvs/freeciv?view=rev&rev=14233 with respect to client/helpdata.c; search string "insert_allows". ----------------------------------------------------------------------- 怒った群集は死刑を要求した。
diff --git a/client/helpdata.c b/client/helpdata.c index 1b089a8..84a70a1 100644 --- a/client/helpdata.c +++ b/client/helpdata.c @@ -218,7 +218,7 @@ static void insert_requirement(struct requirement *req, } /**************************************************************************** - Append text for what this requirement source allows. Something like + Generate text for what this requirement source allows. Something like "Allows Communism government (with University technology).\n\n" "Allows Mfg. Plant building (with Factory building).\n\n" @@ -226,6 +226,10 @@ static void insert_requirement(struct requirement *req, This should be called to generate helptext for every possible source type. Note this doesn't handle effects but rather production requirements (currently only building reqs). + + NB: This function overwrites any existing buffer contents by writing the + generated text to the start of the given 'buf' pointer (i.e. it does + NOT append like cat_snprintf). ****************************************************************************/ static void insert_allows(struct req_source *psource, char *buf, size_t bufsz) @@ -1301,7 +1305,7 @@ void helptext_government(char *buf, size_t bufsz, struct government *gov, /* Effects */ CATLSTR(buf, bufsz, _("Features:\n")); - insert_allows(&source, buf, bufsz); + insert_allows(&source, buf + strlen(buf), bufsz - strlen(buf)); effect_list_iterate(get_req_source_effects(&source), peffect) { Output_type_id output_type = O_LAST; struct unit_class *unitclass = NULL;
_______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev