[Change] Adjust text height to faction name length.
This commit is contained in:
parent
f26101197e
commit
7c723db96b
30
src/map.c
30
src/map.c
@ -161,13 +161,23 @@ static void map_update(void) {
|
|||||||
|
|
||||||
/* Right text. */
|
/* Right text. */
|
||||||
if(!sys_isKnown(sys)) { /* System isn't known. Erase all. */
|
if(!sys_isKnown(sys)) { /* System isn't known. Erase all. */
|
||||||
|
/* Right text. */
|
||||||
window_modifyText(map_wid, "txtSysname", "Unknown");
|
window_modifyText(map_wid, "txtSysname", "Unknown");
|
||||||
window_modifyText(map_wid, "txtFaction", "Unknown");
|
window_modifyText(map_wid, "txtFaction", "Unknown");
|
||||||
|
/* Standing. */
|
||||||
|
window_moveWidget(map_wid, "txtSStanding", -20, -100);
|
||||||
|
window_moveWidget(map_wid, "txtStanding", -20, -100-gl_smallFont.h-5);
|
||||||
window_modifyText(map_wid, "txtStanding", "Unknown");
|
window_modifyText(map_wid, "txtStanding", "Unknown");
|
||||||
|
/* Planets. */
|
||||||
|
window_moveWidget(map_wid, "txtSPlanets", -20, -140);
|
||||||
|
window_moveWidget(map_wid, "txtPlanets", -20, -140-gl_smallFont.h-5);
|
||||||
window_modifyText(map_wid, "txtPlanets", "Unknown");
|
window_modifyText(map_wid, "txtPlanets", "Unknown");
|
||||||
|
/* Services. */
|
||||||
window_moveWidget(map_wid, "txtSServices", -20, -180);
|
window_moveWidget(map_wid, "txtSServices", -20, -180);
|
||||||
window_moveWidget(map_wid, "txtServices", -20, -180-gl_smallFont.h-5);
|
window_moveWidget(map_wid, "txtServices", -20, -180-gl_smallFont.h-5);
|
||||||
window_modifyText(map_wid, "txtServices", "Unknown");
|
window_modifyText(map_wid, "txtServices", "Unknown");
|
||||||
|
|
||||||
|
/* Bottom text. */
|
||||||
window_modifyText(map_wid, "txtSystemStatus", NULL);
|
window_modifyText(map_wid, "txtSystemStatus", NULL);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -178,7 +188,10 @@ static void map_update(void) {
|
|||||||
|
|
||||||
if(sys->nplanets == 0) { /* No planets -> no factions. */
|
if(sys->nplanets == 0) { /* No planets -> no factions. */
|
||||||
window_modifyText(map_wid, "txtFaction", "NA");
|
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");
|
window_modifyText(map_wid, "txtStanding", "NA");
|
||||||
|
y = -100;
|
||||||
} else {
|
} else {
|
||||||
standing = 0;
|
standing = 0;
|
||||||
nstanding = 0;
|
nstanding = 0;
|
||||||
@ -193,16 +206,23 @@ static void map_update(void) {
|
|||||||
(sys->planets[i].faction!=0)) {
|
(sys->planets[i].faction!=0)) {
|
||||||
/* TODO: more verbosity. */
|
/* TODO: more verbosity. */
|
||||||
snprintf(buf, 100, "Multiple");
|
snprintf(buf, 100, "Multiple");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(i == sys->nplanets)
|
if(i == sys->nplanets)
|
||||||
/* Saw them all, and all the same. */
|
/* Saw them all, and all the same. */
|
||||||
snprintf(buf, 100, "%s", faction_name(f));
|
snprintf(buf, 100, "%s", faction_longname(f));
|
||||||
|
|
||||||
/* Modify the text. */
|
/* Modify the text. */
|
||||||
window_modifyText(map_wid, "txtFaction", buf);
|
window_modifyText(map_wid, "txtFaction", buf);
|
||||||
window_modifyText(map_wid, "txtStanding",
|
window_modifyText(map_wid, "txtStanding",
|
||||||
faction_getStanding(standing / nstanding));
|
faction_getStanding(standing / nstanding));
|
||||||
|
|
||||||
|
/* Lower text if needed. */
|
||||||
|
h = gl_printHeight(&gl_smallFont, 80, buf);
|
||||||
|
y = -100 - (h - gl_smallFont.h);
|
||||||
|
window_moveWidget(map_wid, "txtSStanding", -20, y);
|
||||||
|
window_moveWidget(map_wid, "txtStanding", -20, y-gl_smallFont.h-5);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get planets. */
|
/* Get planets. */
|
||||||
@ -218,13 +238,15 @@ static void map_update(void) {
|
|||||||
}
|
}
|
||||||
window_modifyText(map_wid, "txtPlanets", buf);
|
window_modifyText(map_wid, "txtPlanets", buf);
|
||||||
}
|
}
|
||||||
|
y -= 40;
|
||||||
|
window_moveWidget(map_wid, "txtSPlanets", -20, y);
|
||||||
|
window_moveWidget(map_wid, "txtPlanets", -20, y-gl_smallFont.h-5);
|
||||||
|
|
||||||
/* Get the services. */
|
/* Get the services. */
|
||||||
h = gl_printHeight(&gl_smallFont, 80, buf);
|
h = gl_printHeight(&gl_smallFont, 80, buf);
|
||||||
y = -180 - (h - gl_smallFont.h);
|
y -= 40 +(h - gl_smallFont.h);
|
||||||
window_moveWidget(map_wid, "txtSServices", -20, y);
|
window_moveWidget(map_wid, "txtSServices", -20, y);
|
||||||
y -= gl_smallFont.h+5;
|
window_moveWidget(map_wid, "txtServices", -20, y-gl_smallFont.h-5);
|
||||||
window_moveWidget(map_wid, "txtServices", -20, y);
|
|
||||||
services = 0;
|
services = 0;
|
||||||
for(i = 0; i < sys->nplanets; i++)
|
for(i = 0; i < sys->nplanets; i++)
|
||||||
services |= sys->planets[i].services;
|
services |= sys->planets[i].services;
|
||||||
|
Loading…
Reference in New Issue
Block a user