Syntax change to TC, and fix a few more spots that use it.

MP selection always uses red, because the selection dialogs don't know
what color to use.
This commit is contained in:
Dominic Bolin 2006-07-19 22:12:08 +00:00
parent 535bcda742
commit 43e4e55a61
21 changed files with 59 additions and 47 deletions

View file

@ -6,14 +6,14 @@
id=eastern_invasion
rank=30
#textdomain wesnoth-ei
icon=units/human-loyalists/general.png(1,magenta)
icon=units/human-loyalists/general.png~TC~TC(1,magenta)
name= _ "The Eastern Invasion"
define=CAMPAIGN_EASTERN_INVASION
first_scenario=The_Outpost
difficulties=EASY,NORMAL,HARD
difficulty_descriptions={MENU_IMG_TXT2 "units/human-loyalists/spearman.png(1,magenta)" _"Spearman" _"(easiest)"} +
";*" + {MENU_IMG_TXT "units/human-loyalists/swordsman.png(1,magenta)" _"Swordsman"} +
";" + {MENU_IMG_TXT2 "units/human-loyalists/royalguard.png(1,magenta)" (_"Royal Guard") _"(hardest)"}
difficulty_descriptions={MENU_IMG_TXT2 "units/human-loyalists/spearman.png~TC(1,magenta)" _"Spearman" _"(easiest)"} +
";*" + {MENU_IMG_TXT "units/human-loyalists/swordsman.png~TC(1,magenta)" _"Swordsman"} +
";" + {MENU_IMG_TXT2 "units/human-loyalists/royalguard.png~TC(1,magenta)" (_"Royal Guard") _"(hardest)"}
description= _ "There are rumors of undead attacks on the eastern border of Wesnoth. You, an officer in the Royal Army, have been sent to the eastern front to protect the villagers and find out what is happening."
image=portraits/gweddry.png

View file

@ -10,9 +10,9 @@
define=CAMPAIGN_HEIR_TO_THE_THRONE
first_scenario=01_The_Elves_Besieged
difficulties=EASY,NORMAL,HARD
difficulty_descriptions={MENU_IMG_TXT2 "units/elves-wood/fighter.png(1,magenta)" _"Fighter" _"(easiest)"} +
";*" + {MENU_IMG_TXT "units/elves-wood/hero.png(1,magenta)" _"Hero"} + ";" +
{MENU_IMG_TXT2 "units/elves-wood/champion.png(1,magenta)" _"Champion" _"(hardest)"}
difficulty_descriptions={MENU_IMG_TXT2 "units/elves-wood/fighter.png~TC(1,magenta)" _"Fighter" _"(easiest)"} +
";*" + {MENU_IMG_TXT "units/elves-wood/hero.png~TC(1,magenta)" _"Hero"} + ";" +
{MENU_IMG_TXT2 "units/elves-wood/champion.png~TC(1,magenta)" _"Champion" _"(hardest)"}
description= _ "Fight to regain the throne of Wesnoth, of which you are the legitimate heir."
image=portraits/konrad.png

View file

@ -16,7 +16,7 @@
description= _ "A young Knight, Deoran, is dispatched to take command of the South Guard... Note: This campaign is designed as an introduction to Wesnoth. The 'Civilian' difficulty level is aimed at first-time players."
difficulties=EASY,NORMAL,HARD
difficulty_descriptions="*" + {MENU_IMG_TXT2 "units/human-loyalists/peasant.png(1,magenta)" _"Civilian" _"(simple)"} + ";" + {MENU_IMG_TXT2 "units/human-loyalists/spearman.png(1,magenta)" _"Recruit" _"(easy)"} + ";" + {MENU_IMG_TXT2 "units/human-loyalists/javelineer.png(1,magenta)" _"Soldier" _"(normal)"}
difficulty_descriptions="*" + {MENU_IMG_TXT2 "units/human-loyalists/peasant.png~TC(1,magenta)" _"Civilian" _"(simple)"} + ";" + {MENU_IMG_TXT2 "units/human-loyalists/spearman.png~TC(1,magenta)" _"Recruit" _"(easy)"} + ";" + {MENU_IMG_TXT2 "units/human-loyalists/javelineer.png~TC(1,magenta)" _"Soldier" _"(normal)"}
first_scenario=1_Born_To_The_Banner

View file

@ -6,14 +6,14 @@ name="wesnoth-tb"
id=Two_Brothers
rank=1
#textdomain wesnoth-tb
icon="units/human-loyalists/knight.png(1,magenta)"
icon="units/human-loyalists/knight.png~TC(1,magenta)"
image="arne.png"
name= _ "A Tale Of Two Brothers"
define="CAMPAIGN_TWO_BROTHERS"
first_scenario="1_Rooting_Out_A_Mage"
difficulties=EASY,HARD
difficulty_descriptions={MENU_IMG_TXT2 "units/human-loyalists/horseman-moving.png(1,magenta)" _"Horseman" _"(easy)"} +
";" + {MENU_IMG_TXT2 "units/human-loyalists/grand-knight.png(1,magenta)" _"Knight" _"(hard)"}
difficulty_descriptions={MENU_IMG_TXT2 "units/human-loyalists/horseman-moving.png~TC(1,magenta)" _"Horseman" _"(easy)"} +
";" + {MENU_IMG_TXT2 "units/human-loyalists/grand-knight.png~TC(1,magenta)" _"Knight" _"(hard)"}
description= _ "A Black Mage is threatening the local village and its inhabitants. When their leader Bjarn sends for aid from his brother Arne, he is victorious, but Bjarn himself is kidnapped. Can you rescue him?
A very short campaign, made for beginners on easy and challenging for pros on hard."

View file

@ -1,6 +1,6 @@
[multiplayer_side]
id=Alliance of Darkness
name={MENU_IMG_TXT "undead-necromancers/dark_sorcerer.png" (_"Alliance of Darkness")}
name={MENU_IMG_TXT "undead-necromancers/dark_sorcerer.png~TC(1,magenta)" (_"Alliance of Darkness")}
type=Dark Sorcerer
leader=Dark Sorcerer,Revenant,Bone Shooter,Deathblade,Orcish Warrior,Troll,Troll Rocklobber,Orcish Crossbowman,Orcish Slayer,Rogue,Bandit,Trapper,Saurian Oracle,Saurian Soothsayer
random_leader=Dark Sorcerer,Revenant,Bone Shooter,Deathblade,Orcish Warrior,Troll,Troll Rocklobber,Orcish Crossbowman,Orcish Slayer,Rogue,Bandit,Trapper

View file

@ -1,6 +1,6 @@
[multiplayer_side]
id=Knalgan Alliance
name={MENU_IMG_TXT "dwarves/lord.png" (_"Knalgan Alliance")}
name={MENU_IMG_TXT "dwarves/lord.png~TC(1,magenta)" (_"Knalgan Alliance")}
type=Dwarvish Lord
leader=Dwarvish Lord,Dwarvish Dragonguard,Dwarvish Sentinel,Assassin,Trapper
random_leader=Dwarvish Lord,Dwarvish Dragonguard,Dwarvish Sentinel,Assassin

View file

@ -1,6 +1,6 @@
[multiplayer_side]
id=Knalgan Alliance
name={MENU_IMG_TXT "dwarves/warrior.png" (_"Knalgan Alliance")}
name={MENU_IMG_TXT "dwarves/warrior.png~TC(1,magenta)" (_"Knalgan Alliance")}
type=Dwarvish Steelclad
leader=Dwarvish Steelclad,Dwarvish Thunderguard,Dwarvish Stalwart,Rogue,Trapper
recruit=Dwarvish Guardsman,Dwarvish Fighter,Dwarvish Ulfserker,Dwarvish Thunderer,Thief,Poacher,Footpad,Gryphon Rider

View file

@ -1,6 +1,6 @@
[multiplayer_side]
id=Loyalists
name={MENU_IMG_TXT "human-loyalists/general.png" _"Loyalists"}
name={MENU_IMG_TXT "human-loyalists/general.png~TC(1,magenta)" _"Loyalists"}
type=General
leader=General,Royal Guard,Halbardier,Iron Mauler,Master Bowman,Mage of Light,Arch Mage,Silver Mage,Javelineer
random_leader=General,Royal Guard,Halbardier,Iron Mauler,Master Bowman,Arch Mage,Silver Mage

View file

@ -1,6 +1,6 @@
[multiplayer_side]
id=Loyalists
name={MENU_IMG_TXT "human-loyalists/lieutenant.png" _"Loyalists"}
name={MENU_IMG_TXT "human-loyalists/lieutenant.png~TC(1,magenta)" _"Loyalists"}
type=Lieutenant
leader=Lieutenant,Swordsman,Pikeman,Javelineer,Shock Trooper,Longbowman,White Mage,Red Mage
random_leader=Lieutenant,Swordsman,Pikeman,Javelineer,Shock Trooper,Longbowman,Red Mage

View file

@ -1,6 +1,6 @@
[multiplayer_side]
id=Northerners
name={MENU_IMG_TXT "orcs/warlord.png" _"Northerners"}
name={MENU_IMG_TXT "orcs/warlord.png~TC(1,magenta)" _"Northerners"}
type=Orcish Warlord
leader=Orcish Warlord,Troll Warrior,Orcish Slurbow,Orcish Slayer
random_leader=Orcish Warlord,Troll Warrior,Orcish Slurbow

View file

@ -1,6 +1,6 @@
[multiplayer_side]
id=Northeners
name={MENU_IMG_TXT "orcs/warrior.png" _"Northerners"}
name={MENU_IMG_TXT "orcs/warrior.png~TC(1,magenta)" _"Northerners"}
type=Orcish Warrior
leader=Orcish Warrior,Troll,Troll Rocklobber,Orcish Crossbowman,Orcish Slayer
recruit=Orcish Grunt,Troll Whelp,Wolf Rider,Orcish Archer,Orcish Assassin,Naga Fighter,Goblin Spearman

View file

@ -1,6 +1,6 @@
[multiplayer_side]
id=Rebels
name={MENU_IMG_TXT "elves-wood/marshal.png" _"Rebels"}
name={MENU_IMG_TXT "elves-wood/marshal.png~TC(1,magenta)" _"Rebels"}
type=Elvish Marshal
leader=Elvish Marshal,Elvish Champion,Elvish Avenger,Elvish Sharpshooter,Mage of Light,Arch Mage,Silver Mage,Elvish Shyde,Elvish Enchantress,Ancient Wose
random_leader=Elvish Marshal,Elvish Champion,Elvish Avenger,Elvish Sharpshooter,Arch Mage,Silver Mage,Elvish Shyde,Elvish Enchantress

View file

@ -1,6 +1,6 @@
[multiplayer_side]
id=Rebels
name={MENU_IMG_TXT "elves-wood/captain.png" _"Rebels"}
name={MENU_IMG_TXT "elves-wood/captain.png~TC(1,magenta)" _"Rebels"}
type=Elvish Captain
leader=Elvish Captain,Elvish Hero,Elvish Ranger,Elvish Marksman,Elvish Druid,Elvish Sorceress,White Mage,Red Mage,Elder Wose
random_leader=Elvish Captain,Elvish Hero,Elvish Ranger,Elvish Marksman,Elvish Druid,Elvish Sorceress,Red Mage

View file

@ -1,6 +1,6 @@
[multiplayer_side]
id=Undead
name={MENU_IMG_TXT "undead-necromancers/lich.png" _"Undead"}
name={MENU_IMG_TXT "undead-necromancers/lich.png~TC(1,magenta)" _"Undead"}
type=Lich
leader=Lich,Necromancer,Draug,Soul Shooter,Necrophage,Deathblade
random_leader=Lich,Necromancer,Draug,Soul Shooter

View file

@ -1,6 +1,6 @@
[multiplayer_side]
id=Undead
name={MENU_IMG_TXT "undead-necromancers/dark-sorcerer.png" _"Undead"}
name={MENU_IMG_TXT "undead-necromancers/dark-sorcerer.png~TC(1,magenta)" _"Undead"}
type=Dark Sorcerer
leader=Dark Sorcerer,Revenant,Deathblade,Bone Shooter,Necrophage
recruit=Skeleton,Skeleton Archer,Walking Corpse,Ghost,Vampire Bat,Dark Adept,Ghoul

View file

@ -1086,10 +1086,10 @@ public:
const unit_type& male_type = type_.get_gender_unit_type(unit_race::MALE);
// Show the unit's image and its level.
ss << "<img>src='" << male_type.image() << "(1," << male_type.flag_rgb() << ")" << "'</img> ";
ss << "<img>src='" << male_type.image() << "~TC(1," << male_type.flag_rgb() << ")" << "'</img> ";
if (&female_type != &male_type)
ss << "<img>src='" << female_type.image() << "(1," << female_type.flag_rgb() << ")" << "'</img> ";
ss << "<img>src='" << female_type.image() << "~TC(1," << female_type.flag_rgb() << ")" << "'</img> ";
ss << "<format>font_size=" << font::relative_size(11) << " text=' " << escape(_("level"))
<< " " << type_.level() << "'</format>";

View file

@ -119,19 +119,8 @@ void locator::init_index()
index_ = i->second;
}
}
void locator::get_tc_info()
void locator::get_tc_info(const std::string& field)
{
std::string& fn(val_.filename_);
if(fn.empty()) {
return;
}
size_t open_field = fn.find('(');
size_t close_field = fn.find(')');
if(open_field == std::string::npos || close_field == std::string::npos) {
return;
}
std::string field = fn.substr(open_field+1,close_field-open_field-1);
fn = fn.substr(0,open_field);
// field should be of the format "team,team_color_id"
size_t comma = field.find(',');
if(comma == std::string::npos) {
@ -142,6 +131,28 @@ void locator::get_tc_info()
val_.new_color = team::get_side_color_range(team_n);
val_.swap_colors = game_config::tc_info(color_id);
}
void locator::parse_arguments()
{
std::string& fn(val_.filename_);
if(fn.empty()) {
return;
}
size_t markup_field = fn.find('~');
while(markup_field != std::string::npos) {
size_t open_field = fn.find('(',markup_field);
size_t close_field = fn.find(')',markup_field);
if(open_field == std::string::npos || close_field == std::string::npos) {
return;
}
std::string field = fn.substr(open_field+1,close_field-open_field-1);
std::string function = fn.substr(markup_field+1,open_field-markup_field-1);
fn = fn.substr(0,markup_field) + fn.substr(close_field+1);
if(function == "TC") {
get_tc_info(field);
}
markup_field = fn.find('~');
}
}
locator::locator() :
index_(-1)
@ -156,15 +167,15 @@ locator::locator(const locator &a):
locator::locator(const char *filename) :
val_(filename)
{
parse_arguments();
init_index();
get_tc_info();
}
locator::locator(const std::string &filename) :
val_(filename)
{
parse_arguments();
init_index();
get_tc_info();
}
locator::locator(const char *filename, const color_range& new_rgb, const std::vector<Uint32>& swap_rgb) :

View file

@ -47,7 +47,8 @@ namespace image {
// Called by each constructor after actual construction to
// initialize the index_ field
void init_index();
void get_tc_info();
void get_tc_info(const std::string& field);
void parse_arguments();
public:
enum type { NONE, FILE, SUB_FILE };

View file

@ -87,8 +87,8 @@ void leader_list_manager::update_leader_list(int side_index)
if (utypes.find(*itor) != utypes.end()) {
const std::string name = utypes.find(*itor)->second.language_name();
const std::string image = utypes.find(*itor)->second.image();
leader_strings.push_back(IMAGE_PREFIX + image + COLUMN_SEPARATOR + name);
leader_strings.push_back(IMAGE_PREFIX + image + std::string("~TC(1," + utypes.find(*itor)->second.flag_rgb() + ")") + COLUMN_SEPARATOR + name);
} else {
leader_strings.push_back("?");
}

View file

@ -218,7 +218,7 @@ namespace events{
}
std::stringstream str;
str << IMAGE_PREFIX << type->second.image() << "(" << team << "," << type->second.flag_rgb() << ")" << COLUMN_SEPARATOR
str << IMAGE_PREFIX << type->second.image() << "~TC(" << team << "," << type->second.flag_rgb() << ")" << COLUMN_SEPARATOR
<< type->second.language_name() << COLUMN_SEPARATOR << i->second << "\n";
table.push_back(str.str());
}
@ -337,7 +337,7 @@ namespace events{
//output the number of the side first, and this will
//cause it to be displayed in the correct colour
if(leader != units_.end()) {
str << IMAGE_PREFIX << leader->second.absolute_image() << "(" << (n+1) << "," << leader->second.team_color() << ")" << COLUMN_SEPARATOR
str << IMAGE_PREFIX << leader->second.absolute_image() << "~TC(" << (n+1) << "," << leader->second.team_color() << ")" << COLUMN_SEPARATOR
<< "\033[3" << lexical_cast<char, size_t>(n+1) << 'm' << leader->second.description() << COLUMN_SEPARATOR;
} else {
str << ' ' << COLUMN_SEPARATOR << "\033[3" << lexical_cast<char, size_t>(n+1) << "m-" << COLUMN_SEPARATOR;
@ -563,7 +563,7 @@ namespace events{
std::stringstream description;
description << font::IMAGE << type.image() << "(" << team_num << "," << type.flag_rgb() << ")" << COLUMN_SEPARATOR << font::LARGE_TEXT
description << font::IMAGE << type.image() << "~TC(" << team_num << "," << type.flag_rgb() << ")" << COLUMN_SEPARATOR << font::LARGE_TEXT
<< prefix << type.language_name() << "\n"
<< prefix << type.cost() << " " << sgettext("unit^Gold");
items.push_back(description.str());
@ -698,7 +698,7 @@ namespace events{
for(std::vector<unit>::const_iterator u = recall_list.begin(); u != recall_list.end(); ++u) {
std::stringstream option;
const std::string& description = u->description().empty() ? "-" : u->description();
option << IMAGE_PREFIX << u->absolute_image() << "(" << team_num << "," << u->team_color() << ")" << COLUMN_SEPARATOR
option << IMAGE_PREFIX << u->absolute_image() << "~TC(" << team_num << "," << u->team_color() << ")" << COLUMN_SEPARATOR
<< u->language_name() << COLUMN_SEPARATOR
<< description << COLUMN_SEPARATOR
<< u->level() << COLUMN_SEPARATOR

View file

@ -89,7 +89,7 @@ void wait::leader_preview_pane::draw_contents()
if (utypes.find(leader) != utypes.end()) {
leader_name = utypes.find(leader)->second.language_name();
image = utypes.find(leader)->second.image();
image = utypes.find(leader)->second.image() + "~TC(1," + utypes.find(leader)->second.flag_rgb() + ")";
}
for(std::vector<std::string>::const_iterator itor = recruit_list.begin();
itor != recruit_list.end(); ++itor) {
@ -393,7 +393,7 @@ void wait::generate_menu()
std::string::size_type p =
side_name.str().find_first_of(COLUMN_SEPARATOR);
if(p != std::string::npos && p < side_name.size()) {
side_name = IMAGE_PREFIX + leader_image + COLUMN_SEPARATOR + side_name.str().substr(p+1);
side_name = IMAGE_PREFIX + leader_image + std::string("~TC(" + sd["side"] + ",") + std::string(utypes.find(leader_type)->second.flag_rgb() + ")") + COLUMN_SEPARATOR + side_name.str().substr(p+1);
}
}
}