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