Permalink
Browse files

allow using C/F for temperature in PROP tool

  • Loading branch information...
jacob1 committed Jul 23, 2016
1 parent 8fe78ea commit 2b150248184ccd365d85b60ac10f9b60ee6fd238
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/gui/game/PropertyTool.cpp
@@ -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

0 comments on commit 2b15024

Please sign in to comment.