Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TMX custom string properties with newlines are not properly handled #45

Closed
Metraberryy opened this issue Nov 13, 2024 · 1 comment · Fixed by #59
Closed

TMX custom string properties with newlines are not properly handled #45

Metraberryy opened this issue Nov 13, 2024 · 1 comment · Fixed by #59
Labels
bug Something isn't working ready In the dev branch, but not yet on master (not available as a package)

Comments

@Metraberryy
Copy link
Contributor

I have a custom string property on an object
When the string is only one line, it has a value property as the parser expects:

<properties>
  <property name="Text" value="test"/>
</properties>

but when I add a newline in Tiled, the string becomes content of the tag:

<properties>
  <property name="Text">test
text</property>
</properties>

and an exception is thrown when DotTiled tries to parse it:

Unhandled exception. System.Xml.XmlException: value attribute is required
   at DotTiled.Serialization.Tmx.ExtensionsXmlReader.GetRequiredAttribute(XmlReader reader, String attribute)
   at DotTiled.Serialization.Tmx.TmxReaderBase.<ReadProperties>b__33_0(XmlReader r)
   at DotTiled.Serialization.Tmx.ExtensionsXmlReader.ReadList[T](XmlReader reader, String wrapper, String elementName, Func`2 readElement)
   at DotTiled.Serialization.Tmx.TmxReaderBase.ReadProperties()
   at DotTiled.Serialization.Tmx.TmxReaderBase.<>c__DisplayClass19_0.<ReadObject>b__1()
   at DotTiled.Serialization.Tmx.ExtensionsXmlReader.ProcessChildren(XmlReader reader, String wrapper, Func`3 getProcessAction)
   at DotTiled.Serialization.Tmx.TmxReaderBase.ReadObject()
   at DotTiled.Serialization.Tmx.TmxReaderBase.<>c__DisplayClass18_0.<ReadObjectLayer>b__3()  
   at DotTiled.Serialization.Tmx.ExtensionsXmlReader.ProcessChildren(XmlReader reader, String wrapper, Func`3 getProcessAction)
   at DotTiled.Serialization.Tmx.TmxReaderBase.ReadObjectLayer()
   at DotTiled.Serialization.Tmx.TmxReaderBase.<>c__DisplayClass17_0.<ReadMap>b__8()
   at DotTiled.Serialization.Tmx.ExtensionsXmlReader.ProcessChildren(XmlReader reader, String wrapper, Func`3 getProcessAction)
   at DotTiled.Serialization.Tmx.TmxReaderBase.ReadMap()
   at DotTiled.Serialization.Tmx.TmxMapReader.ReadMap()
   at DotTiled.Serialization.MapReader.ReadMap()
   at DotTiled.Serialization.Loader.LoadMap(String mapPath)
@dcronqvist
Copy link
Owner

Nice find! Currently away on vacation but will take a look in a few days :)

@dcronqvist dcronqvist added the bug Something isn't working label Nov 16, 2024
@dcronqvist dcronqvist linked a pull request Nov 17, 2024 that will close this issue
6 tasks
@dcronqvist dcronqvist added the ready In the dev branch, but not yet on master (not available as a package) label Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ready In the dev branch, but not yet on master (not available as a package)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants