mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-04-24 16:52:50 +02:00
Fix !set commands defaulting to Kelvin, instead of to current temperature scale
An old hack got deleted that converted values for "temp" to StringType, to force it down the string conversion flow which handles temperature scales. I added that code back.
This commit is contained in:
parent
9c45e99c36
commit
a153b614ea
@ -361,6 +361,21 @@ AnyType CommandInterface::tptS_set(std::deque<String> * words)
|
||||
}
|
||||
auto &propInfo = Particle::GetProperties()[*prop];
|
||||
|
||||
// convert non-string temperature values to strings so format::StringToTemperature can take care of them
|
||||
if (property.Value() == "temp")
|
||||
{
|
||||
switch (value.GetType())
|
||||
{
|
||||
case TypeNumber:
|
||||
value = StringType(String::Build(((NumberType)value).Value()));
|
||||
break;
|
||||
case TypeFloat:
|
||||
value = StringType(String::Build(((FloatType)value).Value()));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
// assume that value can be anything
|
||||
if (value.GetType() == TypeNumber && propInfo.Type == StructProperty::Float)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user