Skip to content

Commit

Permalink
Editor: don't make unit type copies in the editor palette
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Jun 28, 2018
1 parent 292d6f4 commit 9e29c2f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/editor/action/mouse/mouse_action_unit.cpp
Expand Up @@ -98,7 +98,7 @@ editor_action* mouse_action_unit::up_left(editor_display& disp, int x, int y)
return nullptr;
}

unit_type type = unit_palette_.selected_fg_item();
const unit_type& type = unit_palette_.selected_fg_item();

// Does this serve a purpose other than making sure the type is built?
// (Calling unit_types.build_unit_type(type) would now accomplish that
Expand Down
2 changes: 1 addition & 1 deletion src/editor/palette/editor_palettes.cpp
Expand Up @@ -330,7 +330,7 @@ void editor_palette<Item>::draw_contents()

// Force compilation of the following template instantiations
template class editor_palette<t_translation::terrain_code>;
template class editor_palette<unit_type>;
template class editor_palette<const unit_type&>;
template class editor_palette<overlay>;

} // end namespace editor
4 changes: 2 additions & 2 deletions src/editor/palette/unit_palette.cpp
Expand Up @@ -97,8 +97,8 @@ void unit_palette::draw_item(const unit_type& u, surface& image, std::stringstre
unit_palette::unit_palette(editor_display &gui, const config& cfg,
editor_toolkit &toolkit)
//TODO avoid magic numbers
: editor_palette<unit_type>(gui, cfg, 36, 4, toolkit),
selected_bg_items_()
: editor_palette<const unit_type&>(gui, cfg, 36, 4, toolkit)
, selected_bg_items_()
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/editor/palette/unit_palette.hpp
Expand Up @@ -29,7 +29,7 @@ class editor_toolkit;
//std::string get_selected_terrain();

/** Palette where the terrain to be drawn can be selected. */
class unit_palette : public editor_palette<unit_type> {
class unit_palette : public editor_palette<const unit_type&> {
public:

unit_palette(editor_display &gui,
Expand Down

0 comments on commit 9e29c2f

Please sign in to comment.