fix bug where you had to start using a tool before setting it's strength

This commit is contained in:
jacob1 2013-05-31 19:53:32 -04:00
parent 80380bbaa3
commit b16524292e
4 changed files with 33 additions and 31 deletions

View File

@ -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;
}

View File

@ -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"));

View File

@ -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);
}
}

View File

@ -50,6 +50,7 @@ private:
bool showHud;
bool showDebug;
bool wallBrush;
bool toolBrush;
int introText;
std::string introTextMessage;
int toolIndex;