diff options
| author | jacob1 <jfu614@gmail.com> | 2013-02-09 03:24:34 (GMT) |
|---|---|---|
| committer | jacob1 <jfu614@gmail.com> | 2013-02-09 03:24:34 (GMT) |
| commit | 1359045b14a455c5ee54a7b066e606a3b76368b0 (patch) | |
| tree | e870d360cd4c70338ee0f217361851f1fe947b74 /src/game | |
| parent | b8d53b5f7659f6b95f025a900d3b9982400dcc59 (diff) | |
| download | powder-1359045b14a455c5ee54a7b066e606a3b76368b0.zip powder-1359045b14a455c5ee54a7b066e606a3b76368b0.tar.gz | |
fix tpt.selectedl not updating with sample brush, always put photons[] on top in HUD
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/GameController.cpp | 12 | ||||
| -rw-r--r-- | src/game/GameController.h | 1 | ||||
| -rw-r--r-- | src/game/GameView.cpp | 3 | ||||
| -rw-r--r-- | src/game/SampleTool.cpp | 8 |
4 files changed, 16 insertions, 8 deletions
diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp index efe37c4..9e7978b 100644 --- a/src/game/GameController.cpp +++ b/src/game/GameController.cpp @@ -148,9 +148,9 @@ GameController::GameController(): ((LuaScriptInterface*)commandInterface)->SetWindow(gameView); commandInterface->OnBrushChanged(gameModel->GetBrushID(), gameModel->GetBrush()->GetRadius().X, gameModel->GetBrush()->GetRadius().X); - commandInterface->OnActiveToolChanged(0, gameModel->GetActiveTool(0)); - commandInterface->OnActiveToolChanged(1, gameModel->GetActiveTool(1)); - commandInterface->OnActiveToolChanged(2, gameModel->GetActiveTool(2)); + ActiveToolChanged(0, gameModel->GetActiveTool(0)); + ActiveToolChanged(1, gameModel->GetActiveTool(1)); + ActiveToolChanged(2, gameModel->GetActiveTool(2)); //sim = new Simulation(); Client::Ref().AddListener(this); @@ -930,9 +930,13 @@ std::vector<Menu*> GameController::GetMenuList() return gameModel->GetMenuList(); } -void GameController::SetActiveTool(int toolSelection, Tool * tool) +void GameController::ActiveToolChanged(int toolSelection, Tool *tool) { commandInterface->OnActiveToolChanged(toolSelection, tool); +} + +void GameController::SetActiveTool(int toolSelection, Tool * tool) +{ gameModel->SetActiveTool(toolSelection, tool); gameModel->GetRenderer()->gravityZonesEnabled = false; gameModel->SetLastTool(tool); diff --git a/src/game/GameController.h b/src/game/GameController.h index 4f82243..070d39d 100644 --- a/src/game/GameController.h +++ b/src/game/GameController.h @@ -100,6 +100,7 @@ public: void SetActiveMenu(Menu * menu); std::vector<Menu*> GetMenuList(); void SetActiveTool(int toolSelection, Tool * tool); + void ActiveToolChanged(int toolSelection, Tool *tool); void SetActiveColourPreset(int preset); void SetColour(ui::Colour colour); void SetToolStrength(float value); diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp index 5c7d0be..3e874e2 100644 --- a/src/game/GameView.cpp +++ b/src/game/GameView.cpp @@ -596,14 +596,17 @@ void GameView::NotifyActiveToolsChanged(GameModel * sender) if(sender->GetActiveTool(0) == tool) { toolButtons[i]->SetSelectionState(0); //Primary + c->ActiveToolChanged(0, tool); } else if(sender->GetActiveTool(1) == tool) { toolButtons[i]->SetSelectionState(1); //Secondary + c->ActiveToolChanged(1, tool); } else if(sender->GetActiveTool(2) == tool) { toolButtons[i]->SetSelectionState(2); //Tertiary + c->ActiveToolChanged(2, tool); } else { diff --git a/src/game/SampleTool.cpp b/src/game/SampleTool.cpp index 296167b..bdebee6 100644 --- a/src/game/SampleTool.cpp +++ b/src/game/SampleTool.cpp @@ -31,14 +31,14 @@ void SampleTool::Draw(Simulation * sim, Brush * brush, ui::Point position) { int particleType = 0; int particleCtype = 0; - if(sim->pmap[position.Y][position.X]) + if (sim->photons[position.Y][position.X]) { - particleType = sim->parts[sim->pmap[position.Y][position.X]>>8].type; + particleType = sim->parts[sim->photons[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]) + else if (sim->pmap[position.Y][position.X]) { - particleType = sim->parts[sim->photons[position.Y][position.X]>>8].type; + particleType = sim->parts[sim->pmap[position.Y][position.X]>>8].type; particleCtype = sim->parts[sim->pmap[position.Y][position.X]>>8].ctype; } |
