Skip to content

Commit

Permalink
Add many missing override annotations
Browse files Browse the repository at this point in the history
This mainly fixes cases caught by -Winconsistent-missing-override,
so there are doubtless still many missing ones.
  • Loading branch information
CelticMinstrel committed Sep 4, 2016
1 parent 39a6726 commit 0b15dfd
Show file tree
Hide file tree
Showing 28 changed files with 329 additions and 335 deletions.
70 changes: 35 additions & 35 deletions src/editor/controller/editor_controller.hpp
Expand Up @@ -98,41 +98,41 @@ class editor_controller : public controller_base,
void custom_tods_dialog();

/** Save the map, open dialog if not named yet. */
void save_map() {context_manager_->save_map();}
void save_map() override {context_manager_->save_map();}

/** command_executor override */
bool can_execute_command(const hotkey::hotkey_command& command, int index = -1) const;
bool can_execute_command(const hotkey::hotkey_command& command, int index = -1) const override;

/** command_executor override */
hotkey::ACTION_STATE get_action_state(hotkey::HOTKEY_COMMAND command, int index) const;
hotkey::ACTION_STATE get_action_state(hotkey::HOTKEY_COMMAND command, int index) const override;

/** command_executor override */
bool execute_command(const hotkey::hotkey_command& command, int index = -1, bool press=true);
bool execute_command(const hotkey::hotkey_command& command, int index = -1, bool press=true) override;

/** controller_base override */
void show_menu(const std::vector<std::string>& items_arg, int xloc, int yloc, bool context_menu, display& disp);
void show_menu(const std::vector<std::string>& items_arg, int xloc, int yloc, bool context_menu, display& disp) override;

void show_help();
void status_table();
void show_help() override;
void status_table() override;

/** Show the preferences dialog */
void preferences();
void preferences() override;

/** Handle hotkeys to scroll map */
void scroll_up(bool on);
void scroll_down(bool on);
void scroll_left(bool on);
void scroll_right(bool on);
void scroll_up(bool on) override;
void scroll_down(bool on) override;
void scroll_left(bool on) override;
void scroll_right(bool on) override;

/** Grid toggle */
void toggle_grid();
void toggle_grid() override;

void terrain_description();
void unit_description();
void terrain_description() override;
void unit_description() override;
void change_unit_id();
void rename_unit();
void rename_unit() override;

void unit_list();
void unit_list() override;

/** Copy the selection on the current map to the clipboard */
void copy_selection();
Expand All @@ -152,25 +152,25 @@ class editor_controller : public controller_base,
void add_area();

/* mouse_handler_base overrides */
void mouse_motion(int x, int y, const bool browse, bool update, map_location new_loc = map_location::null_location());
editor_display& gui() { return *gui_; }
const editor_display& gui() const { return *gui_; }
bool allow_mouse_wheel_scroll(int x, int y);
bool right_click_show_menu(int x, int y, const bool browse);
bool left_click(int x, int y, const bool browse);
void left_drag_end(int x, int y, const bool browse);
void left_mouse_up(int x, int y, const bool browse);
bool right_click(int x, int y, const bool browse);
void right_drag_end(int x, int y, const bool browse);
void right_mouse_up(int x, int y, const bool browse);

virtual hotkey::command_executor * get_hotkey_command_executor();
void mouse_motion(int x, int y, const bool browse, bool update, map_location new_loc = map_location::null_location()) override;
editor_display& gui() override { return *gui_; }
const editor_display& gui() const override { return *gui_; }
bool allow_mouse_wheel_scroll(int x, int y) override;
bool right_click_show_menu(int x, int y, const bool browse) override;
bool left_click(int x, int y, const bool browse) override;
void left_drag_end(int x, int y, const bool browse) override;
void left_mouse_up(int x, int y, const bool browse) override;
bool right_click(int x, int y, const bool browse) override;
void right_drag_end(int x, int y, const bool browse) override;
void right_mouse_up(int x, int y, const bool browse) override;

virtual hotkey::command_executor * get_hotkey_command_executor() override;

protected:
/* controller_base overrides */
void process_keyup_event(const SDL_Event& event);
mouse_handler_base& get_mouse_handler_base() { return *this; }
editor_display& get_display() { return *gui_; }
void process_keyup_event(const SDL_Event& event) override;
mouse_handler_base& get_mouse_handler_base() override { return *this; }
editor_display& get_display() override { return *gui_; }

/** Get the current mouse action */
mouse_action* get_mouse_action();
Expand Down Expand Up @@ -216,12 +216,12 @@ class editor_controller : public controller_base,
/**
* Undos an action in the current map context
*/
void undo();
void undo() override;

/**
* Redos an action in the current map context
*/
void redo();
void redo() override;

editor::menu_type active_menu_;

Expand Down
42 changes: 21 additions & 21 deletions src/editor/palette/editor_palettes.hpp
Expand Up @@ -53,30 +53,30 @@ class editor_palette : public tristate_palette {



virtual sdl_handler_vector handler_members();
virtual sdl_handler_vector handler_members() override;

void set_start_item(size_t index) { items_start_ = index; }
void set_start_item(size_t index) override { items_start_ = index; }

size_t start_num(void) { return items_start_; }
size_t start_num(void) override { return items_start_; }

/** Menu expanding for palette group list */
void expand_palette_groups_menu(std::vector< std::pair<std::string, std::string> >& items);
void expand_palette_groups_menu(std::vector<std::string>& items);
void expand_palette_groups_menu(std::vector< std::pair<std::string, std::string> >& items) override;
void expand_palette_groups_menu(std::vector<std::string>& items) override;

void set_group(size_t index);
void set_group(size_t index) override;
// int active_group();

const std::vector<item_group>& get_groups() const { return groups_; }
const std::vector<item_group>& get_groups() const override { return groups_; }

virtual void draw() {
virtual void draw() override {
widget::draw();
}
virtual void draw_contents();
virtual void draw_contents() override;

void next_group() {
void next_group() override {
set_group( (active_group_index() +1) % (groups_.size()) );
}
void prev_group() {
void prev_group() override {
set_group( (active_group_index() -1) % (groups_.size()) );
}

Expand All @@ -85,14 +85,14 @@ class editor_palette : public tristate_palette {
*
* Use if the size_specs have changed.
*/
void adjust_size(const SDL_Rect& target);
void adjust_size(const SDL_Rect& target) override;

virtual bool scroll_up();
virtual bool can_scroll_up();
virtual bool scroll_down();
virtual bool can_scroll_down();
virtual bool scroll_up() override;
virtual bool can_scroll_up() override;
virtual bool scroll_down() override;
virtual bool can_scroll_down() override;

void swap();
void swap() override;

virtual std::string get_help_string() = 0;

Expand Down Expand Up @@ -123,12 +123,12 @@ class editor_palette : public tristate_palette {
virtual bool is_selected_bg_item(const std::string& id);

/** Return the number of items in the palette. */
int num_items();
int num_items() override;

/** Return the number of items in the palette. */
int num_visible_items() { return buttons_.size(); }

void hide(bool hidden) {
void hide(bool hidden) override {
widget::hide(hidden);
if (!hidden)
help_handle_ = gui_.video().set_help_string(get_help_string());
Expand All @@ -149,8 +149,8 @@ class editor_palette : public tristate_palette {
const std::vector<std::string>& active_group() { return group_map_[active_group_]; }

/** Select a foreground item. */
virtual void select_fg_item(const std::string& item_id);
virtual void select_bg_item(const std::string& item_id);
virtual void select_fg_item(const std::string& item_id) override;
virtual void select_bg_item(const std::string& item_id) override;

/**
* The editor_groups as defined in editor-groups.cfg.
Expand Down
36 changes: 18 additions & 18 deletions src/editor/palette/empty_palette.hpp
Expand Up @@ -35,16 +35,16 @@ class empty_palette : public common_palette {
//event handling
virtual bool mouse_click() { return false;}

virtual bool scroll_up() { return false;}
virtual bool can_scroll_up() { return false;}
virtual bool scroll_down() { return false;}
virtual bool can_scroll_down() { return false;}
virtual bool scroll_up() override { return false;}
virtual bool can_scroll_up() override { return false;}
virtual bool scroll_down() override { return false;}
virtual bool can_scroll_down() override { return false;}

//drawing
virtual void adjust_size(const SDL_Rect& /*target*/) {}
virtual void draw() {}
virtual void adjust_size(const SDL_Rect& /*target*/) override {}
virtual void draw() override {}

void hide(bool hidden) {
void hide(bool hidden) override {
if (!hidden) {
std::shared_ptr<gui::button> upscroll_button = gui_.find_action_button("upscroll-button-editor");
upscroll_button->enable(false);
Expand All @@ -66,21 +66,21 @@ class empty_palette : public common_palette {
std::vector<gui::widget>* get_widgets() { return nullptr; }

//group
virtual void set_group(size_t /*index*/) {}
virtual void next_group() {}
virtual void prev_group() {}
virtual const std::vector<item_group>& get_groups() const { return empty_; }
virtual void set_group(size_t /*index*/) override {}
virtual void next_group() override {}
virtual void prev_group() override {}
virtual const std::vector<item_group>& get_groups() const override { return empty_; }

/** Menu expanding for palette group list */
virtual void expand_palette_groups_menu(std::vector< std::pair< std::string, std::string> >& /*items*/) {}
virtual void expand_palette_groups_menu(std::vector< std::string> & /*items*/) {}
virtual void expand_palette_groups_menu(std::vector< std::pair< std::string, std::string> >& /*items*/) override {}
virtual void expand_palette_groups_menu(std::vector< std::string> & /*items*/) override {}

//item
virtual int num_items() {return 0;}
virtual size_t start_num() {return 0;}
virtual void set_start_item(size_t /*index*/) {}
virtual bool supports_swap() { return false; }
virtual void swap() {}
virtual int num_items() override {return 0;}
virtual size_t start_num() override {return 0;}
virtual void set_start_item(size_t /*index*/) override {}
virtual bool supports_swap() override { return false; }
virtual void swap() override {}

private:
display& gui_;
Expand Down
2 changes: 1 addition & 1 deletion src/editor/palette/location_palette.cpp
Expand Up @@ -118,7 +118,7 @@ class location_palette_item : public gui::widget
{
state_.selected = selected;
}
void draw() { gui::widget::draw(); }
void draw() override { gui::widget::draw(); }
private:
std::string id_;
std::string desc_;
Expand Down
22 changes: 11 additions & 11 deletions src/editor/palette/location_palette.hpp
Expand Up @@ -30,11 +30,11 @@ class location_palette : public common_palette {
location_palette(editor_display &gui, const config& /*cfg*/, mouse_action** active_mouse_action);


virtual sdl_handler_vector handler_members();
virtual sdl_handler_vector handler_members() override;

void set_start_item(size_t index) { items_start_ = index; }
void set_start_item(size_t index) override { items_start_ = index; }

size_t start_num(void) { return items_start_; }
size_t start_num(void) override { return items_start_; }

/** Menu expanding for palette group list */
void expand_palette_groups_menu(std::vector< std::pair<std::string, std::string> >&) override {}
Expand All @@ -45,22 +45,22 @@ class location_palette : public common_palette {
virtual void prev_group() override {}
virtual const std::vector<item_group>& get_groups() const override { static const std::vector<item_group> empty; return empty; }

virtual void draw() {
virtual void draw() override {
widget::draw();
}
virtual void draw_contents();
virtual void draw_contents() override;

/**
* Update the size of this widget.
*
* Use if the size_specs have changed.
*/
void adjust_size(const SDL_Rect& target);
void adjust_size(const SDL_Rect& target) override;

virtual bool scroll_up();
virtual bool can_scroll_up();
virtual bool scroll_down();
virtual bool can_scroll_down();
virtual bool scroll_up() override;
virtual bool can_scroll_up() override;
virtual bool scroll_down() override;
virtual bool can_scroll_down() override;

void swap() override {}
bool can_swap() { return false; }
Expand All @@ -87,7 +87,7 @@ class location_palette : public common_palette {
virtual bool is_selected_item(const std::string& id);

/** Return the number of items in the palette. */
int num_items();
int num_items() override;
/** Return the maximum number of items shown at the same time. */
int num_visible_items();
protected:
Expand Down
8 changes: 4 additions & 4 deletions src/editor/palette/tristate_button.hpp
Expand Up @@ -53,7 +53,7 @@ class tristate_button : public widget
void set_label(const std::string& val);

bool hit(int x, int y) const;
virtual void enable(bool new_val=true);
virtual void enable(bool new_val=true) override;
void release();

void set_item_image(
Expand All @@ -66,18 +66,18 @@ class tristate_button : public widget
item_id_ = id;
}

void draw() {
void draw() override {
widget::draw();
}

protected:

virtual void handle_event(const SDL_Event& event);
virtual void handle_event(const SDL_Event& event) override;
virtual void mouse_motion(const SDL_MouseMotionEvent& event);
virtual void mouse_down(const SDL_MouseButtonEvent& event);
virtual void mouse_up(const SDL_MouseButtonEvent& event);

virtual void draw_contents();
virtual void draw_contents() override;

private:

Expand Down
12 changes: 6 additions & 6 deletions src/game_initialization/multiplayer_ui.hpp
Expand Up @@ -100,7 +100,7 @@ class ui : public gui::widget, private events::chat_handler, private font::float
* The methodes hide_children and layout_children are supposed to be
* overridden by subclasses of this class which add new sub-widgets.
*/
void set_location(const SDL_Rect& rect);
void set_location(const SDL_Rect& rect) override;
using widget::set_location;
const std::vector<std::string>& user_list() const { return user_list_; }
void send_to_server(const config& cfg) override;
Expand All @@ -124,18 +124,18 @@ class ui : public gui::widget, private events::chat_handler, private font::float
*/
const config& game_config() const;

virtual void draw_contents();
virtual void draw_contents() override;

virtual void process_event();
virtual void process_event() override;

virtual void handle_event(const SDL_Event& event);
virtual void handle_event(const SDL_Event& event) override;
virtual void handle_key_event(const SDL_KeyboardEvent& event);

/** Override chat_handler. */
void add_chat_message(const time_t& time, const std::string& speaker,
int side, const std::string& message,
events::chat_handler::MESSAGE_TYPE type=events::chat_handler::MESSAGE_PRIVATE);
void send_chat_message(const std::string& message, bool allies_only=false);
events::chat_handler::MESSAGE_TYPE type=events::chat_handler::MESSAGE_PRIVATE) override;
void send_chat_message(const std::string& message, bool allies_only=false) override;

/** Process chat messages. */
void process_message(const config& msg, const bool whisper=false);
Expand Down

0 comments on commit 0b15dfd

Please sign in to comment.