From: Mattia Basaglia Date: Mon, 24 Nov 2014 16:54:03 +0000 (+0100) Subject: Allow loading attributes X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=687eeb015b72c115957f4b7f342e9d0bb9a45a5f;p=xonotic%2Fdarkplaces.git Allow loading attributes --- diff --git a/svvm_cmds.c b/svvm_cmds.c index 16d91e9c..84338c83 100644 --- a/svvm_cmds.c +++ b/svvm_cmds.c @@ -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 24ae92f9..20cf0d7b 100644 --- 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 e0155cd6..da9702db 100644 --- 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);