From: <geo...@us...> - 2013-03-16 10:57:26
|
Revision: 5869 http://freeorion.svn.sourceforge.net/freeorion/revision/?rev=5869&view=rev Author: geoffthemedio Date: 2013-03-16 10:57:19 +0000 (Sat, 16 Mar 2013) Log Message: ----------- Added prerequisites and unlocked techs to tech descriptions in pedia. Modified Paths: -------------- trunk/FreeOrion/UI/EncyclopediaDetailPanel.cpp Modified: trunk/FreeOrion/UI/EncyclopediaDetailPanel.cpp =================================================================== --- trunk/FreeOrion/UI/EncyclopediaDetailPanel.cpp 2013-03-16 05:30:22 UTC (rev 5868) +++ trunk/FreeOrion/UI/EncyclopediaDetailPanel.cpp 2013-03-16 10:57:19 UTC (rev 5869) @@ -688,14 +688,37 @@ % UserString(boost::lexical_cast<std::string>(tech->Type())) % UserString(tech->ShortDescription())); - detailed_description = UserString(tech->Description()); - if (GetOptionsDB().Get<bool>("UI.autogenerated-effects-descriptions") && !tech->Effects().empty()) { - detailed_description += str(FlexibleFormat(UserString("ENC_EFFECTS_STR")) % EffectsDescription(tech->Effects())); + const std::set<std::string>& unlocked_by_techs = tech->Prerequisites(); + if (!unlocked_by_techs.empty()) { + detailed_description += UserString("ENC_UNLOCKED_BY"); + for (std::set<std::string>::const_iterator it = unlocked_by_techs.begin(); + it != unlocked_by_techs.end(); ++it) + { + std::string link_text = LinkTaggedText(VarText::TECH_TAG, *it); + detailed_description += str(FlexibleFormat(UserString("ENC_TECH_DETAIL_UNLOCKED_ITEM_STR")) + % UserString("UIT_TECH") + % link_text); + } + detailed_description += "\n"; } + const std::set<std::string>& unlocked_techs = tech->UnlockedTechs(); const std::vector<ItemSpec>& unlocked_items = tech->UnlockedItems(); + if (!unlocked_techs.empty() || !unlocked_items.empty()) + detailed_description += UserString("ENC_UNLOCKS"); + + if (!unlocked_techs.empty()) { + for (std::set<std::string>::const_iterator it = unlocked_techs.begin(); + it != unlocked_techs.end(); ++it) + { + std::string link_text = LinkTaggedText(VarText::TECH_TAG, *it); + detailed_description += str(FlexibleFormat(UserString("ENC_TECH_DETAIL_UNLOCKED_ITEM_STR")) + % UserString("UIT_TECH") + % link_text); + } + } + if (!unlocked_items.empty()) { - detailed_description += UserString("ENC_TECH_DETAIL_UNLOCKS_SECTION_STR"); for (unsigned int i = 0; i < unlocked_items.size(); ++i) { const ItemSpec& item = unlocked_items[i]; @@ -721,6 +744,15 @@ } } + if (!unlocked_techs.empty() || !unlocked_items.empty()) + detailed_description += "\n"; + + detailed_description += UserString(tech->Description()); + + if (GetOptionsDB().Get<bool>("UI.autogenerated-effects-descriptions") && !tech->Effects().empty()) { + detailed_description += str(FlexibleFormat(UserString("ENC_EFFECTS_STR")) % EffectsDescription(tech->Effects())); + } + } else if (m_items_it->first == "ENC_BUILDING_TYPE") { const BuildingType* building_type = GetBuildingType(m_items_it->second); if (!building_type) { @@ -1358,7 +1390,6 @@ AddItem(TextLinker::ENCYCLOPEDIA_TAG, (text.empty() || !lookup_in_stringtable) ? text : UserString(text)); } - void EncyclopediaDetailPanel::SetPlanet(int planet_id) { int current_item_id = INVALID_OBJECT_ID; |