[Change] Try to load as FleetGroup first.

This commit is contained in:
Allanis 2014-11-08 14:06:30 +00:00
parent 0a28634b1a
commit d23b722ef7

View File

@ -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. */
/* 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) {
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));