Make sample tool sample different life types. Fixes #184
This commit is contained in:
parent
44c55fbd45
commit
f7f51d5045
@ -30,16 +30,38 @@ void SampleTool::Draw(Simulation * sim, Brush * brush, ui::Point position)
|
||||
else
|
||||
{
|
||||
int particleType = 0;
|
||||
int particleCtype = 0;
|
||||
if(sim->pmap[position.Y][position.X])
|
||||
{
|
||||
particleType = sim->parts[sim->pmap[position.Y][position.X]>>8].type;
|
||||
particleCtype = sim->parts[sim->pmap[position.Y][position.X]>>8].ctype;
|
||||
}
|
||||
else if(sim->photons[position.Y][position.X])
|
||||
{
|
||||
particleType = sim->parts[sim->photons[position.Y][position.X]>>8].type;
|
||||
particleCtype = sim->parts[sim->pmap[position.Y][position.X]>>8].ctype;
|
||||
}
|
||||
|
||||
if(particleType)
|
||||
{
|
||||
Tool * elementTool = gameModel->GetElementTool(particleType);
|
||||
if(elementTool)
|
||||
gameModel->SetActiveTool(0, elementTool);
|
||||
if(particleType == PT_LIFE)
|
||||
{
|
||||
Menu * lifeMenu = gameModel->GetMenuList()[SC_LIFE];
|
||||
std::vector<Tool*> elementTools = lifeMenu->GetToolList();
|
||||
|
||||
for(std::vector<Tool*>::iterator iter = elementTools.begin(), end = elementTools.end(); iter != end; ++iter)
|
||||
{
|
||||
Tool * elementTool = *iter;
|
||||
if(elementTool && elementTool->GetToolID() == particleCtype)
|
||||
gameModel->SetActiveTool(0, elementTool);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Tool * elementTool = gameModel->GetElementTool(particleType);
|
||||
if(elementTool)
|
||||
gameModel->SetActiveTool(0, elementTool);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user