diff options
| author | jacob1 <jfu614@gmail.com> | 2013-05-31 23:53:32 (GMT) |
|---|---|---|
| committer | jacob1 <jfu614@gmail.com> | 2013-05-31 23:53:32 (GMT) |
| commit | b16524292e2d8c640e0e4e0801d5cb4e512e4707 (patch) | |
| tree | c9b6dd2f0c6c253b8f879465ea7e9c4fe9c3d5a0 | |
| parent | 80380bbaa39735e08d42f599bcb3968b5a1a1cd4 (diff) | |
| download | powder-b16524292e2d8c640e0e4e0801d5cb4e512e4707.zip powder-b16524292e2d8c640e0e4e0801d5cb4e512e4707.tar.gz | |
fix bug where you had to start using a tool before setting it's strength
| -rw-r--r-- | src/cat/LuaScriptInterface.cpp | 2 | ||||
| -rw-r--r-- | src/gui/game/GameModel.cpp | 13 | ||||
| -rw-r--r-- | src/gui/game/GameView.cpp | 48 | ||||
| -rw-r--r-- | src/gui/game/GameView.h | 1 |
4 files changed, 33 insertions, 31 deletions
diff --git a/src/cat/LuaScriptInterface.cpp b/src/cat/LuaScriptInterface.cpp index cea5e76..452a14c 100644 --- a/src/cat/LuaScriptInterface.cpp +++ b/src/cat/LuaScriptInterface.cpp @@ -1473,7 +1473,7 @@ int LuaScriptInterface::simulation_ambientAirTemp(lua_State * l) lua_pushnumber(l, luacon_sim->air->ambientAirTemp); return 1; } - int ambientAirTemp = luaL_optint(l, 1, -1); + int ambientAirTemp = luaL_optint(l, 1, 295.15f); luacon_sim->air->ambientAirTemp = ambientAirTemp; return 0; } diff --git a/src/gui/game/GameModel.cpp b/src/gui/game/GameModel.cpp index 5925079..363f275 100644 --- a/src/gui/game/GameModel.cpp +++ b/src/gui/game/GameModel.cpp @@ -304,19 +304,18 @@ void GameModel::BuildMenus() //sim->wtypes[i] } - //Add special sign and prop tools - menuList[SC_TOOL]->AddTool(new SampleTool(this)); - menuList[SC_TOOL]->AddTool(new SignTool()); - menuList[SC_TOOL]->AddTool(new PropertyTool()); - menuList[SC_TOOL]->AddTool(new WindTool(0, "WIND", "Create air movement", 64, 64, 64, "DEFAULT_UI_WIND")); - - //Build menu for simtools + //Build menu for tools for(int i = 0; i < sim->tools.size(); i++) { Tool * tempTool; tempTool = new Tool(i, sim->tools[i]->Name, sim->tools[i]->Description, PIXR(sim->tools[i]->Colour), PIXG(sim->tools[i]->Colour), PIXB(sim->tools[i]->Colour), sim->tools[i]->Identifier); menuList[SC_TOOL]->AddTool(tempTool); } + //Add special sign and prop tools + menuList[SC_TOOL]->AddTool(new WindTool(0, "WIND", "Create air movement", 64, 64, 64, "DEFAULT_UI_WIND")); + menuList[SC_TOOL]->AddTool(new PropertyTool()); + menuList[SC_TOOL]->AddTool(new SignTool()); + menuList[SC_TOOL]->AddTool(new SampleTool(this)); //Add decoration tools to menu menuList[SC_DECO]->AddTool(new DecorationTool(DecorationTool::BlendAdd, "ADD", "Colour blending: Add", 0, 0, 0, "DEFAULT_DECOR_ADD")); diff --git a/src/gui/game/GameView.cpp b/src/gui/game/GameView.cpp index 2044553..6a37551 100644 --- a/src/gui/game/GameView.cpp +++ b/src/gui/game/GameView.cpp @@ -182,6 +182,7 @@ GameView::GameView(): introText(2048), introTextMessage(introTextData), wallBrush(false), + toolBrush(false), doScreenshot(false), recording(false), screenshotIndex(0), @@ -642,13 +643,14 @@ void GameView::NotifyActiveToolsChanged(GameModel * sender) void GameView::NotifyLastToolChanged(GameModel * sender) { if(sender->GetLastTool() && sender->GetLastTool()->GetResolution() == CELL) - { wallBrush = true; - } else - { wallBrush = false; - } + + if (sender->GetLastTool() && sender->GetLastTool()->GetIdentifier().find("DEFAULT_TOOL_") != sender->GetLastTool()->GetIdentifier().npos) + toolBrush = true; + else + toolBrush = false; } void GameView::NotifyToolListChanged(GameModel * sender) @@ -1280,10 +1282,13 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool drawModeReset = false; else drawPoint1 = currentMouse; - if(shift) - drawMode = DrawFill; - else - drawMode = DrawRect; + if (!toolBrush) + { + if(shift) + drawMode = DrawFill; + else + drawMode = DrawRect; + } } enableCtrlBehaviour(); break; @@ -1294,10 +1299,13 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool drawModeReset = false; else drawPoint1 = currentMouse; - if(ctrl) - drawMode = DrawFill; - else - drawMode = DrawLine; + if (!toolBrush) + { + if(ctrl) + drawMode = DrawFill; + else + drawMode = DrawLine; + } } enableShiftBehaviour(); break; @@ -1758,10 +1766,7 @@ void GameView::enableShiftBehaviour() if(!shiftBehaviour) { shiftBehaviour = true; - if(isMouseDown) - { - c->SetToolStrength(10.0f); - } + c->SetToolStrength(10.0f); } } @@ -1806,13 +1811,10 @@ void GameView::enableCtrlBehaviour() searchButton->Appearance.TextInactive = searchButton->Appearance.TextHover = ui::Colour(0, 0, 0); if (currentSaveType == 2) ((SplitButton*)saveSimulationButton)->SetShowSplit(true); - if(isMouseDown) - { - if(!shiftBehaviour) - c->SetToolStrength(.1f); - else - c->SetToolStrength(10.0f); - } + if(!shiftBehaviour) + c->SetToolStrength(.1f); + else + c->SetToolStrength(10.0f); } } diff --git a/src/gui/game/GameView.h b/src/gui/game/GameView.h index 08709df..a347297 100644 --- a/src/gui/game/GameView.h +++ b/src/gui/game/GameView.h @@ -50,6 +50,7 @@ private: bool showHud; bool showDebug; bool wallBrush; + bool toolBrush; int introText; std::string introTextMessage; int toolIndex; |
