diff --git a/src/gui/game/GameView.cpp b/src/gui/game/GameView.cpp index 95be9dd29..873971d40 100644 --- a/src/gui/game/GameView.cpp +++ b/src/gui/game/GameView.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(); diff --git a/src/gui/game/SampleTool.cpp b/src/gui/game/SampleTool.cpp index ca58d686b..d104af614 100644 --- a/src/gui/game/SampleTool.cpp +++ b/src/gui/game/SampleTool.cpp @@ -54,7 +54,7 @@ void SampleTool::Draw(Simulation * sim, Brush * brush, ui::Point position) for(std::vector::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); } }