mail[Wesnoth-commits] r20377 - in /trunk: data/core/help.cfg src/help.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by alinktomine on September 14, 2007 - 21:07:
Author: alink
Date: Fri Sep 14 21:07:10 2007
New Revision: 20377

URL: http://svn.gna.org/viewcvs/wesnoth?rev=20377&view=rev
Log:
Since the race description pages are not ready, remove the "Races" sections.
The race description is now an hidden topic in each units/race subsection
You can still access it by clicking on the race hyperlink of a unit page
We will probably make this page more accessible/visible later.

Modified:
    trunk/data/core/help.cfg
    trunk/src/help.cpp

Modified: trunk/data/core/help.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/core/help.cfg?rev=20377&r1=20376&r2=20377&view=diff
==============================================================================
--- trunk/data/core/help.cfg (original)
+++ trunk/data/core/help.cfg Fri Sep 14 21:07:10 2007
@@ -1,7 +1,7 @@
 #textdomain wesnoth
 [help]
     [toplevel]
-        
sections=introduction,gameplay,units,races_section,abilities_section,traits_section,weapon_specials,terrains,commands
+        
sections=introduction,gameplay,units,abilities_section,traits_section,weapon_specials,terrains,commands
         topics=about,license
     [/toplevel]
 
@@ -33,13 +33,6 @@
         sort_topics=yes
         sort_sections=yes
         topics=.unknown_unit
-    [/section]
-
-    [section]
-        id=races_section
-        title= _ "Races"
-        generator=races
-        sort_topics=generated
     [/section]
 
     [section]

Modified: trunk/src/help.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/help.cpp?rev=20377&r1=20376&r2=20377&view=diff
==============================================================================
--- trunk/src/help.cpp (original)
+++ trunk/src/help.cpp Fri Sep 14 21:07:10 2007
@@ -1334,7 +1334,7 @@
                        race_name = _ ("race^Miscellaneous");
                }
                ss << _("Race: ");
-               ss << "<ref>dst='" << escape("race_"+race_id) << "' text='" 
<< escape(race_name) << "'</ref>";
+               ss << "<ref>dst='" << escape(".race_"+race_id) << "' text='" 
<< escape(race_name) << "'</ref>";
                ss << "\n";
 
                // Print the abilities the units has, cross-reference them
@@ -1595,6 +1595,9 @@
        if (game_info == NULL) {
                return topics;
        }
+
+       std::set<std::string> race_units;
+       
        for(game_data::unit_type_map::const_iterator i = 
game_info->unit_types.begin();
            i != game_info->unit_types.end(); i++) {
                const unit_type &type = (*i).second;
@@ -1606,11 +1609,39 @@
                        continue;
 
                const std::string lang_name = type.language_name();
-               const std::string id = type.id();
-               topic unit_topic(lang_name, std::string("unit_") + id, "");
+               const std::string ref_id = std::string("unit_") +  type.id();
+               topic unit_topic(lang_name, ref_id, "");
                unit_topic.text = new unit_topic_generator(type);
                topics.push_back(unit_topic);
-       }
+
+               // we also record an hyperlink of this unit
+               // in the list used for the race topic
+               std::string link =  "<ref>text='" + escape(lang_name) + "' 
dst='" + escape(ref_id) + "'</ref>";
+               race_units.insert(link);
+       }
+
+       //generate the hidden race description topic
+       std::string race_id = ".race_"+race;
+       std::string race_name;
+       std::string race_description;
+       const race_map::const_iterator race_it = game_info->races.find(race);
+       if (race_it != game_info->races.end()) {
+               race_name = race_it->second.name();
+               race_description = race_it->second.description();
+               // if (description.empty()) description =  _("No description 
Available");
+       } else {
+               race_name = _ ("race^Miscellaneous");
+               // description =  _("Here put the description of the 
Miscellaneous race");
+       }
+
+       std::stringstream text;
+       text << race_description;
+       text << "\n\n" << _("Units of this race:") << "\n";
+       for (std::set<std::string>::iterator u = race_units.begin(); u != 
race_units.end();u++) {
+               text << (*u) << "\n";
+       }
+       topics.push_back(topic(race_name, race_id, text.str()) );
+
        if (sort_generated)
                std::sort(topics.begin(), topics.end(), title_less());
        return topics;




Related Messages


Powered by MHonArc, Updated Fri Sep 14 22:20:49 2007