diff --git a/client/gui-qt/helpdlg.cpp b/client/gui-qt/helpdlg.cpp index bf5c7f090c..96744471e2 100644 --- a/client/gui-qt/helpdlg.cpp +++ b/client/gui-qt/helpdlg.cpp @@ -813,6 +813,7 @@ void help_widget::set_topic(const help_item *topic) case HELP_RULESET: case HELP_TILESET: case HELP_MUSICSET: + case HELP_CITIES: case HELP_TEXT: set_topic_other(topic, title); break; diff --git a/client/helpdata.c b/client/helpdata.c index 38cd7a7b96..769e06afb7 100644 --- a/client/helpdata.c +++ b/client/helpdata.c @@ -70,7 +70,7 @@ /* This must be in same order as enum in helpdlg_g.h */ static const char * const help_type_names[] = { "(Any)", "(Text)", "Units", "Improvements", "Wonders", - "Techs", "Terrain", "Extras", "Goods", "Specialists", "Governments", + "Techs", "Terrain", "Extras", "Goods", "Cities", "Specialists", "Governments", "Ruleset", "Tileset", "Musicset", "Nations", "Multipliers", "Counters", NULL }; @@ -722,13 +722,13 @@ void boot_help_texts(void) check_help_nodes_init(); - /* need to do something like this or bad things happen */ + /* Need to do something like this or bad things happen */ popdown_help_dialog(); if (!booted) { log_verbose("Booting help texts"); } else { - /* free memory allocated last time booted */ + /* Free memory allocated last time booted */ free_help_texts(); log_verbose("Rebooting help texts"); } @@ -738,9 +738,9 @@ void boot_help_texts(void) log_error("Did not read help texts"); return; } - /* after following call filename may be clobbered; use sf->filename instead */ + /* After following call filename may be clobbered; use sf->filename instead */ if (!(sf = secfile_load(filename, FALSE))) { - /* this is now unlikely to happen */ + /* This is now unlikely to happen */ log_error("failed reading help-texts from '%s':\n%s", filename, secfile_error()); return; @@ -780,7 +780,7 @@ void boot_help_texts(void) (void) secfile_lookup_str_vec(sf, &ncats, "%s.categories", sec_name); } - continue; /* on initial boot data tables are empty */ + continue; /* On initial boot data tables are empty */ } { @@ -869,6 +869,24 @@ void boot_help_texts(void) help_list_append(category_nodes, pitem); } goods_type_iterate_end; break; + case HELP_CITIES: + { + char buf[16000]; + const char *sep = ""; + + pitem = new_help_item(HELP_CITIES); + fc_snprintf(name, sizeof(name), "%*s%s", level, "", + Q_(HELP_CITIES_ITEM)); + pitem->topic = fc_strdup(name); + strvec_iterate(game.cities_helptext, text) { + cat_snprintf(buf, sizeof(buf), sep, text); + sep = "\n\n"; + } strvec_iterate_end; + pitem->text = fc_strdup(buf); + + help_list_append(help_nodes, pitem); + } + break; case HELP_SPECIALIST: specialist_type_iterate(sp) { struct specialist *pspec = specialist_by_number(sp); diff --git a/client/include/helpdlg_g.h b/client/include/helpdlg_g.h index b90f847e61..3a5e8f234d 100644 --- a/client/include/helpdlg_g.h +++ b/client/include/helpdlg_g.h @@ -19,10 +19,10 @@ * Update also help_type_by_requirement() when adding new types. */ enum help_page_type { HELP_ANY, HELP_TEXT, HELP_UNIT, HELP_IMPROVEMENT, HELP_WONDER, HELP_TECH, HELP_TERRAIN, HELP_EXTRA, - HELP_GOODS, HELP_SPECIALIST, HELP_GOVERNMENT, - HELP_RULESET, HELP_TILESET, HELP_MUSICSET, - HELP_NATIONS, HELP_MULTIPLIER, HELP_COUNTER, - HELP_LAST }; + HELP_GOODS, HELP_CITIES, HELP_SPECIALIST, + HELP_GOVERNMENT, HELP_RULESET, HELP_TILESET, + HELP_MUSICSET, HELP_NATIONS, HELP_MULTIPLIER, + HELP_COUNTER, HELP_LAST }; GUI_FUNC_PROTO(void, popup_help_dialog_string, const char *item) GUI_FUNC_PROTO(void, popup_help_dialog_typed, const char *item, @@ -50,6 +50,7 @@ GUI_FUNC_PROTO(void, popdown_help_dialog, void) #define HELP_ZOC_ITEM N_("Zones of Control") #define HELP_TECHS_ITEM N_("Technology") #define HELP_EXTRAS_ITEM N_("Extras") +#define HELP_CITIES_ITEM N_("Cities") #define HELP_TERRAIN_ITEM N_("Terrain") #define HELP_WONDERS_ITEM N_("Wonders of the World") #define HELP_GOVERNMENT_ITEM N_("Government") diff --git a/client/packhand.c b/client/packhand.c index 499a722ba2..92a1052132 100644 --- a/client/packhand.c +++ b/client/packhand.c @@ -4885,6 +4885,8 @@ void handle_ruleset_game(const struct packet_ruleset_game *packet) packet->background_green, packet->background_blue); + PACKET_STRVEC_EXTRACT(game.cities_helptext, packet->cities_helptext); + tileset_background_init(tileset); } diff --git a/common/game.c b/common/game.c index 47de54edca..990495b00d 100644 --- a/common/game.c +++ b/common/game.c @@ -335,6 +335,7 @@ static void game_defaults(bool keep_ruleset_value) game.plr_bg_color = NULL; game.lua_timeout = GAME_DEFAULT_LUA_TIMEOUT; + game.cities_helptext = NULL; if (is_server()) { /* All settings only used by the server (./server/ and ./ai/ */ @@ -484,6 +485,11 @@ void game_free(void) game_ruleset_free(); researches_free(); cm_free(); + + if (game.cities_helptext != NULL) { + strvec_destroy(game.cities_helptext); + game.cities_helptext = NULL; + } } /**********************************************************************//** diff --git a/common/game.h b/common/game.h index 25e54edb92..9670b58a1f 100644 --- a/common/game.h +++ b/common/game.h @@ -104,6 +104,8 @@ struct civ_game { int lua_timeout; + struct strvec *cities_helptext; + struct { /* Items given to all players at game start. * Client gets this info for help purposes only. */ diff --git a/common/networking/packets.def b/common/networking/packets.def index 76d638cf65..6c34f5ac73 100644 --- a/common/networking/packets.def +++ b/common/networking/packets.def @@ -1500,6 +1500,8 @@ PACKET_RULESET_GAME = 141; sc, lsend UINT8 background_red; UINT8 background_green; UINT8 background_blue; + + STRVEC cities_helptext; end PACKET_RULESET_SPECIALIST = 142; sc, lsend diff --git a/data/civ2civ3/terrain.ruleset b/data/civ2civ3/terrain.ruleset index bad727ccb7..25a3f3335e 100644 --- a/data/civ2civ3/terrain.ruleset +++ b/data/civ2civ3/terrain.ruleset @@ -1127,6 +1127,104 @@ ui_name_base_fortress = _("?gui_type:Build Fort/Fortress/Buoy") ; ui_name_base_airbase refers to all bases that have gui_type "Airbase" ui_name_base_airbase = _("?gui_type:Build Airstrip/Airbase") +cities_helptext = _("\ +Cities are your sole instrument for developing natural resources and \ +channeling them toward expansion, technological progress, and warfare.\ +"), _("\ +A city is created when Settlers are given the \"build city\" command \ +on suitable terrain, removing the unit from play to provide the city \ +with its first citizens. A city may grow to include dozens of citizens, \ +some working within the city while others are dispatched as new \ +settlers. Famine, war, and plague kill citizens and reduce population; \ +with the loss of its last citizen a city disappears (in the classic \ +ruleset, this can leave ruins, although these have no effect on \ +gameplay).\ +"), _("\ +While city growth should usually be your aim, it comes with challenges. \ +As cities grow, managing happiness becomes a problem; this is described \ +in its own section. Depending on the ruleset, pollution (described in \ +the Terrain help), plague, and migration can also be issues.\ +"), _("\ +Each city may work the terrain within its reach. In the classic ruleset, \ +this is a fixed radius of approximately three tiles, giving access to \ +20 tiles on rectangular maps, or 18 tiles on hexagonal ones, in addition \ +to the city center tile. In other rulesets it may be different, and may \ +vary depending on factors such as the size of the city and known \ +technologies.\ +"), _("\ +To extract resources from a tile, you must have a citizen working \ +there. You cannot begin working a tile which a neighboring \ +city is already working, nor can you work terrain upon which an enemy \ +unit is standing, or terrain inside another player's borders. Thus you \ +can simulate conditions of siege by stationing your units atop \ +valuable resources around an enemy city. Units can also be ordered to \ +pillage, which damages improvements. Worker units could even transform \ +the terrain to make the tile less productive.\ +"), _("\ +The section on Terrain describes how the output of each tile is \ +affected by the terrain, the presence of special resources such as \ +game or minerals, and tile improvements built by units. Note that the \ +tile on which the city itself rests -- the city center -- gets worked \ +for free, without being assigned a citizen. The city's tile may also \ +receive other benefits. In the classic ruleset, it always produces at \ +least one food and one production point regardless of terrain; gains \ +whatever advantages the terrain offers with an irrigation system \ +(because cities come with water systems built-in); and is usually \ +developed with roads. Other rulesets may differ in detail.\ +"), _("\ +The roles of citizens are controlled from the City dialog. Citizens \ +working the land are represented by three numbers showing their output \ +on the tile they are working. Clicking on these numbers will remove \ +the citizen from the tile, turning them into a specialist (see the \ +section on Specialists for more details); this can be seen in the \ +row of citizen icons. You can click another tile to assign the citizen \ +to work it, or click on the specialist icon to change their specialist \ +role.\ +"), _("\ +Clicking on the city center tile in the city map will automatically \ +choose citizen roles and tiles to work, with an emphasis on food \ +production and hence growth. Citizen roles are also automatically \ +assigned when a city grows; you may want to inspect cities that have \ +just grown and adjust the role in which the new citizen has been \ +placed. You can set different priorities for a city with the Citizen \ +Governor; see its help section.\ +"), _("\ +You can also request tile alterations from the city map, as an \ +alternative to explicitly instructing units to make them. In clients \ +which support it, right-clicking on a city map tile gives a menu of \ +changes which can be made to that tile, such as irrigation and \ +building roads (see the section on Terrain Alterations); you can \ +select one improvement per tile at a time. These 'worker tasks' will \ +be carried out by any units capable of them that are in 'auto settler' \ +mode.\ +"), _("\ +Citizens have a nationality distinct from that of the state they \ +inhabit. When a city grows due to food surplus, new citizens take \ +the nationality of the city's current owner, but when a city is \ +conquered or otherwise transferred, its citizens retain their \ +original nationality, as do any immigrants. Units founding or \ +contributing citizens to a city can also bring their own nationality.\ +"), _("\ +Citizens of another nationality will work in your cities just the same \ +as your own, and behave the same in most respects, but they may become \ +unhappy when you are at war with their associated state; their presence \ +makes it cheaper for their state's agents to incite revolt in your \ +cities; and if migration is enabled, they have an increased tendency to \ +migrate to their state's cities. Over time, citizens may be assimilated \ +into their home city, depending on ruleset settings.\ +"), _("\ +Some rulesets do not have nationality; in this case, citizens always \ +consider their nationality to be that of their home city. \ +If nationality is enabled, you can see the cultural makeup of your \ +cities and any consequent effects on happiness in the City dialog, \ +on the Happiness tab.\ +"), _("\ +Cities may be enhanced with a wide variety of buildings, which can \ +improve their productivity, their military strength, or give them \ +new abilities. See the sections on City Improvements and Wonders of \ +the World for more information.\ +") + ; /* <-- avoid gettext warnings ; ; Each extra, including bases and roads, must have a section here. diff --git a/data/classic/terrain.ruleset b/data/classic/terrain.ruleset index f1d77d61b5..b8613d6a2d 100644 --- a/data/classic/terrain.ruleset +++ b/data/classic/terrain.ruleset @@ -1106,6 +1106,104 @@ ui_name_base_fortress = _("?gui_type:Build Fortress/Buoy") ; ui_name_base_airbase refers to all bases that have gui_type "Airbase" ui_name_base_airbase = _("?gui_type:Build Airbase") +cities_helptext = _("\ +Cities are your sole instrument for developing natural resources and \ +channeling them toward expansion, technological progress, and warfare.\ +"), _("\ +A city is created when Settlers are given the \"build city\" command \ +on suitable terrain, removing the unit from play to provide the city \ +with its first citizens. A city may grow to include dozens of citizens, \ +some working within the city while others are dispatched as new \ +settlers. Famine, war, and plague kill citizens and reduce population; \ +with the loss of its last citizen a city disappears (in the classic \ +ruleset, this can leave ruins, although these have no effect on \ +gameplay).\ +"), _("\ +While city growth should usually be your aim, it comes with challenges. \ +As cities grow, managing happiness becomes a problem; this is described \ +in its own section. Depending on the ruleset, pollution (described in \ +the Terrain help), plague, and migration can also be issues.\ +"), _("\ +Each city may work the terrain within its reach. In the classic ruleset, \ +this is a fixed radius of approximately three tiles, giving access to \ +20 tiles on rectangular maps, or 18 tiles on hexagonal ones, in addition \ +to the city center tile. In other rulesets it may be different, and may \ +vary depending on factors such as the size of the city and known \ +technologies.\ +"), _("\ +To extract resources from a tile, you must have a citizen working \ +there. You cannot begin working a tile which a neighboring \ +city is already working, nor can you work terrain upon which an enemy \ +unit is standing, or terrain inside another player's borders. Thus you \ +can simulate conditions of siege by stationing your units atop \ +valuable resources around an enemy city. Units can also be ordered to \ +pillage, which damages improvements. Worker units could even transform \ +the terrain to make the tile less productive.\ +"), _("\ +The section on Terrain describes how the output of each tile is \ +affected by the terrain, the presence of special resources such as \ +game or minerals, and tile improvements built by units. Note that the \ +tile on which the city itself rests -- the city center -- gets worked \ +for free, without being assigned a citizen. The city's tile may also \ +receive other benefits. In the classic ruleset, it always produces at \ +least one food and one production point regardless of terrain; gains \ +whatever advantages the terrain offers with an irrigation system \ +(because cities come with water systems built-in); and is usually \ +developed with roads. Other rulesets may differ in detail.\ +"), _("\ +The roles of citizens are controlled from the City dialog. Citizens \ +working the land are represented by three numbers showing their output \ +on the tile they are working. Clicking on these numbers will remove \ +the citizen from the tile, turning them into a specialist (see the \ +section on Specialists for more details); this can be seen in the \ +row of citizen icons. You can click another tile to assign the citizen \ +to work it, or click on the specialist icon to change their specialist \ +role.\ +"), _("\ +Clicking on the city center tile in the city map will automatically \ +choose citizen roles and tiles to work, with an emphasis on food \ +production and hence growth. Citizen roles are also automatically \ +assigned when a city grows; you may want to inspect cities that have \ +just grown and adjust the role in which the new citizen has been \ +placed. You can set different priorities for a city with the Citizen \ +Governor; see its help section.\ +"), _("\ +You can also request tile alterations from the city map, as an \ +alternative to explicitly instructing units to make them. In clients \ +which support it, right-clicking on a city map tile gives a menu of \ +changes which can be made to that tile, such as irrigation and \ +building roads (see the section on Terrain Alterations); you can \ +select one improvement per tile at a time. These 'worker tasks' will \ +be carried out by any units capable of them that are in 'auto settler' \ +mode.\ +"), _("\ +Citizens have a nationality distinct from that of the state they \ +inhabit. When a city grows due to food surplus, new citizens take \ +the nationality of the city's current owner, but when a city is \ +conquered or otherwise transferred, its citizens retain their \ +original nationality, as do any immigrants. Units founding or \ +contributing citizens to a city can also bring their own nationality.\ +"), _("\ +Citizens of another nationality will work in your cities just the same \ +as your own, and behave the same in most respects, but they may become \ +unhappy when you are at war with their associated state; their presence \ +makes it cheaper for their state's agents to incite revolt in your \ +cities; and if migration is enabled, they have an increased tendency to \ +migrate to their state's cities. Over time, citizens may be assimilated \ +into their home city, depending on ruleset settings.\ +"), _("\ +Some rulesets do not have nationality; in this case, citizens always \ +consider their nationality to be that of their home city. \ +If nationality is enabled, you can see the cultural makeup of your \ +cities and any consequent effects on happiness in the City dialog, \ +on the Happiness tab.\ +"), _("\ +Cities may be enhanced with a wide variety of buildings, which can \ +improve their productivity, their military strength, or give them \ +new abilities. See the sections on City Improvements and Wonders of \ +the World for more information.\ +") + ; /* <-- avoid gettext warnings ; ; Each extra, including bases, roads, and resource, must have a section here. diff --git a/data/helpdata.txt b/data/helpdata.txt index 909809632a..0ae053bd1c 100644 --- a/data/helpdata.txt +++ b/data/helpdata.txt @@ -655,105 +655,8 @@ Goods are carried via trade routes.\ [help_gen_goods] generate = " Goods" -[help_cities] -name = _("Cities") -text = _("\ -Cities are your sole instrument for developing natural resources and \ -channeling them toward expansion, technological progress, and warfare.\ -"), _("\ -A city is created when Settlers are given the \"build city\" command \ -on suitable terrain, removing the unit from play to provide the city \ -with its first citizens. A city may grow to include dozens of citizens, \ -some working within the city while others are dispatched as new \ -settlers. Famine, war, and plague kill citizens and reduce population; \ -with the loss of its last citizen a city disappears (in the classic \ -ruleset, this can leave ruins, although these have no effect on \ -gameplay).\ -"), _("\ -While city growth should usually be your aim, it comes with challenges. \ -As cities grow, managing happiness becomes a problem; this is described \ -in its own section. Depending on the ruleset, pollution (described in \ -the Terrain help), plague, and migration can also be issues.\ -"), _("\ -Each city may work the terrain within its reach. In the classic ruleset, \ -this is a fixed radius of approximately three tiles, giving access to \ -20 tiles on rectangular maps, or 18 tiles on hexagonal ones, in addition \ -to the city center tile. In other rulesets it may be different, and may \ -vary depending on factors such as the size of the city and known \ -technologies.\ -"), _("\ -To extract resources from a tile, you must have a citizen working \ -there. You cannot begin working a tile which a neighboring \ -city is already working, nor can you work terrain upon which an enemy \ -unit is standing, or terrain inside another player's borders. Thus you \ -can simulate conditions of siege by stationing your units atop \ -valuable resources around an enemy city. Units can also be ordered to \ -pillage, which damages improvements. Worker units could even transform \ -the terrain to make the tile less productive.\ -"), _("\ -The section on Terrain describes how the output of each tile is \ -affected by the terrain, the presence of special resources such as \ -game or minerals, and tile improvements built by units. Note that the \ -tile on which the city itself rests -- the city center -- gets worked \ -for free, without being assigned a citizen. The city's tile may also \ -receive other benefits. In the classic ruleset, it always produces at \ -least one food and one production point regardless of terrain; gains \ -whatever advantages the terrain offers with an irrigation system \ -(because cities come with water systems built-in); and is usually \ -developed with roads. Other rulesets may differ in detail.\ -"), _("\ -The roles of citizens are controlled from the City dialog. Citizens \ -working the land are represented by three numbers showing their output \ -on the tile they are working. Clicking on these numbers will remove \ -the citizen from the tile, turning them into a specialist (see the \ -section on Specialists for more details); this can be seen in the \ -row of citizen icons. You can click another tile to assign the citizen \ -to work it, or click on the specialist icon to change their specialist \ -role.\ -"), _("\ -Clicking on the city center tile in the city map will automatically \ -choose citizen roles and tiles to work, with an emphasis on food \ -production and hence growth. Citizen roles are also automatically \ -assigned when a city grows; you may want to inspect cities that have \ -just grown and adjust the role in which the new citizen has been \ -placed. You can set different priorities for a city with the Citizen \ -Governor; see its help section.\ -"), _("\ -You can also request tile alterations from the city map, as an \ -alternative to explicitly instructing units to make them. In clients \ -which support it, right-clicking on a city map tile gives a menu of \ -changes which can be made to that tile, such as irrigation and \ -building roads (see the section on Terrain Alterations); you can \ -select one improvement per tile at a time. These 'worker tasks' will \ -be carried out by any units capable of them that are in 'auto settler' \ -mode.\ -"), _("\ -Citizens have a nationality distinct from that of the state they \ -inhabit. When a city grows due to food surplus, new citizens take \ -the nationality of the city's current owner, but when a city is \ -conquered or otherwise transferred, its citizens retain their \ -original nationality, as do any immigrants. Units founding or \ -contributing citizens to a city can also bring their own nationality.\ -"), _("\ -Citizens of another nationality will work in your cities just the same \ -as your own, and behave the same in most respects, but they may become \ -unhappy when you are at war with their associated state; their presence \ -makes it cheaper for their state's agents to incite revolt in your \ -cities; and if migration is enabled, they have an increased tendency to \ -migrate to their state's cities. Over time, citizens may be assimilated \ -into their home city, depending on ruleset settings.\ -"), _("\ -Some rulesets do not have nationality; in this case, citizens always \ -consider their nationality to be that of their home city. \ -If nationality is enabled, you can see the cultural makeup of your \ -cities and any consequent effects on happiness in the City dialog, \ -on the Happiness tab.\ -"), _("\ -Cities may be enhanced with a wide variety of buildings, which can \ -improve their productivity, their military strength, or give them \ -new abilities. See the sections on City Improvements and Wonders of \ -the World for more information.\ -") +[help_gen_cities] +generate = "Cities" [help_specialists] ; /* TRANS: Preserve the leading space: it controls nesting */ diff --git a/server/ruleset/ruleload.c b/server/ruleset/ruleload.c index 7ca83666b6..9bd0cbfc2c 100644 --- a/server/ruleset/ruleload.c +++ b/server/ruleset/ruleload.c @@ -3161,6 +3161,8 @@ static bool load_ruleset_terrain(struct section_file *file, "extraui.ui_name_base_airbase"); sz_strlcpy(terrain_control.gui_type_base1, text); + game.cities_helptext = lookup_strvec(file, "extraui", "cities_helptext"); + if (ok) { /* Terrain details */ @@ -9084,6 +9086,9 @@ static void send_ruleset_game(struct conn_list *dest) misc_p.background_green = game.plr_bg_color->g; misc_p.background_blue = game.plr_bg_color->b; + PACKET_STRVEC_INSERT(misc_p.cities_helptext, + game.cities_helptext); + lsend_packet_ruleset_game(dest, &misc_p); } diff --git a/tools/ruleutil/rulesave.c b/tools/ruleutil/rulesave.c index d51d1f6cc6..2be74bd7ca 100644 --- a/tools/ruleutil/rulesave.c +++ b/tools/ruleutil/rulesave.c @@ -2755,6 +2755,7 @@ static bool save_terrain_ruleset(const char *filename, const char *name) "extraui.ui_name_base_fortress"); secfile_insert_str(sfile, terrain_control.gui_type_base1, "extraui.ui_name_base_airbase"); + save_strvec(sfile, game.cities_helptext, "extraui", "helptext"); comment_extras(sfile);