Skip to content

Commit

Permalink
Do not allow putting events on the (-1, -1) spot
Browse files Browse the repository at this point in the history
Events can no longer be placed on the (-1, -1) spot.
  • Loading branch information
rueter37 committed Nov 26, 2021
1 parent 0b4584a commit 2f50781
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/ui/map/map_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,11 @@ void MapScene::mousePressEvent(QGraphicsSceneMouseEvent *event)
setScale(m_scale*2);
else if (core().layer() == Core::EVENT) // Select tile
{
// Do not allow selecting the (-1, -1) spot
if (cur_x == -1 || cur_y == -1) {
return;
}

m_selecting = true;
m_selectionTile->setVisible(true);
m_selectionTile->setRect(QRectF(QRect(cur_x*core().tileSize(),cur_y*core().tileSize(),
Expand Down Expand Up @@ -620,6 +625,12 @@ void MapScene::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
Q_UNUSED(event)
if (core().layer() != Core::EVENT)
return;

// Do not allow putting events on invalid coordinates
if (cur_x == -1 || cur_y == -1) {
return;
}

std::vector<lcf::rpg::Event>::iterator ev;
for (ev = m_map->events.begin(); ev != m_map->events.end(); ++ev)
{
Expand Down

0 comments on commit 2f50781

Please sign in to comment.