The Battle for Wesnoth  1.17.0-dev
hotkey_handler_sp.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014 - 2021
3  by Chris Beck <render787@gmail.com>
4  Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY.
12 
13  See the COPYING file for more details.
14 */
15 
16 /**
17  * @file
18  * An extension of play_controller::hotkey_handler, which has support for
19  * SP wesnoth features like whiteboard, end turn, etc.
20  */
21 
22 #pragma once
23 
25 
27 
29 
30 protected:
32 
33  std::shared_ptr<wb::manager> whiteboard_manager_;
34 
35  bool is_observer() const;
36 
37 public:
40 
41  virtual void recruit() override;
42  virtual void repeat_recruit() override;
43  virtual void recall() override;
44  virtual bool can_execute_command(const hotkey::hotkey_command& command, int index=-1) const override;
45  virtual void toggle_shroud_updates() override;
46  virtual void update_shroud_now() override;
47  virtual void end_turn() override;
48  virtual void rename_unit() override;
49  virtual void create_unit() override;
50  virtual void change_side() override;
51  virtual void kill_unit() override;
52  virtual void label_terrain(bool) override;
53  virtual void clear_labels() override;
54  virtual void label_settings() override;
55  virtual void continue_move() override;
56  virtual void unit_hold_position() override;
57  virtual void end_unit_turn() override;
58  virtual void user_command() override;
59  virtual void custom_command() override;
60  virtual void ai_formula() override;
61  virtual void clear_messages() override;
62  // Whiteboard hotkeys
63  virtual void whiteboard_toggle() override;
64  virtual void whiteboard_execute_action() override;
65  virtual void whiteboard_execute_all_actions() override;
66  virtual void whiteboard_delete_action() override;
67  virtual void whiteboard_bump_up_action() override;
68  virtual void whiteboard_bump_down_action() override;
69  virtual void whiteboard_suppose_dead() override;
70 
71  //replay
73  {
74  assert(playsingle_controller_.get_replay_controller());
75  return *playsingle_controller_.get_replay_controller();
76  }
77  virtual void stop_replay() override
78  { return get_replay_controller().stop_replay(); }
79  virtual void play_replay() override
80  { return get_replay_controller().play_replay(); }
81  virtual void replay_next_turn() override
83  virtual void replay_next_side() override
85  virtual void replay_next_move() override
87  virtual void replay_show_everything() override
89  virtual void replay_show_each() override
91  virtual void replay_show_team1() override
93  virtual void reset_replay() override
94  { return playsingle_controller_.reset_replay(); }
95  virtual void replay_exit() override;
96  virtual void load_autosave(const std::string& filename) override;
97  virtual hotkey::ACTION_STATE get_action_state(hotkey::HOTKEY_COMMAND command, int index) const override;
98 };
virtual bool can_execute_command(const hotkey::hotkey_command &command, int index=-1) const override
Check if a command can be executed.
virtual void replay_show_everything() override
virtual void toggle_shroud_updates() override
std::shared_ptr< wb::manager > whiteboard_manager_
virtual void load_autosave(const std::string &filename) override
Stores all information related to functions that can be bound to hotkeys.
virtual void whiteboard_suppose_dead() override
This file implements all the hotkey handling and menu details for play controller.
replay_controller * get_replay_controller() const override
virtual hotkey::ACTION_STATE get_action_state(hotkey::HOTKEY_COMMAND command, int index) const override
virtual void whiteboard_bump_down_action() override
std::size_t index(const std::string &str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
Definition: unicode.cpp:72
hotkey_handler(playsingle_controller &, saved_game &)
virtual void whiteboard_bump_up_action() override
virtual void whiteboard_execute_all_actions() override
virtual void whiteboard_delete_action() override
virtual void label_terrain(bool) override
playsingle_controller & playsingle_controller_
virtual void whiteboard_execute_action() override