From 2b150248184ccd365d85b60ac10f9b60ee6fd238 Mon Sep 17 00:00:00 2001 From: jacob1 Date: Sat, 23 Jul 2016 12:15:49 -0400 Subject: [PATCH] allow using C/F for temperature in PROP tool --- src/gui/game/PropertyTool.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/game/PropertyTool.cpp b/src/gui/game/PropertyTool.cpp index ec53819ff..33178e2e3 100644 --- a/src/gui/game/PropertyTool.cpp +++ b/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