diff --git a/src/space.c b/src/space.c index 69b19a7..0666fe8 100644 --- a/src/space.c +++ b/src/space.c @@ -1111,9 +1111,28 @@ static StarSystem* system_parse(StarSystem* sys, const xmlNodePtr parent) { cur = node->children; do { if(xml_isNode(cur, "fleet")) { - /* Load the fleet. */ - flt = fleet_get(xml_get(cur)); - if(flt != NULL) { + /* Try to load it as a FleetGroup. */ + fltgrp = fleet_getGroup(xml_get(cur)); + if(fltgrp != NULL) { + /* Try to load it as a FleetGroup. */ + fltgrp = fleet_getGroup(xml_get(cur)); + if(fltgrp == NULL) { + WARN("Fleet '%s' for Star System '%s' not found", + xml_get(cur), sys->name); + continue; + } + + /* Add the fleetgroup. */ + system_addFleetGroup(sys, fltgrp); + } else { + /* Try to load it as a fleet. */ + flt = fleet_get(xml_get(cur)); + if(flt == NULL) { + WARN("Fleet '%s' for Star System '%s' not found", + xml_get(cur), sys->name); + continue; + } + /* Get the fleet. */ fleet.fleet = flt; @@ -1129,17 +1148,6 @@ static StarSystem* system_parse(StarSystem* sys, const xmlNodePtr parent) { /* Add the fleet. */ system_addFleet(sys, &fleet); - } else { - /* Try to load it as a FleetGroup. */ - fltgrp = fleet_getGroup(xml_get(cur)); - if(fltgrp == NULL) { - WARN("Fleet '%s' for Star System '%s' not found", - xml_get(cur), sys->name); - continue; - } - - /* Add the fleetgroup. */ - system_addFleetGroup(sys, fltgrp); } } } while(xml_nextNode(cur));