本文整理汇总了C++中twindow::alternate_index方法的典型用法代码示例。如果您正苦于以下问题:C++ twindow::alternate_index方法的具体用法?C++ twindow::alternate_index怎么用?C++ twindow::alternate_index使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twindow
的用法示例。
在下文中一共展示了twindow::alternate_index方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catalog_page
void tinterior::catalog_page(twindow& window, int catalog, bool swap)
{
if (catalog < MIN_PAGE || catalog > MAX_PAGE) {
return;
}
int index = catalog - MIN_PAGE;
if (window.alternate_index() == index) {
// desired page is the displaying page, do nothing.
return;
}
std::vector<int> features;
std::stringstream str;
int selected_row = 0;
if (swap) {
selected_row = hero_table_->get_selected_row();
}
window.alternate_uh(hero_table_, index);
int hero_index = 0;
for (std::vector<hero*>::iterator itor = fresh_heros_.begin(); itor != fresh_heros_.end(); ++ itor, hero_index ++) {
/*** Add list item ***/
string_map table_item;
std::map<std::string, string_map> table_item_item;
hero* h = *itor;
if (catalog == ABILITY_PAGE) {
str.str("");
str << "<format>";
if (h->official_ == hero_official_mayor) {
str << "color=blue ";
} else if (h->official_ != HEROS_NO_OFFICIAL) {
str << "color=red ";
}
str << "text='" << h->name() << "'</format>";
table_item["label"] = str.str();
table_item_item.insert(std::make_pair("name", table_item));
table_item["label"] = lexical_cast<std::string>(h->loyalty(*teams_[h->side_].leader()));;
table_item_item.insert(std::make_pair("loyalty", table_item));
str.str("");
str << fxptoi9(h->politics_);
table_item["label"] = str.str();
table_item_item.insert(std::make_pair("politics", table_item));
str.str("");
str << hero::adaptability_str2(h->skill_[hero_skill_commercial]);
table_item["label"] = str.str();
table_item_item.insert(std::make_pair("commercial", table_item));
str.str("");
str << hero::adaptability_str2(h->skill_[hero_skill_invent]);
table_item["label"] = str.str();
table_item_item.insert(std::make_pair("technology", table_item));
table_item["label"] = hero::feature_str(h->feature_);
table_item_item.insert(std::make_pair("feature", table_item));
str.str("");
str << fxptoi9(h->leadership_);
table_item["label"] = str.str();
table_item_item.insert(std::make_pair("leadership", table_item));
str.str("");
str << fxptoi9(h->intellect_);
table_item["label"] = str.str();
table_item_item.insert(std::make_pair("intellect", table_item));
str.str("");
str << fxptoi9(h->charm_);
table_item["label"] = str.str();
table_item_item.insert(std::make_pair("charm", table_item));
} else if (catalog == ADAPTABILITY_PAGE) {
str.str("");
str << "<format>";
if (h->official_ == hero_official_mayor) {
str << "color=blue ";
} else if (h->official_ != HEROS_NO_OFFICIAL) {
str << "color=red ";
}
str << "text='" << h->name() << "'</format>";
table_item["label"] = str.str();
table_item_item.insert(std::make_pair("name", table_item));
table_item["label"] = hero::adaptability_str2(h->arms_[0]);
table_item_item.insert(std::make_pair("arm0", table_item));
table_item["label"] = hero::adaptability_str2(h->arms_[1]);
table_item_item.insert(std::make_pair("arm1", table_item));
table_item["label"] = hero::adaptability_str2(h->arms_[2]);
table_item_item.insert(std::make_pair("arm2", table_item));
table_item["label"] = hero::adaptability_str2(h->arms_[3]);
//.........这里部分代码省略.........