mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2025-03-13 06:02:38 +00:00
Fixed several cases when sector/linedef tag changes were incorrectly recorded by undo system.
This commit is contained in:
parent
972d55f066
commit
6a660c7d45
3 changed files with 22 additions and 14 deletions
|
@ -3542,18 +3542,20 @@ namespace CodeImp.DoomBuilder.Map
|
|||
{
|
||||
//mxd. Multiple tags support...
|
||||
bool changed = false;
|
||||
for(int i = 0; i < s.Tags.Count; i++)
|
||||
// Make a copy of tags, otherwise BeforePropsChange will be triggered after tag changes
|
||||
List<int> tags = new List<int>(s.Tags);
|
||||
for(int i = 0; i < tags.Count; i++)
|
||||
{
|
||||
int tag = s.Tags[i];
|
||||
int tag = tags[i];
|
||||
handler(s, false, UniversalType.SectorTag, ref tag, obj);
|
||||
if(tag != s.Tags[i])
|
||||
if(tag != tags[i])
|
||||
{
|
||||
s.Tags[i] = tag;
|
||||
tags[i] = tag;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(changed) s.Tags = s.Tags.Distinct().ToList();
|
||||
if(changed) s.Tags = tags.Distinct().ToList();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3601,18 +3603,20 @@ namespace CodeImp.DoomBuilder.Map
|
|||
{
|
||||
//mxd. Multiple tags support...
|
||||
bool changed = false;
|
||||
for(int i = 0; i < l.Tags.Count; i++)
|
||||
// Make a copy of tags, otherwise BeforePropsChange will be triggered after tag changes
|
||||
List<int> tags = new List<int>(l.Tags);
|
||||
for(int i = 0; i < tags.Count; i++)
|
||||
{
|
||||
int tag = l.Tags[i];
|
||||
int tag = tags[i];
|
||||
handler(l, false, UniversalType.LinedefTag, ref tag, obj);
|
||||
if(tag != l.Tags[i])
|
||||
if(tag != tags[i])
|
||||
{
|
||||
l.Tags[i] = tag;
|
||||
tags[i] = tag;
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(changed) l.Tags = l.Tags.Distinct().ToList();
|
||||
if(changed) l.Tags = tags.Distinct().ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,8 +129,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Replace
|
||||
if(replace)
|
||||
{
|
||||
l.Tags[index] = replacetag; //mxd
|
||||
l.Tags = l.Tags.Distinct().ToList(); //mxd. We don't want duplicates
|
||||
//mxd. Make a copy of tags, otherwise BeforePropsChange will be triggered after tag changes
|
||||
List<int> tags = new List<int>(l.Tags);
|
||||
tags[index] = replacetag;
|
||||
l.Tags = tags.Distinct().ToList(); // We don't want duplicates
|
||||
}
|
||||
|
||||
// Add to list
|
||||
|
|
|
@ -122,8 +122,10 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
// Replace
|
||||
if(replace)
|
||||
{
|
||||
s.Tags[index] = replacetag; //mxd
|
||||
s.Tags = s.Tags.Distinct().ToList(); //mxd. We don't want duplicates
|
||||
//mxd. Make a copy of tags, otherwise BeforePropsChange will be triggered after tag changes
|
||||
List<int> tags = new List<int>(s.Tags);
|
||||
tags[index] = replacetag;
|
||||
s.Tags = tags.Distinct().ToList(); // We don't want duplicates
|
||||
}
|
||||
|
||||
// Add to list
|
||||
|
|
Loading…
Reference in a new issue