Fixed: Internal: resumed resource would lose readonly attribute

This commit is contained in:
ZZYZX 2017-02-09 02:39:32 +02:00
parent 7f2f51d48d
commit 1fb1167e5d
2 changed files with 5 additions and 3 deletions

View file

@ -94,6 +94,7 @@ namespace CodeImp.DoomBuilder.Data
protected bool issuspended;
protected bool isdisposed;
protected bool isreadonly; //mxd
protected bool wasreadonly; // [ZZ]
protected ResourceTextureSet textureset;
#endregion
@ -103,7 +104,7 @@ namespace CodeImp.DoomBuilder.Data
public DataLocation Location { get { return location; } }
public bool IsDisposed { get { return isdisposed; } }
public bool IsSuspended { get { return issuspended; } }
public bool IsReadOnly { get { return isreadonly; } } //mxd
public bool IsReadOnly { get { return (issuspended?wasreadonly:isreadonly); } } //mxd, [ZZ]
public ResourceTextureSet TextureSet { get { return textureset; } }
#endregion
@ -144,6 +145,7 @@ namespace CodeImp.DoomBuilder.Data
// [ZZ] validate
if (issuspended) throw new Exception("Tried to suspend already suspended resource!");
issuspended = true;
wasreadonly = isreadonly;
isreadonly = true;
}
@ -153,7 +155,7 @@ namespace CodeImp.DoomBuilder.Data
// [ZZ] validate
if (!issuspended) throw new Exception("Tried to resume already resumed resource!");
issuspended = false;
isreadonly = false;
isreadonly = wasreadonly;
}
// This reloads the resource (possibly as readonly).

View file

@ -218,7 +218,7 @@ namespace CodeImp.DoomBuilder.Data
// This resumes use of this resource
public override void Resume()
{
Reload(true);
Reload(IsReadOnly);
base.Resume();
}