Fixed editable item properties not being saved if the property is also marked with a non-saveable HasDefaultValue attribute

This commit is contained in:
Regalis
2017-01-07 14:37:03 +02:00
parent a2d6b4890e
commit a5f0d1d7da

View File

@@ -258,14 +258,13 @@ namespace Barotrauma
if (!saveIfDefault)
{
//only save
// - if the attribute is saveable
// - and it's different from the default value or can be changed in the editor
// - if the attribute is saveable and it's different from the default value
// - or can be changed in the editor
bool save = false;
foreach (var attribute in property.Attributes.OfType<HasDefaultValue>())
{
if (!attribute.isSaveable) continue;
if (!attribute.defaultValue.Equals(value) || property.Attributes.OfType<Editable>().Any())
if ((!attribute.isSaveable && !attribute.defaultValue.Equals(value)) ||
property.Attributes.OfType<Editable>().Any())
{
save = true;
break;