Skip to content
Permalink
Browse files

Fix a few more random PMAPBITS issues

  • Loading branch information...
LBPHacker authored and jacob1 committed Feb 11, 2019
1 parent 240bb3b commit 4ff1dc0bc345940eaee4e17a889cb4ff032eb75b
Showing with 4 additions and 4 deletions.
  1. +3 −3 src/gui/game/GameView.cpp
  2. +1 −1 src/gui/game/SampleTool.cpp
@@ -715,7 +715,7 @@ void GameView::NotifyActiveToolsChanged(GameModel * sender)
if (!active->GetIdentifier().Contains("_PT_"))
ren->findingElement = 0;
else
ren->findingElement = sender->GetActiveTool(0)->GetToolID()%256;
ren->findingElement = sender->GetActiveTool(0)->GetToolID() & ((1 << PMAPBITS) - 1);
}
}

@@ -1509,10 +1509,10 @@ void GameView::OnKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl,
if (ctrl)
{
Tool *active = c->GetActiveTool(0);
if (!active->GetIdentifier().Contains("_PT_") || ren->findingElement == active->GetToolID()%256)
if (!active->GetIdentifier().Contains("_PT_") || (ren->findingElement == (active->GetToolID() & ((1 << PMAPBITS) - 1))))
ren->findingElement = 0;
else
ren->findingElement = active->GetToolID()%256;
ren->findingElement = active->GetToolID() & ((1 << PMAPBITS) - 1);
}
else
c->FrameStep();
@@ -54,7 +54,7 @@ void SampleTool::Draw(Simulation * sim, Brush * brush, ui::Point position)
for(std::vector<Tool*>::iterator iter = elementTools.begin(), end = elementTools.end(); iter != end; ++iter)
{
Tool * elementTool = *iter;
if(elementTool && elementTool->GetToolID()/256 == particleCtype)
if(elementTool && (elementTool->GetToolID() >> PMAPBITS) == particleCtype)
gameModel->SetActiveTool(0, elementTool);
}
}

0 comments on commit 4ff1dc0

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.