Add a page "Unknown Unit" in the unit list,

...and links pointing to unencountered units goes there.

These links have a small (?) at the end (for indication and sparing space)

(The page "Unknown Unit" use the random leader unit image with a "?")
Please improve the text of it this page.
This commit is contained in:
Ali El Gariani 2007-08-11 02:21:29 +00:00
parent 0b6cc6f9b4
commit 24fa39aff8
2 changed files with 32 additions and 11 deletions

View file

@ -29,6 +29,7 @@
[section]
id=units
title= _ "Units"
topics=unknown_unit
generator=units
sort_topics=yes
[/section]
@ -67,6 +68,14 @@
text= _ "Certain units have abilities that either directly affect other units, or have an impact on how the unit interacts with other units. These abilities will be listed under this topic as you encounter them."
[/topic]
[topic]
id=unknown_unit
title= _ "Unknown Unit"
text="<img>src=units/random-enemy.png align=left float=yes</img>" + _"
This unit is unknown for the moment. You must discover it in game to be allowed to see its description."
[/topic]
[topic]
id=introduction_topic
title= _ "Overview"

View file

@ -1146,13 +1146,20 @@ public:
++from_iter)
{
std::string unit_id = *from_iter;
std::map<std::string,unit_type>::const_iterator from_type = game_info->unit_types.find(unit_id);
if (from_type != game_info->unit_types.end())
std::map<std::string,unit_type>::const_iterator type = game_info->unit_types.find(unit_id);
if (type != game_info->unit_types.end())
{
std::string lang_unit = from_type->second.language_name();
std::string ref_id = std::string("unit_") + from_type->second.id();
std::string lang_unit = type->second.language_name();
std::string ref_id;
if (description_type(type->second) == FULL_DESCRIPTION) {
ref_id = std::string("unit_") + type->second.id();
} else {
ref_id = "unknown_unit";
lang_unit += " (?)";
}
ss << "<ref>dst='" << escape(ref_id) << "' text='" << escape(lang_unit) << "'</ref>";
if (from_iter + 1 != from_units.end()) ss << ", ";
if (from_iter + 1 != from_units.end())
ss << ", ";
}
}
ss << "\n";
@ -1167,12 +1174,17 @@ public:
advance_end = next_units.end();
advance_it != advance_end; ++advance_it) {
std::string unit_id = *advance_it;
std::map<std::string,unit_type>::const_iterator new_type = game_info->unit_types.find(unit_id);
if(new_type != game_info->unit_types.end()) {
std::string lang_unit = new_type->second.language_name();
std::string ref_id = std::string("unit_") + new_type->second.id();
ss << "<ref>dst='" << escape(ref_id) << "' text='" << escape(lang_unit)
<< "'</ref>";
std::map<std::string,unit_type>::const_iterator type = game_info->unit_types.find(unit_id);
if(type != game_info->unit_types.end()) {
std::string lang_unit = type->second.language_name();
std::string ref_id;
if (description_type(type->second) == FULL_DESCRIPTION) {
ref_id = std::string("unit_") + type->second.id();
} else {
ref_id = "unknown_unit";
lang_unit += " (?)";
}
ss << "<ref>dst='" << escape(ref_id) << "' text='" << escape(lang_unit) << "'</ref>";
if (advance_it + 1 != advance_end)
ss << ", ";
}