gui: allow specifying resource type in element name

e.g. '<image ...>' instead of '<resource type="image" ...>'

Change-Id: I5ce04ae0845351c8a4640d12e36f1aaf32e1ebc9
diff --git a/gui/resources.cpp b/gui/resources.cpp
index 1e2e7f9..563dcc4 100644
--- a/gui/resources.cpp
+++ b/gui/resources.cpp
@@ -288,17 +288,19 @@
 
 void ResourceManager::LoadResources(xml_node<>* resList, ZipArchive* pZip)
 {
-	xml_node<>* child;
-
 	if (!resList)
 		return;
-	child = resList->first_node("resource");
-	while (child != NULL)
+
+	for (xml_node<>* child = resList->first_node(); child; child = child->next_sibling())
 	{
-		xml_attribute<>* attr = child->first_attribute("type");
+		std::string type = child->name();
+		if (type == "resource") {
+			// legacy format : <resource type="...">
+			xml_attribute<>* attr = child->first_attribute("type");
+			type = attr ? attr->value() : "*unspecified*";
+		}
 
 		bool error = false;
-		std::string type = attr ? attr->value() : "*unspecified*";
 		if (type == "font")
 		{
 			FontResource* res = new FontResource(child, pZip);
@@ -356,8 +358,6 @@
 			} else
 				LOGERR("Resource type (%s) failed to load\n", type.c_str());
 		}
-
-		child = child->next_sibling("resource");
 	}
 }