Merge pull request #4119 from jostephd/replay-fogged-unit-description

Make it possible to use the "unit description" command in replay mode on fogged/shrouded units.
This commit is contained in:
jostephd 2019-06-22 17:25:55 +00:00 committed by GitHub
commit e9fcce6a19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 13 additions and 5 deletions

View file

@ -649,13 +649,14 @@ void menu_handler::rename_unit()
unit_map::iterator menu_handler::current_unit()
{
const mouse_handler& mousehandler = pc_.get_mouse_handler_base();
const bool see_all = gui_->show_everything() || (pc_.is_replay() && pc_.get_replay_controller()->see_all());
unit_map::iterator res = board().find_visible_unit(mousehandler.get_last_hex(), teams()[gui_->viewing_team()]);
unit_map::iterator res = board().find_visible_unit(mousehandler.get_last_hex(), teams()[gui_->viewing_team()], see_all);
if(res != units().end()) {
return res;
}
return board().find_visible_unit(mousehandler.get_selected_hex(), teams()[gui_->viewing_team()]);
return board().find_visible_unit(mousehandler.get_selected_hex(), teams()[gui_->viewing_team()], see_all);
}
// Helpers for create_unit()

View file

@ -34,6 +34,7 @@ class game_data;
class team;
class unit;
class replay;
class replay_controller;
class saved_game;
struct mp_game_settings;
class game_classification;
@ -224,7 +225,8 @@ public:
class hotkey_handler;
virtual bool is_replay() { return false; }
virtual replay_controller * get_replay_controller() const { return nullptr; }
bool is_replay() const { return get_replay_controller() != nullptr; }
t_string get_scenario_name() const
{

View file

@ -59,8 +59,7 @@ public:
bool get_player_type_changed() const { return player_type_changed_; }
void set_player_type_changed() { player_type_changed_ = true; }
virtual bool should_return_to_play_side() const override;
replay_controller * get_replay_controller() { return replay_controller_.get(); }
bool is_replay() override { return get_replay_controller() != nullptr; }
replay_controller * get_replay_controller() const override { return replay_controller_.get(); }
void enable_replay(bool is_unit_test = false);
void on_replay_end(bool is_unit_test);
protected:

View file

@ -380,3 +380,8 @@ void replay_controller::update_viewing_player()
assert(vision_);
controller_.update_gui_to_player(vision_ == HUMAN_TEAM ? controller_.gamestate().first_human_team_ : controller_.current_side() - 1, *vision_ == SHOW_ALL);
}
bool replay_controller::see_all()
{
return vision_ == SHOW_ALL;
}

View file

@ -56,6 +56,7 @@ public:
void replay_show_team1();
void update_teams();
void update_viewing_player();
bool see_all();
private:
void add_replay_theme();
void init();