]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Allow loading attributes
authorMattia Basaglia <mattia.basaglia@gmail.com>
Mon, 24 Nov 2014 16:54:03 +0000 (17:54 +0100)
committerMattia Basaglia <mattia.basaglia@gmail.com>
Mon, 24 Nov 2014 16:54:03 +0000 (17:54 +0100)
svvm_cmds.c
xml.c
xml.h

index 16d91e9cf2484beeaf8980cf1b8374d2527f7e6a..84338c8301faa1a9a2289b785f9f637d02c88d19 100644 (file)
@@ -3320,7 +3320,7 @@ VM_xml_tree_has_sibling,          // #135
 VM_xml_tree_next,                              // #136
 VM_xml_tree_type,                              // #137
 VM_xml_tree_root,                              // #138
-NULL,                                                  // #139
+VM_xml_tree_attribute,                 // #139
 NULL,                                                  // #140
 NULL,                                                  // #141
 NULL,                                                  // #142
diff --git a/xml.c b/xml.c
index 24ae92f9090de60f2e3e6eb28d90d7b8b8275acc..20cf0d7b59f31a0aadae7c5321cd3800717eb380 100644 (file)
--- a/xml.c
+++ b/xml.c
@@ -244,4 +244,17 @@ void VM_xml_tree_root(prvm_prog_t *prog)
        if ( !xml )
                return;
        xml->node = xmlDocGetRootElement(xml->doc);
+}
+
+void VM_xml_tree_attribute(prvm_prog_t *prog)
+{
+       qxml_p xml;
+       VM_XML_CHECK_RETURN(VM_xml_tree_type, PRVM_G_FLOAT(OFS_RETURN) = 0);
+       if ( !xml->attribute && xml->node->properties )
+       {
+               PRVM_G_FLOAT(OFS_RETURN) = 1;
+               xml->attribute = xml->node->properties;
+       }
+       else
+               PRVM_G_FLOAT(OFS_RETURN) = 0;
 }
\ No newline at end of file
diff --git a/xml.h b/xml.h
index e0155cd6db222f403f2f67e0ac472c3b07c59ad3..da9702dbc16b545f5b8127c166e4228d3847367c 100644 (file)
--- a/xml.h
+++ b/xml.h
@@ -14,6 +14,7 @@ void VM_xml_tree_has_sibling(prvm_prog_t *prog);
 void VM_xml_tree_next(prvm_prog_t *prog);
 void VM_xml_tree_type(prvm_prog_t *prog);
 void VM_xml_tree_root(prvm_prog_t *prog);
+void VM_xml_tree_attribute(prvm_prog_t *prog);
 
 void XML_Close(prvm_prog_t *prog, int index);