added show_ai_moves and show_combat options for preferences file

This commit is contained in:
Dave White 2003-11-06 18:06:58 +00:00
parent 8adc721d58
commit d755be8ffa
5 changed files with 24 additions and 4 deletions

View file

@ -1759,7 +1759,8 @@ bool display::unit_attack_ranged(const gamemap::location& a,
const gamemap::location& b, int damage,
const attack_type& attack)
{
const bool hide = update_locked() || shrouded(a.x,a.y) && shrouded(b.x,b.y);
const bool hide = update_locked() || shrouded(a.x,a.y) && shrouded(b.x,b.y)
|| preferences::show_combat() == false;
const unit_map::iterator att = units_.find(a);
const unit_map::iterator def = units_.find(b);
@ -1917,7 +1918,8 @@ bool display::unit_attack_ranged(const gamemap::location& a,
void display::unit_die(const gamemap::location& loc, SDL_Surface* image)
{
if(update_locked() || shrouded(loc.x,loc.y))
if(update_locked() || shrouded(loc.x,loc.y)
|| preferences::show_combat() == false)
return;
const unit_map::const_iterator u = units_.find(loc);
@ -1949,7 +1951,8 @@ bool display::unit_attack(const gamemap::location& a,
const gamemap::location& b, int damage,
const attack_type& attack)
{
const bool hide = update_locked() || shrouded(a.x,a.y) && shrouded(b.x,b.y);
const bool hide = update_locked() || shrouded(a.x,a.y) && shrouded(b.x,b.y)
|| preferences::show_combat() == false;
if(!hide) {
const double side_threshhold = 80.0;

View file

@ -205,6 +205,8 @@ LEVEL_RESULT play_level(game_data& gameinfo, config& terrain_config,
const int start_command = recorder.ncommands();
update_locker lock(gui,!preferences::show_ai_moves());
ai::do_move(gui,map,gameinfo,units,teams,
player_number,status);

View file

@ -269,7 +269,8 @@ void turn_info::mouse_motion(const SDL_MouseMotionEvent& event)
const unit_map::iterator un = units_.find(new_hex);
if(un != units_.end() && un->second.side() != team_num_) {
if(un != units_.end() && un->second.side() != team_num_ &&
current_paths_.routes.empty()) {
unit_movement_resetter move_reset(un->second);
const bool ignore_zocs = un->second.type().is_skirmisher();

View file

@ -301,6 +301,16 @@ void set_turn_dialog(bool ison)
prefs["turn_dialog"] = (ison ? "yes" : "no");
}
bool show_combat()
{
return prefs["show_combat"] != "no";
}
bool show_ai_moves()
{
return prefs["show_ai_moves"] != "no";
}
void show_preferences_dialog(display& disp)
{
const events::resize_lock prevent_resizing;

View file

@ -70,6 +70,10 @@ namespace preferences {
bool turn_dialog();
void set_turn_dialog(bool ison);
bool show_combat();
bool show_ai_moves();
void show_preferences_dialog(display& disp);
void show_video_mode_dialog(display& disp);
}