本文整理汇总了C++中team::countdown_time方法的典型用法代码示例。如果您正苦于以下问题:C++ team::countdown_time方法的具体用法?C++ team::countdown_time怎么用?C++ team::countdown_time使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类team
的用法示例。
在下文中一共展示了team::countdown_time方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generate_report
//.........这里部分代码省略.........
return report("", stratum_icon_img, "");
}
case MERITORIOUS: {
str << rpg::h->meritorious_;
break;
}
case SIDE_PLAYING: {
std::string flag_icon = teams[playing_side-1].flag_icon();
std::string old_rgb = game_config::flag_rgb;
std::string new_rgb = team::get_side_color_index(playing_side);
std::string mods = "~RC(" + old_rgb + ">" + new_rgb + ")";
if(flag_icon.empty()) {
flag_icon = game_config::images::flag_icon;
}
image::locator flag_icon_img(flag_icon, mods);
return report("", flag_icon_img, teams[playing_side-1].name());
}
case OBSERVERS: {
if(observers.empty()) {
return report();
}
str << _("Observers:") << "\n";
for(std::set<std::string>::const_iterator i = observers.begin(); i != observers.end(); ++i) {
str << *i << "\n";
}
return report("",game_config::images::observer,str.str());
}
#ifdef DISABLE_EDITOR
case EDITOR_SELECTED_TERRAIN:
case EDITOR_LEFT_BUTTON_FUNCTION:
return report();
#else
case EDITOR_SELECTED_TERRAIN: {
if (editor::selected_terrain.empty())
return report();
else
return report(editor::selected_terrain);
}
case EDITOR_LEFT_BUTTON_FUNCTION: {
if (editor::left_button_function.empty())
return report();
else
return report(editor::left_button_function);
}
#endif
case REPORT_COUNTDOWN: {
int min;
int sec;
if (viewing_team.countdown_time() > 0){
sec = viewing_team.countdown_time() / 1000;
char const *end = naps;
if (current_side != playing_side)
str << span_color(font::GRAY_COLOR);
else if (sec < 60)
str << "<span foreground=\"#c80000\">";
else if (sec < 120)
str << "<span foreground=\"#c8c800\">";
else
end = "";
min = sec / 60;
str << min << ":";
sec = sec % 60;
if (sec < 10) {
str << "0";
}
str << sec << end;
break;
} // Intentional fall-through to REPORT_CLOCK
// if the time countdown isn't valid.
// If there is no turn time limit,
// then we display the clock instead.
}
case REPORT_CLOCK: {
time_t t = std::time(NULL);
struct tm *lt = std::localtime(&t);
if (lt) {
char temp[10];
size_t s = std::strftime(temp, 10, preferences::clock_format().c_str(), lt);
if(s>0) {
return report(temp);
} else {
return report();
}
} else {
return report();
}
}
default:
assert(false);
break;
}
return report(str.str());
}
示例2: generate_report
//.........这里部分代码省略.........
break;
}
case SIDE_PLAYING: {
std::string flag_icon = teams[playing_side-1].flag_icon();
std::string old_rgb = game_config::flag_rgb;
std::string new_rgb = team::get_side_colour_index(playing_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[playing_side-1].current_player());
}
case OBSERVERS: {
if(observers.empty()) {
return report();
}
str << _("Observers:") << "\n";
for(std::set<std::string>::const_iterator i = observers.begin(); i != observers.end(); ++i) {
str << *i << "\n";
}
return report("",game_config::observer_image,str.str());
}
case SELECTED_TERRAIN: {
std::map<TYPE, std::string>::const_iterator it =
report_contents.find(SELECTED_TERRAIN);
if (it != report_contents.end()) {
return report(it->second);
}
else {
return report();
}
}
case EDIT_LEFT_BUTTON_FUNCTION: {
std::map<TYPE, std::string>::const_iterator it =
report_contents.find(EDIT_LEFT_BUTTON_FUNCTION);
if (it != report_contents.end()) {
return report(it->second);
}
else {
return report();
}
}
case REPORT_COUNTDOWN: {
int min;
int sec;
if (current_team.countdown_time() > 0){
sec = current_team.countdown_time() / 1000;
char const *end = naps;
if (current_side != playing_side)
str << span_color(font::GRAY_COLOUR);
else if (sec < 60)
str << "<span foreground=\"#c80000\">";
else if (sec < 120)
str << "<span foreground=\"#c8c800\">";
else
end = "";
min = sec / 60;
str << min << ":";
sec = sec % 60;
if (sec < 10) {
str << "0";
}
str << sec << end;
break;
} // Intentional fall-through to REPORT_CLOCK
// if the time countdown isn't valid.
// If there is no turn time limit,
// then we display the clock instead.
}
case REPORT_CLOCK: {
time_t t = std::time(NULL);
struct tm *lt = std::localtime(&t);
if (lt) {
char temp[10];
size_t s = std::strftime(temp, 10, preferences::clock_format().c_str(), lt);
if(s>0) {
return report(temp);
} else {
return report();
}
} else {
return report();
}
}
default:
assert(false);
break;
}
return report(str.str());
}