Fixed editable item properties not being saved if the property is also marked with a non-saveable HasDefaultValue attribute
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user