Skip to content

Commit

Permalink
allow using C/F for temperature in PROP tool
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Jul 23, 2016
1 parent 8fe78ea commit 2b15024
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/gui/game/PropertyTool.cpp
Expand Up @@ -193,6 +193,13 @@ void PropertyWindow::SetProperty()
std::stringstream buffer(value);
buffer.exceptions(std::stringstream::failbit | std::stringstream::badbit);
buffer >> tool->propValue.Float;
if (properties[property->GetOption().second].Name == "temp" && value.length())
{
if (value.substr(value.length()-1) == "C")
tool->propValue.Float += 273.15;
else if (value.substr(value.length()-1) == "F")
tool->propValue.Float = (tool->propValue.Float-32.0f)*5/9+273.15f;
}
#ifdef DEBUG
std::cout << "Got float value " << tool->propValue.Float << std::endl;
#endif
Expand Down

0 comments on commit 2b15024

Please sign in to comment.