Added new end_turn_confirm option: green|yellow|no

This commit is contained in:
uid69097 2004-01-18 14:13:22 +00:00
parent c2bf2916c2
commit ac7df416c0
3 changed files with 30 additions and 4 deletions

View file

@ -785,7 +785,7 @@ void turn_info::end_turn()
return;
// Ask for confirmation if units still have movement left
if(preferences::confirm_end_turn()) {
if(preferences::yellow_confirm()) {
for(unit_map::const_iterator un = units_.begin(); un != units_.end(); ++un) {
if(un->second.side() == team_num_ &&
unit_can_move(un->first,units_,map_,teams_)) {
@ -799,6 +799,21 @@ void turn_info::end_turn()
}
}
}
} else if (preferences::green_confirm()) {
for(unit_map::const_iterator un = units_.begin(); un != units_.end(); ++un) {
if(un->second.side() == team_num_ &&
un->second.movement_left() == un->second.total_movement() &&
unit_can_move(un->first,units_,map_,teams_)) {
const int res = gui::show_dialog(gui_,NULL,"",
string_table["end_turn_message"],
gui::YES_NO);
if (res != 0) {
return;
} else {
break;
}
}
}
}
end_turn_ = true;

View file

@ -814,9 +814,18 @@ void show_hotkeys_dialog (display & disp)
}
bool confirm_end_turn()
bool green_confirm()
{
return prefs["confirm_end_turn"] == "yes";
std::string confirmation = prefs["confirm_end_turn"];
if (confirmation == "green" || confirmation == "yes")
return true;
return false;
}
bool yellow_confirm()
{
return prefs["confirm_end_turn"] == "yellow";
}
}

View file

@ -89,7 +89,9 @@ namespace preferences {
bool show_video_mode_dialog(display& disp);
void show_hotkeys_dialog (display & disp);
bool confirm_end_turn();
// Ask for end turn confirmation
bool yellow_confirm();
bool green_confirm();
}
#endif