Author: cazfi Date: Sat Feb 7 06:57:02 2015 New Revision: 28016 URL: http://svn.gna.org/viewcvs/freeciv?rev=28016&view=rev Log: Help lists unit as capable of building an base or road only if it fits requirements of the extra in question.
See patch #5783 Modified: branches/S2_5/client/helpdata.c branches/S2_5/data/civ2/units.ruleset branches/S2_5/data/civ2civ3/units.ruleset branches/S2_5/data/classic/units.ruleset branches/S2_5/data/experimental/units.ruleset branches/S2_5/data/multiplayer/units.ruleset Modified: branches/S2_5/client/helpdata.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/helpdata.c?rev=28016&r1=28015&r2=28016&view=diff ============================================================================== --- branches/S2_5/client/helpdata.c (original) +++ branches/S2_5/client/helpdata.c Sat Feb 7 06:57:02 2015 @@ -2219,6 +2219,36 @@ } /**************************************************************** + Is unit type ever able to build an road +*****************************************************************/ +static bool help_is_road_buildable(struct road_type *proad, + struct unit_type *ptype) +{ + if (!proad->buildable) { + return FALSE; + } + + return are_reqs_active(NULL, NULL, NULL, NULL, ptype, + NULL, NULL, &proad->reqs, + RPT_POSSIBLE); +} + +/**************************************************************** + Is unit type ever able to build an base +*****************************************************************/ +static bool help_is_base_buildable(struct base_type *pbase, + struct unit_type *ptype) +{ + if (!pbase->buildable) { + return FALSE; + } + + return are_reqs_active(NULL, NULL, NULL, NULL, ptype, + NULL, NULL, &pbase->reqs, + RPT_POSSIBLE); +} + +/**************************************************************** Append misc dynamic text for units. Transport capacity, unit flags, fuel. @@ -2593,7 +2623,12 @@ char buf2[1024]; /* Roads, rail, mines, irrigation. */ - CATLSTR(buf, bufsz, _("* Can build roads and railroads.\n")); + road_type_iterate(proad) { + if (help_is_road_buildable(proad, utype)) { + cat_snprintf(buf, bufsz, _("* Can build %s on tiles.\n"), + road_name_translation(proad)); + } + } road_type_iterate_end; /* TODO: Check also that specific unit fulfills the requirements of the effects */ if (effect_cumulative_max(EFT_MINING_POSSIBLE) > 0) { @@ -2625,12 +2660,18 @@ CATLSTR(buf, bufsz, _("* Can irrigate terrain to another.\n")); } + base_type_iterate(pbase) { + if (help_is_base_buildable(pbase, utype)) { + cat_snprintf(buf, bufsz, _("* Can build %s on tiles.\n"), + base_name_translation(pbase)); + } + } base_type_iterate_end; + /* Pollution, fallout. */ CATLSTR(buf, bufsz, _("* Can clean pollution from tiles.\n")); CATLSTR(buf, bufsz, _("* Can clean nuclear fallout from tiles.\n")); } - /* FIXME: bases -- but there is no good way to find out which bases a unit - * can conceivably build currently, so we have to remain silent. */ + if (utype_has_flag(utype, UTYF_DIPLOMAT)) { if (utype_has_flag(utype, UTYF_SPY)) { CATLSTR(buf, bufsz, _("* Can perform diplomatic actions," Modified: branches/S2_5/data/civ2/units.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/civ2/units.ruleset?rev=28016&r1=28015&r2=28016&view=diff ============================================================================== --- branches/S2_5/data/civ2/units.ruleset (original) +++ branches/S2_5/data/civ2/units.ruleset Sat Feb 7 06:57:02 2015 @@ -20,7 +20,7 @@ ; helptxt = displayed in the help for units with this flag (optional) flags = { "name", "helptxt" - _("Airbase"), _("Can build airbases.") + _("Airbase") _("Transform"), _("Can transform terrain.") _("AirAttacker"), _("Very bad at attacking AEGIS.") _("Horse"), _("Attack value halved when attacking Pikemen.") Modified: branches/S2_5/data/civ2civ3/units.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/civ2civ3/units.ruleset?rev=28016&r1=28015&r2=28016&view=diff ============================================================================== --- branches/S2_5/data/civ2civ3/units.ruleset (original) +++ branches/S2_5/data/civ2civ3/units.ruleset Sat Feb 7 06:57:02 2015 @@ -25,7 +25,7 @@ ; helptxt = displayed in the help for units with this flag (optional) flags = { "name", "helptxt" - _("Airbase"), _("Can build airbases and buoys.") + _("Airbase") _("Transform"), _("Can transform terrain.") _("AirAttacker"), _("Very bad at attacking AEGIS.") _("Submarine"), _("Attack value halved when attacking Destroyer.") Modified: branches/S2_5/data/classic/units.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/classic/units.ruleset?rev=28016&r1=28015&r2=28016&view=diff ============================================================================== --- branches/S2_5/data/classic/units.ruleset (original) +++ branches/S2_5/data/classic/units.ruleset Sat Feb 7 06:57:02 2015 @@ -25,7 +25,7 @@ ; helptxt = displayed in the help for units with this flag (optional) flags = { "name", "helptxt" - _("Airbase"), _("Can build airbases and buoys.") + _("Airbase") _("Transform"), _("Can transform terrain.") _("AirAttacker"), _("Very bad at attacking AEGIS.") _("Horse"), _("Attack value halved when attacking Pikemen.") Modified: branches/S2_5/data/experimental/units.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/experimental/units.ruleset?rev=28016&r1=28015&r2=28016&view=diff ============================================================================== --- branches/S2_5/data/experimental/units.ruleset (original) +++ branches/S2_5/data/experimental/units.ruleset Sat Feb 7 06:57:02 2015 @@ -28,7 +28,7 @@ ; helptxt = displayed in the help for units with this flag (optional) flags = { "name", "helptxt" - _("Airbase"), _("Can build airbases and buoys.") + _("Airbase") _("Transform"), _("Can transform terrain.") _("AirAttacker"), _("Very bad at attacking AEGIS.") _("Horse"), _("Attack value halved when attacking Pikemen.") Modified: branches/S2_5/data/multiplayer/units.ruleset URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/multiplayer/units.ruleset?rev=28016&r1=28015&r2=28016&view=diff ============================================================================== --- branches/S2_5/data/multiplayer/units.ruleset (original) +++ branches/S2_5/data/multiplayer/units.ruleset Sat Feb 7 06:57:02 2015 @@ -25,7 +25,7 @@ ; helptxt = displayed in the help for units with this flag (optional) flags = { "name", "helptxt" - _("Airbase"), _("Can build airbases.") + _("Airbase") _("Transform"), _("Can transform terrain.") _("AirAttacker"), _("Very bad at attacking AEGIS.") _("Horse"), _("Attack value halved when attacking Pikemen.") _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits