diff --git a/res/adamantium.xml b/res/adamantium.xml
index 2e2311fcd..2bea686fe 100644
--- a/res/adamantium.xml
+++ b/res/adamantium.xml
@@ -6,8 +6,8 @@
-
-
-
+
+
diff --git a/res/core/resources/laen.xml b/res/core/resources/laen.xml
index 1c14c2eff..95362280f 100644
--- a/res/core/resources/laen.xml
+++ b/res/core/resources/laen.xml
@@ -2,9 +2,9 @@
- -
-
-
+ -
+
+
diff --git a/src/exparse.c b/src/exparse.c
index aca7988fc..d00839283 100644
--- a/src/exparse.c
+++ b/src/exparse.c
@@ -277,7 +277,27 @@ static void XMLCALL start_weapon(parseinfo *pi, const XML_Char *el, const XML_Ch
assert(rtype && rtype->wtype);
if (xml_strcmp(el, "function") == 0) {
- ++pi->errors;
+ const XML_Char *name = NULL, *type = NULL;
+ int i;
+
+ for (i = 0; attr[i]; i += 2) {
+ if (xml_strcmp(attr[i], "name") == 0) {
+ type = attr[i + 1];
+ }
+ else if (xml_strcmp(attr[i], "value") == 0) {
+ name = attr[i + 1];
+ }
+ else {
+ handle_bad_input(pi, el, attr[i]);
+ }
+ }
+ if (type && xml_strcmp(type, "attack") == 0) {
+ pf_generic fun = get_function(name);
+ rtype->wtype->attack = (wtype_attack)fun;
+ }
+ else {
+ handle_bad_input(pi, el, attr[i]);
+ }
}
else if (xml_strcmp(el, "modifier") == 0) {
const XML_Char *type = NULL;
@@ -354,7 +374,7 @@ static void XMLCALL start_weapon(parseinfo *pi, const XML_Char *el, const XML_Ch
mod->race_mask = race_mask;
}
else {
- ++pi->errors;
+ handle_bad_input(pi, el, NULL);
}
}
else if (xml_strcmp(el, "damage") == 0) {
@@ -566,14 +586,14 @@ static void start_resources(parseinfo *pi, const XML_Char *el, const XML_Char **
}
}
}
+ else if (xml_strcmp(el, "modifier") == 0) {
+ handle_modifier(pi, el, attr);
+ }
else if (rtype->itype) {
item_type *itype = rtype->itype;
if (xml_strcmp(el, "construction") == 0) {
itype->construction = parse_construction(pi, el, attr);
}
- else if (xml_strcmp(el, "modifier") == 0) {
- handle_modifier(pi, el, attr);
- }
else if (xml_strcmp(el, "requirement") == 0) {
assert(itype->construction);
handle_requirement(pi, el, attr);
@@ -866,9 +886,6 @@ static void end_weapon(parseinfo *pi, const XML_Char *el) {
nwmods = 0;
}
}
- else {
- handle_bad_input(pi, el, NULL);
- }
}
static void end_resources(parseinfo *pi, const XML_Char *el) {
diff --git a/src/xmlreader.c b/src/xmlreader.c
index 6fc87115a..41b8fef78 100644
--- a/src/xmlreader.c
+++ b/src/xmlreader.c
@@ -1703,9 +1703,11 @@ static int parse_strings(xmlDocPtr doc)
void register_xmlreader(void)
{
+#if 0
xml_register_callback(parse_resources);
xml_register_callback(parse_buildings); /* requires resources */
xml_register_callback(parse_ships); /* requires resources, terrains */
+#endif
xml_register_callback(parse_races);
xml_register_callback(parse_equipment); /* requires resources */