forked from github/server
some xmlreader code still required that resources get loaded first.
This commit is contained in:
parent
85509cdf65
commit
ad0f83dcca
2 changed files with 15 additions and 14 deletions
|
@ -243,17 +243,16 @@ item_type *it_find(const char *zname)
|
||||||
}
|
}
|
||||||
|
|
||||||
item_type *it_get_or_create(resource_type *rtype) {
|
item_type *it_get_or_create(resource_type *rtype) {
|
||||||
item_type * itype;
|
|
||||||
assert(rtype);
|
assert(rtype);
|
||||||
itype = it_find(rtype->_name);
|
if (!rtype->itype) {
|
||||||
if (!itype) {
|
item_type * itype;
|
||||||
itype = (item_type *)calloc(sizeof(item_type), 1);
|
itype = (item_type *)calloc(sizeof(item_type), 1);
|
||||||
}
|
|
||||||
itype->rtype = rtype;
|
itype->rtype = rtype;
|
||||||
rtype->uchange = res_changeitem;
|
rtype->uchange = res_changeitem;
|
||||||
rtype->itype = itype;
|
rtype->itype = itype;
|
||||||
rtype->flags |= RTF_ITEM;
|
rtype->flags |= RTF_ITEM;
|
||||||
return itype;
|
}
|
||||||
|
return rtype->itype;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void lt_register(luxury_type * ltype)
|
static void lt_register(luxury_type * ltype)
|
||||||
|
|
|
@ -864,10 +864,12 @@ static void add_items(equipment * eq, xmlNodeSetPtr nsetItems)
|
||||||
xmlNodePtr node = nsetItems->nodeTab[i];
|
xmlNodePtr node = nsetItems->nodeTab[i];
|
||||||
xmlChar *propValue;
|
xmlChar *propValue;
|
||||||
const struct item_type *itype;
|
const struct item_type *itype;
|
||||||
|
struct resource_type *rtype;
|
||||||
|
|
||||||
propValue = xmlGetProp(node, BAD_CAST "name");
|
propValue = xmlGetProp(node, BAD_CAST "name");
|
||||||
assert(propValue != NULL);
|
assert(propValue != NULL);
|
||||||
itype = it_find((const char *)propValue);
|
rtype = rt_get_or_create((const char *)propValue);
|
||||||
|
itype = it_get_or_create(rtype);
|
||||||
xmlFree(propValue);
|
xmlFree(propValue);
|
||||||
if (itype != NULL) {
|
if (itype != NULL) {
|
||||||
propValue = xmlGetProp(node, BAD_CAST "amount");
|
propValue = xmlGetProp(node, BAD_CAST "amount");
|
||||||
|
@ -1705,14 +1707,14 @@ void register_xmlreader(void)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
xml_register_callback(parse_resources);
|
xml_register_callback(parse_resources);
|
||||||
xml_register_callback(parse_buildings); /* requires resources */
|
xml_register_callback(parse_buildings);
|
||||||
xml_register_callback(parse_ships); /* requires resources, terrains */
|
xml_register_callback(parse_ships);
|
||||||
#endif
|
#endif
|
||||||
xml_register_callback(parse_races);
|
xml_register_callback(parse_races);
|
||||||
xml_register_callback(parse_equipment); /* requires resources */
|
xml_register_callback(parse_equipment);
|
||||||
|
|
||||||
xml_register_callback(parse_spells); /* requires resources */
|
xml_register_callback(parse_spells);
|
||||||
xml_register_callback(parse_spellbooks); /* requires spells */
|
xml_register_callback(parse_spellbooks);
|
||||||
|
|
||||||
xml_register_callback(parse_strings);
|
xml_register_callback(parse_strings);
|
||||||
xml_register_callback(parse_messages);
|
xml_register_callback(parse_messages);
|
||||||
|
|
Loading…
Reference in a new issue