Limit access to the LatentHeat property to LATENTHEAT builds

This commit is contained in:
Tamás Bálint Misius
2023-12-09 00:38:12 +01:00
parent 78314a8f7d
commit e64c23d50d

View File

@@ -55,7 +55,13 @@ Element::Element():
std::vector<StructProperty> const &Element::GetProperties() std::vector<StructProperty> const &Element::GetProperties()
{ {
static std::vector<StructProperty> properties = { struct DoOnce
{
std::vector<StructProperty> properties;
DoOnce()
{
properties = {
{ "Name", StructProperty::String, offsetof(Element, Name ) }, { "Name", StructProperty::String, offsetof(Element, Name ) },
{ "Colour", StructProperty::Colour, offsetof(Element, Colour ) }, { "Colour", StructProperty::Colour, offsetof(Element, Colour ) },
{ "Color", StructProperty::Colour, offsetof(Element, Colour ) }, { "Color", StructProperty::Colour, offsetof(Element, Colour ) },
@@ -81,7 +87,6 @@ std::vector<StructProperty> const &Element::GetProperties()
{ "Weight", StructProperty::Integer, offsetof(Element, Weight ) }, { "Weight", StructProperty::Integer, offsetof(Element, Weight ) },
{ "Temperature", StructProperty::Float, offsetof(Element, DefaultProperties.temp ) }, { "Temperature", StructProperty::Float, offsetof(Element, DefaultProperties.temp ) },
{ "HeatConduct", StructProperty::UChar, offsetof(Element, HeatConduct ) }, { "HeatConduct", StructProperty::UChar, offsetof(Element, HeatConduct ) },
{ "LatentHeat", StructProperty::UInteger, offsetof(Element, LatentHeat ) },
{ "Description", StructProperty::String, offsetof(Element, Description ) }, { "Description", StructProperty::String, offsetof(Element, Description ) },
{ "State", StructProperty::Removed, 0 }, { "State", StructProperty::Removed, 0 },
{ "Properties", StructProperty::Integer, offsetof(Element, Properties ) }, { "Properties", StructProperty::Integer, offsetof(Element, Properties ) },
@@ -94,7 +99,14 @@ std::vector<StructProperty> const &Element::GetProperties()
{ "HighTemperature", StructProperty::Float, offsetof(Element, HighTemperature ) }, { "HighTemperature", StructProperty::Float, offsetof(Element, HighTemperature ) },
{ "HighTemperatureTransition", StructProperty::TransitionType, offsetof(Element, HighTemperatureTransition) } { "HighTemperatureTransition", StructProperty::TransitionType, offsetof(Element, HighTemperatureTransition) }
}; };
return properties; if constexpr (LATENTHEAT)
{
properties.push_back({ "LatentHeat", StructProperty::UInteger, offsetof(Element, LatentHeat) });
}
}
};
static DoOnce doOnce;
return doOnce.properties;
} }
int Element::legacyUpdate(UPDATE_FUNC_ARGS) { int Element::legacyUpdate(UPDATE_FUNC_ARGS) {