Skip to content

Commit

Permalink
Don't allow changing select mode in object input type (#1845)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkubax10 authored Nov 13, 2021
1 parent 8a0f243 commit cd2401d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/editor/tool_icon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

#include "video/drawing_context.hpp"
#include "video/surface.hpp"
#include "editor/editor.hpp"

ToolIcon::ToolIcon(const std::string& icon) :
m_pos(0, 0),
Expand Down Expand Up @@ -45,6 +46,11 @@ ToolIcon::draw(DrawingContext& context)
void
ToolIcon::next_mode()
{
if (Editor::current()->get_tileselect_input_type() == EditorToolboxWidget::InputType::OBJECT)
{
m_mode = 0;
return;
}
m_mode++;
if (m_mode >= m_surf_count) {
m_mode = 0;
Expand Down
2 changes: 2 additions & 0 deletions src/editor/tool_icon.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class ToolIcon final

int get_mode() const { return m_mode; }

void set_mode(int mode) { m_mode = mode; }

void next_mode();

void push_mode(const std::string& icon);
Expand Down
1 change: 1 addition & 0 deletions src/editor/toolbox_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ EditorToolboxWidget::select_objectgroup(int id)
{
m_active_objectgroup = id;
m_input_type = EditorToolboxWidget::InputType::OBJECT;
m_select_mode->set_mode(0);
m_starting_tile = 0;
update_mouse_icon();
}
Expand Down

0 comments on commit cd2401d

Please sign in to comment.