diff --git a/src/map.c b/src/map.c index 7eb8600..1b1d08a 100644 --- a/src/map.c +++ b/src/map.c @@ -186,29 +186,27 @@ static void map_update(void) { /* System is known. */ window_modifyText(map_wid, "txtSysname", sys->name); - if(sys->nplanets == 0) { /* No planets -> no factions. */ + standing = 0; + nstanding = 0; + for(i = 0; i < sys->nplanets; i++) { + if((f == -1) && (sys->planets[i]->faction > 0)) { + f = sys->planets[i]->faction; + standing += faction_getPlayer(f); + nstanding++; + } + else if(f != sys->planets[i]->faction && /* @todo More verbosity. */ + (sys->planets[i]->faction > 0)) { + snprintf(buf, 100, "Multiple"); + break; + } + } + if(f == -1) { window_modifyText(map_wid, "txtFaction", "NA"); window_moveWidget(map_wid, "txtSStanding", -20, -100); window_moveWidget(map_wid, "txtStanding", -20, -100-gl_smallFont.h-5); window_modifyText(map_wid, "txtStanding", "NA"); y = -100; } else { - standing = 0; - nstanding = 0; - f = -1; - for(i = 0; i < sys->nplanets; i++) { - if((f == -1) && (sys->planets[i]->faction > 0)) { - f = sys->planets[i]->faction; - standing += faction_getPlayer(f); - nstanding++; - } - else if(f != sys->planets[i]->faction && - (sys->planets[i]->faction > 0)) { - /* @todo More verbosity. */ - snprintf(buf, 100, "Multiple"); - break; - } - } if(i == sys->nplanets) /* Saw them all, and all the same. */ snprintf(buf, 100, "%s", faction_longname(f)); diff --git a/src/space.c b/src/space.c index 3b5b47c..f00e99e 100644 --- a/src/space.c +++ b/src/space.c @@ -615,6 +615,7 @@ static int planet_parse(Planet* planet, const xmlNodePtr parent) { /* Clear up memory for sane defaults. */ memset(planet, 0, sizeof(Planet)); + planet->faction = -1; str[0] = '\0'; flags = 0;