From a98eea641aa678a7853ddf33620a0a4aeff118d6 Mon Sep 17 00:00:00 2001
From: MaxED <j.maxed@gmail.com>
Date: Fri, 7 Aug 2015 21:32:51 +0000
Subject: [PATCH] Fixed, UDMF: the implementation of "moreids" property was
 different from UDMF standard. This issue affected only linedefs and sectors
 with more than 2 tags.

---
 Source/Core/IO/UniversalStreamReader.cs | 6 ++++--
 Source/Core/IO/UniversalStreamWriter.cs | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Source/Core/IO/UniversalStreamReader.cs b/Source/Core/IO/UniversalStreamReader.cs
index d052cbc59..786a6dab0 100644
--- a/Source/Core/IO/UniversalStreamReader.cs
+++ b/Source/Core/IO/UniversalStreamReader.cs
@@ -246,7 +246,7 @@ namespace CodeImp.DoomBuilder.IO
 
 			// Go for all lines
 			map.SetCapacity(0, map.Linedefs.Count + linescolls.Count, map.Sidedefs.Count + sidescolls.Count, 0, 0);
-			char[] splitter = new[] { ',' }; //mxd
+			char[] splitter = new[] { ' ' }; //mxd
 			for(int i = 0; i < linescolls.Count; i++)
 			{
 				// Read fields
@@ -286,6 +286,7 @@ namespace CodeImp.DoomBuilder.IO
 						}
 					}
 				}
+				if(tag == 0 && tags.Count > 1) tags.RemoveAt(0);
 
 				// Flags
 				Dictionary<string, bool> stringflags = new Dictionary<string, bool>(StringComparer.Ordinal);
@@ -386,7 +387,7 @@ namespace CodeImp.DoomBuilder.IO
 
 			// Go for all collections
 			map.SetCapacity(0, 0, 0, map.Sectors.Count + collections.Count, 0);
-			char[] splitter = new[] { ',' }; //mxd
+			char[] splitter = new[] { ' ' }; //mxd
 			for(int i = 0; i < collections.Count; i++)
 			{
 				// Read fields
@@ -415,6 +416,7 @@ namespace CodeImp.DoomBuilder.IO
 						}
 					}
 				}
+				if(tag == 0 && tags.Count > 1) tags.RemoveAt(0);
 
 				//mxd. Read slopes
 				float fslopex = GetCollectionEntry(c, "floorplane_a", false, 0.0f, where);
diff --git a/Source/Core/IO/UniversalStreamWriter.cs b/Source/Core/IO/UniversalStreamWriter.cs
index c24670ea7..146afeca9 100644
--- a/Source/Core/IO/UniversalStreamWriter.cs
+++ b/Source/Core/IO/UniversalStreamWriter.cs
@@ -202,7 +202,7 @@ namespace CodeImp.DoomBuilder.IO
 					{
 						moreidscol[i - 1] = l.Tags[i].ToString();
 					}
-					coll.Add("moreids", string.Join(",", moreidscol));
+					coll.Add("moreids", string.Join(" ", moreidscol));
 				}
 				
 				// Sidedef references
@@ -289,7 +289,7 @@ namespace CodeImp.DoomBuilder.IO
 					{
 						moreidscol[i - 1] = s.Tags[i].ToString();
 					}
-					coll.Add("moreids", string.Join(",", moreidscol));
+					coll.Add("moreids", string.Join(" ", moreidscol));
 				}
 
 				//mxd. Slopes
-- 
GitLab