Editor/Palette: mark get_help_string const override

Note that location_palette::get_help_string is not virtual as it does not inherit from editor_palette (where the pure virtual get_help_string is defined) but rather common_palette.
This commit is contained in:
Charles Dang 2024-10-14 00:00:29 -04:00
parent 5a8123669d
commit 44e21859b2
8 changed files with 8 additions and 8 deletions

View file

@ -90,7 +90,7 @@ public:
void swap() override;
virtual std::string get_help_string() = 0;
virtual std::string get_help_string() const = 0;
/** Return the currently selected foreground/background item. */
const Item& selected_fg_item() const { return item_map_.find(selected_fg_item_)->second; }

View file

@ -28,7 +28,7 @@
namespace editor {
std::string item_palette::get_help_string()
std::string item_palette::get_help_string() const
{
return VGETTEXT("Left-click: Place item $item | Right-click to remove", {{ "item", selected_fg_item().name }});
}

View file

@ -39,7 +39,7 @@ public:
virtual void setup(const game_config_view& cfg);
virtual std::string get_help_string();
virtual std::string get_help_string() const override;
private:

View file

@ -74,7 +74,7 @@ public:
void swap() override {}
bool can_swap() { return false; }
virtual std::string get_help_string() { return ""; }
std::string get_help_string() const { return ""; }
/** Return the currently selected item. */
const std::string& selected_item() const { return selected_item_; }

View file

@ -218,7 +218,7 @@ const std::string& terrain_palette::get_id(const t_translation::terrain_code& te
return t_info.id();
}
std::string terrain_palette::get_help_string()
std::string terrain_palette::get_help_string() const
{
std::ostringstream msg;
msg << _("Left-click: ") << map().get_terrain_editor_string(selected_fg_item()) << " | "

View file

@ -47,7 +47,7 @@ public:
const t_translation::terrain_code& selected_fg_item() const;
const t_translation::terrain_code& selected_bg_item() const;
virtual std::string get_help_string();
virtual std::string get_help_string() const override;
private:

View file

@ -28,7 +28,7 @@
namespace editor {
std::string unit_palette::get_help_string() {
std::string unit_palette::get_help_string() const {
return selected_fg_item().type_name();
}

View file

@ -39,7 +39,7 @@ public:
virtual void setup(const game_config_view& cfg);
virtual std::string get_help_string();
virtual std::string get_help_string() const override;
bool supports_swap() { return false; }