<URL: http://bugs.freeciv.org/Ticket/Display.html?id=35961 >
On Thu, 22 Feb 2007 Daniel Markstedt wrote: > On 2/22/07, Egor Vyscrebentsov <evyscr@> wrote: > (...) > > > > PS [2Daniel? and others]: Maybe it would be nice to have more long > > nation legends, that will be accessible through in-game help? > > Indeed. Many legends have been improved recently, and more are on the way. > > Replying to this into a wishlist ticket I made for this very thing. It > should be quite trivial, programming-wise and I might give it a go > this weekend. Attached is a pre-version of patch. Legends are used as a help text. Only gui-xaw supported. Ah, and main "Nations" section requires a better text ;) Hope to make gui-gtk2 part at evenight. PS. Do we want to have "helptext" field in data/nation/*.ruleset ? -- Thanks, evyscr
Index: data/helpdata.txt =================================================================== --- data/helpdata.txt (revision 12711) +++ data/helpdata.txt (working copy) @@ -12,7 +12,7 @@ ; 'generate' = means replace this node with generated list of game ; elements; current categories are: ; "Units", "Improvements", "Wonders", "Techs", -; "Terrain", "Governments" +; "Terrain", "Governments", "Nations" ; ; Within the text, the help engine recognizes a few "generated table"s. ; These are generated by the help engine, and inserted at the point of @@ -1451,3 +1451,12 @@ that will arrive earlier. The only other option is to capture \ their capital.\ ") + +[help_nations] +name = _("Nations") +text = _("\ +Daniel, please, write something here ;)\ +") + +[help_gen_nations] +generate = "Nations" Index: client/gui-xaw/menu.c =================================================================== --- client/gui-xaw/menu.c (revision 12711) +++ client/gui-xaw/menu.c (working copy) @@ -246,6 +246,7 @@ { { N_("Government"), 0 }, "", MENU_HELP_GOVERNMENT, 0 }, { { N_("Happiness"), 0 }, "", MENU_HELP_HAPPINESS, 0 }, { { N_("Space Race"), 0 }, "", MENU_HELP_SPACE_RACE, 0 }, + { { N_("Nations"), 0 }, "", MENU_HELP_NATIONS, 0 }, { { 0 }, "", MENU_SEPARATOR_LINE, 0 }, { { N_("Copying"), 0 }, "", MENU_HELP_COPYING, 0 }, { { N_("About"), 0 }, "", MENU_HELP_ABOUT, 0 }, @@ -882,6 +883,9 @@ case MENU_HELP_SPACE_RACE: popup_help_dialog_string(HELP_SPACE_RACE_ITEM); break; + case MENU_HELP_NATIONS: + popup_help_dialog_string(HELP_NATIONS_ITEM); + break; case MENU_HELP_COPYING: popup_help_dialog_string(HELP_COPYING_ITEM); break; Index: client/gui-xaw/menu.h =================================================================== --- client/gui-xaw/menu.h (revision 12711) +++ client/gui-xaw/menu.h (working copy) @@ -129,6 +129,7 @@ MENU_HELP_GOVERNMENT, MENU_HELP_HAPPINESS, MENU_HELP_SPACE_RACE, + MENU_HELP_NATIONS, MENU_HELP_COPYING, MENU_HELP_ABOUT, Index: client/gui-xaw/helpdlg.c =================================================================== --- client/gui-xaw/helpdlg.c (revision 12711) +++ client/gui-xaw/helpdlg.c (working copy) @@ -1059,6 +1059,25 @@ XtVaSetValues(help_text, XtNstring, buf, NULL); } +/**************************************************************************** + ... +****************************************************************************/ +static void help_update_nation(const struct help_item *pitem, + char *title, + struct nation_type *pnation) +{ + char buf[4096]; + + if (!pnation) { + strcat(buf, pitem->text); + } else { + helptext_nation(buf, sizeof(buf), pnation, pitem->text); + } + create_help_page(HELP_TEXT); + set_title_topic(pitem); + XtVaSetValues(help_text, XtNstring, buf, NULL); +} + /************************************************************************** ... **************************************************************************/ @@ -1096,6 +1115,9 @@ case HELP_GOVERNMENT: help_update_government(pitem, top, find_government_by_name(top)); break; + case HELP_NATION: + help_update_nation(pitem, top, find_nation_by_name(top)); + break; case HELP_TEXT: default: /* it was a pure text item */ Index: client/include/helpdlg_g.h =================================================================== --- client/include/helpdlg_g.h (revision 12711) +++ client/include/helpdlg_g.h (working copy) @@ -15,7 +15,7 @@ enum help_page_type { HELP_ANY, HELP_TEXT, HELP_UNIT, HELP_IMPROVEMENT, HELP_WONDER, HELP_TECH, HELP_TERRAIN, - HELP_GOVERNMENT, HELP_LAST }; + HELP_GOVERNMENT, HELP_NATION, HELP_LAST }; void popup_help_dialog_string(const char *item); void popup_help_dialog_typed(const char *item, enum help_page_type); @@ -38,6 +38,7 @@ #define HELP_GOVERNMENT_ITEM "Government" #define HELP_HAPPINESS_ITEM "Happiness" #define HELP_SPACE_RACE_ITEM "Space Race" +#define HELP_NATIONS_ITEM "Nations" #define HELP_COPYING_ITEM "Copying" #define HELP_ABOUT_ITEM "About" Index: client/helpdata.c =================================================================== --- client/helpdata.c (revision 12711) +++ client/helpdata.c (working copy) @@ -45,7 +45,7 @@ static const char * const help_type_names[] = { "(Any)", "(Text)", "Units", "Improvements", "Wonders", - "Techs", "Terrain", "Governments", NULL + "Techs", "Terrain", "Governments", "Nations", NULL }; #define MAX_LAST (MAX(MAX(MAX(A_LAST,B_LAST),U_LAST),T_COUNT)) @@ -441,6 +441,14 @@ help_list_append(category_nodes, pitem); } } impr_type_iterate_end; + } else if (current_type == HELP_NATION) { + nations_iterate(pnation) { + pitem = new_help_item(current_type); + my_snprintf(name, sizeof(name), " %s", pnation->name); + pitem->topic = mystrdup(name); + pitem->text = mystrdup(""); + help_list_append(category_nodes, pitem); + } nations_iterate_end; } else { die("Bad current_type %d", current_type); } @@ -1505,3 +1513,16 @@ } return buf; } + +/**************************************************************************** + Returns nation legend +****************************************************************************/ +void helptext_nation(char *buf, size_t bufsz, struct nation_type *pnation, + const char *user_text) +{ + buf[0] = '\0'; + + if (pnation->legend[0] != '\0') { + sprintf(buf, "%s\n\n", _(pnation->legend)); + } +} Index: client/helpdata.h =================================================================== --- client/helpdata.h (revision 12711) +++ client/helpdata.h (working copy) @@ -48,6 +48,9 @@ void helptext_government(char *buf, size_t bufsz, struct government *gov, const char *user_text); +void helptext_nation(char *buf, size_t bufsz, struct nation_type *pnation, + const char *user_text); + char *helptext_unit_upkeep_str(struct unit_type *punittype); #define help_items_iterate(pitem) { \ Index: client/gui-xaw/helpdlg.c =================================================================== --- client/gui-xaw/helpdlg.c (revision 12711) +++ client/gui-xaw/helpdlg.c (working copy) @@ -1059,6 +1059,25 @@ XtVaSetValues(help_text, XtNstring, buf, NULL); } +/**************************************************************************** + This is currently just a text page, with special text +****************************************************************************/ +static void help_update_nation(const struct help_item *pitem, + char *title, + struct nation_type *pnation) +{ + char buf[4096]; + + if (!pnation) { + strcat(buf, pitem->text); + } else { + helptext_nation(buf, sizeof(buf), pnation, pitem->text); + } + create_help_page(HELP_TEXT); + set_title_topic(pitem); + XtVaSetValues(help_text, XtNstring, buf, NULL); +} + /************************************************************************** ... **************************************************************************/ @@ -1096,6 +1115,9 @@ case HELP_GOVERNMENT: help_update_government(pitem, top, find_government_by_name(top)); break; + case HELP_NATION: + help_update_nation(pitem, top, find_nation_by_name(top)); + break; case HELP_TEXT: default: /* it was a pure text item */
_______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev