From bd887c1f2738aa672420c51ab45af02660776d4b Mon Sep 17 00:00:00 2001 From: biwa <6475593+biwa@users.noreply.github.com> Date: Mon, 25 Oct 2021 00:32:10 +0200 Subject: [PATCH] Fixed an issue where thing positions were modified even when the new position was the same as the old one. Fixes #644 --- Source/Core/Map/Thing.cs | 44 +++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/Source/Core/Map/Thing.cs b/Source/Core/Map/Thing.cs index ecd8c524..2925ee26 100755 --- a/Source/Core/Map/Thing.cs +++ b/Source/Core/Map/Thing.cs @@ -422,39 +422,41 @@ namespace CodeImp.DoomBuilder.Map // NOTE: This does not update sector! (call DetermineSector) public void Move(Vector3D newpos) { - BeforePropsChange(); - - // Change position - this.pos = newpos; - - if(type != General.Map.Config.Start3DModeThingType) - General.Map.IsChanged = true; + if (newpos != pos) + { + BeforePropsChange(); + + // Change position + this.pos = newpos; + + if (type != General.Map.Config.Start3DModeThingType) + General.Map.IsChanged = true; + } } // This moves the thing // NOTE: This does not update sector! (call DetermineSector) public void Move(Vector2D newpos) { - BeforePropsChange(); - - // Change position - this.pos = new Vector3D(newpos.x, newpos.y, pos.z); - - if(type != General.Map.Config.Start3DModeThingType) - General.Map.IsChanged = true; + Vector3D p = new Vector3D(newpos.x, newpos.y, pos.z); + + if (p != pos) + { + BeforePropsChange(); + + // Change position + this.pos = p; + + if (type != General.Map.Config.Start3DModeThingType) + General.Map.IsChanged = true; + } } // This moves the thing // NOTE: This does not update sector! (call DetermineSector) public void Move(double x, double y, double zoffset) { - BeforePropsChange(); - - // Change position - this.pos = new Vector3D(x, y, zoffset); - - if(type != General.Map.Config.Start3DModeThingType) - General.Map.IsChanged = true; + Move(new Vector3D(x, y, zoffset)); } // This rotates the thing