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
No known key found for this signature in database
GPG Key ID: 5B472A12F6ECA9F2

View File

@ -55,7 +55,13 @@ Element::Element():
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 ) },
{ "Colour", 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 ) },
{ "Temperature", StructProperty::Float, offsetof(Element, DefaultProperties.temp ) },
{ "HeatConduct", StructProperty::UChar, offsetof(Element, HeatConduct ) },
{ "LatentHeat", StructProperty::UInteger, offsetof(Element, LatentHeat ) },
{ "Description", StructProperty::String, offsetof(Element, Description ) },
{ "State", StructProperty::Removed, 0 },
{ "Properties", StructProperty::Integer, offsetof(Element, Properties ) },
@ -94,7 +99,14 @@ std::vector<StructProperty> const &Element::GetProperties()
{ "HighTemperature", StructProperty::Float, offsetof(Element, HighTemperature ) },
{ "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) {