Move playsingle_controller::get_replay_controller up to remove a dynamic_cast

This commit is contained in:
josteph 2019-06-17 15:22:28 +00:00
parent bf8d5a14d0
commit 4f3b612548
3 changed files with 5 additions and 4 deletions

View file

@ -649,7 +649,7 @@ 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 = pc_.is_replay() && dynamic_cast<playsingle_controller&>(pc_).get_replay_controller()->see_all();
const bool see_all = 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()], see_all);
if(res != units().end()) {

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: