From d755be8ffa5dcc8518d2eb72eec6c05256b41b20 Mon Sep 17 00:00:00 2001 From: Dave White Date: Thu, 6 Nov 2003 18:06:58 +0000 Subject: [PATCH] added show_ai_moves and show_combat options for preferences file --- src/display.cpp | 9 ++++++--- src/playlevel.cpp | 2 ++ src/playturn.cpp | 3 ++- src/preferences.cpp | 10 ++++++++++ src/preferences.hpp | 4 ++++ 5 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/display.cpp b/src/display.cpp index 4961943a0a8..3dcbdc5ca73 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -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; diff --git a/src/playlevel.cpp b/src/playlevel.cpp index aa75f79b2c3..b38f3ede107 100644 --- a/src/playlevel.cpp +++ b/src/playlevel.cpp @@ -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); diff --git a/src/playturn.cpp b/src/playturn.cpp index 8c11d47ca93..2952269c740 100644 --- a/src/playturn.cpp +++ b/src/playturn.cpp @@ -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(); diff --git a/src/preferences.cpp b/src/preferences.cpp index cf8a9cf62ab..621a1602f61 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -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; diff --git a/src/preferences.hpp b/src/preferences.hpp index 3248143bcab..944e16738ea 100644 --- a/src/preferences.hpp +++ b/src/preferences.hpp @@ -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); }