games-strategy/ufoai: Fix broken use of bundled mxml
[gentoo.git] / games-strategy / ufoai / files / ufoai-2.5.0_p20180603-mxml3.patch
1 From 163073ab9527cdaa33d77a713b8e46ff462a2b5c Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Tam=C3=A1s=20Feh=C3=A9rv=C3=A1ri?=
3  <geever@users.sourceforge.net>
4 Date: Sat, 3 Aug 2019 15:21:05 +0200
5 Subject: [PATCH] * {{Bug|5739}} MiniXML (mxml) 3.x compatibility
6
7 ---
8  src/common/xml.cpp | 7 ++++++-
9  1 file changed, 6 insertions(+), 1 deletion(-)
10
11 diff --git a/src/common/xml.cpp b/src/common/xml.cpp
12 index 7aeceb3a29..5a66ccc887 100644
13 --- a/src/common/xml.cpp
14 +++ b/src/common/xml.cpp
15 @@ -509,8 +509,13 @@ static mxml_type_t mxml_ufo_type_cb (xmlNode_t* node)
16         /* You can lookup attributes and/or use the
17          * element name, hierarchy, etc... */
18         const char* type = mxmlElementGetAttr(node, "type");
19 -       if (type == nullptr)
20 +       if (type == nullptr) {
21 +#ifdef MXML_MAJOR_VERSION
22 +               type = mxmlGetElement(node);
23 +#else
24                 type = node->value.element.name;
25 +#endif
26 +       }
27  
28         if (Q_streq(type, "int"))
29                 return MXML_INTEGER;