New [unit_side] theme element. This is a flag of the side of the current unit.

This commit is contained in:
Benoît Timbert 2008-03-16 17:42:13 +00:00
parent 48741f7406
commit 6384d3b1f3
4 changed files with 18 additions and 4 deletions

View file

@ -40,6 +40,7 @@ Version 1.5.0-svn:
* it's now possible to specify with loop= how many times a sample
associated with a sound source should be played
* new [switch] conditional command
* new [unit_side] theme element : this is the side of the current unit (flag)
* miscellaneous and bug fixes:
* wmlxgettext now print some context information about the strings
extracted (patch #993)

View file

@ -65,6 +65,19 @@ report generate_report(TYPE type,
return report(u->second.language_name(),"",u->second.unit_description());
case UNIT_RACE:
return report(u->second.race()->name(u->second.gender()));
case UNIT_SIDE: {
std::string flag_icon = teams[u->second.side()-1].flag_icon();
std::string old_rgb = game_config::flag_rgb;
std::string new_rgb = team::get_side_colour_index(u->second.side());
std::string mods = "~RC(" + old_rgb + ">" + new_rgb + ")";
if(flag_icon.empty()) {
flag_icon = game_config::flag_icon_image;
}
image::locator flag_icon_img(flag_icon, mods);
return report("",flag_icon_img,teams[u->second.side()-1].current_player());
}
case UNIT_LEVEL:
str << u->second.level();
break;

View file

@ -21,9 +21,9 @@
namespace {
const std::string report_names[] = { "unit_description", "unit_type",
"unit_race", "unit_level", "unit_amla", "unit_traits",
"unit_status", "unit_alignment", "unit_abilities", "unit_hp",
"unit_xp", "unit_advancement_options", "unit_moves",
"unit_race", "unit_level", "unit_side", "unit_amla",
"unit_traits", "unit_status", "unit_alignment", "unit_abilities",
"unit_hp", "unit_xp", "unit_advancement_options", "unit_moves",
"unit_weapons", "unit_image", "unit_profile", "time_of_day",
"turn", "gold", "villages", "num_units", "upkeep", "expenses",
"income", "terrain", "position", "side_playing", "observers",

View file

@ -27,7 +27,7 @@
namespace reports {
enum TYPE { UNIT_NAME, UNIT_TYPE, UNIT_RACE, UNIT_LEVEL,
UNIT_AMLA, UNIT_TRAITS, UNIT_STATUS,
UNIT_SIDE, UNIT_AMLA, UNIT_TRAITS, UNIT_STATUS,
UNIT_ALIGNMENT, UNIT_ABILITIES, UNIT_HP, UNIT_XP,
UNIT_ADVANCEMENT_OPTIONS, UNIT_MOVES, UNIT_WEAPONS,
UNIT_IMAGE, UNIT_PROFILE, TIME_OF_DAY,