signed char nuk_effic; /* unused, always 100% */
signed char nuk_mobil; /* unused, always 0 */
short nuk_tech; /* nuke's tech level */
- char nuk_stockpile; /* group membership, unused, always ' ' */
+ char nuk_stockpile; /* group membership, unused */
coord nuk_opx, nuk_opy; /* Op sector coords, unused */
short nuk_mission; /* mission code, unused */
short nuk_radius; /* mission radius, unused */
return RET_SYN;
}
if (c == '~')
- c = ' ';
+ c = 0;
if (!snxtitem(&nstr, EF_LAND, player->argp[2]))
return RET_SYN;
count = 0;
ship.shp_nland = 0;
ship.shp_nxlight = 0;
ship.shp_nchoppers = 0;
- ship.shp_fleet = ' ';
+ ship.shp_fleet = 0;
memset(ship.shp_item, 0, sizeof(ship.shp_item));
ship.shp_pstage = PLG_HEALTHY;
ship.shp_ptime = 0;
land.lnd_mobil = 0;
}
land.lnd_uid = nstr.cur;
- land.lnd_army = ' ';
+ land.lnd_army = 0;
land.lnd_flags = 0;
land.lnd_ship = -1;
land.lnd_land = -1;
plane.pln_radius = 0;
plane.pln_range = UCHAR_MAX; /* will be adjusted by pln_set_tech() */
plane.pln_range_max = plane.pln_range;
- plane.pln_wing = ' ';
+ plane.pln_wing = 0;
plane.pln_ship = -1;
plane.pln_land = -1;
plane.pln_uid = nstr.cur;
pr("%4d ", ni.cur);
pr("%-4.4s ", mchr[(int)ship.shp_type].m_name);
prxy("%4d,%-4d ", ship.shp_x, ship.shp_y, player->cnum);
- pr("%c ", ship.shp_fleet);
+ pr("%1.1s", &ship.shp_fleet);
pr("%4d%%", ship.shp_effic);
pr("%4d", ship.shp_item[I_CIVIL]);
pr("%4d", ship.shp_item[I_MILIT]);
pr("%4d ", ni.cur);
pr("%-4.4s ", lchr[(int)land.lnd_type].l_name);
prxy("%4d,%-4d ", land.lnd_x, land.lnd_y, player->cnum);
- pr("%c ", land.lnd_army);
+ pr("%1.1s ", &land.lnd_army);
pr("%4d%%", land.lnd_effic);
pr("%4d", land.lnd_item[I_CIVIL]);
pr("%4d", land.lnd_item[I_MILIT]);
pr("Efficiency <e>: %d\t", plane->pln_effic);
pr("Mobility <m>: %d\n", plane->pln_mobil);
pr("Tech <t>: %d\t\t", plane->pln_tech);
- pr("Wing <w>: %c\n", plane->pln_wing);
+ pr("Wing <w>: %.1s\n", &plane->pln_wing);
pr("Range <r>: %d\t\t", plane->pln_range);
pr("Flags <f>: %d\n", plane->pln_flags);
pr("Ship <s>: %d\t\t", plane->pln_ship);
pr("Efficiency <e>: %d\t", land->lnd_effic);
pr("Mobility <M>: %d\n", land->lnd_mobil);
pr("Tech <t>: %d\t\t", land->lnd_tech);
- pr("Army <a>: %c\n", land->lnd_army);
+ pr("Army <a>: %.1s\n", &land->lnd_army);
pr("Fortification <F>: %d\t", land->lnd_harden);
pr("Fuel <B>: %d\n", land->lnd_fuel);
pr("Land unit <Y>: %d\n", land->lnd_land);
pr("Tech <T>: %d\t\t\t", ship->shp_tech);
pr("Efficiency <E>: %d\n", ship->shp_effic);
pr("Mobility <M>: %d\t\t", ship->shp_mobil);
- pr("Fleet <F>: %c\n", ship->shp_fleet);
+ pr("Fleet <F>: %.1s\n", &ship->shp_fleet);
/* could depend on opt_FUEL - but a deity might want to set this
up before enabling the option */
pr("Fuel <B>: %d\n", ship->shp_fuel);
break;
case 'F':
if (p[0] == '~')
- ship->shp_fleet = ' ';
+ ship->shp_fleet = 0;
else if (isalpha(p[0]))
ship->shp_fleet = p[0];
else {
break;
case 'a':
if (p[0] == '~')
- land->lnd_army = ' ';
+ land->lnd_army = 0;
else if (isalpha(p[0]))
land->lnd_army = p[0];
else {
break;
case 'w':
if (p[0] == '~')
- plane->pln_wing = ' ';
+ plane->pln_wing = 0;
else if (isalpha(p[0]))
plane->pln_wing = p[0];
else {
return RET_SYN;
}
if (c == '~')
- c = ' ';
+ c = 0;
if (!snxtitem(&nstr, EF_SHIP, player->argp[2]))
return RET_SYN;
count = 0;
pr("%4d ", ni.cur);
pr("%-15.15s", lchr[(int)land.lnd_type].l_name);
prxy(" %4d,%-4d", land.lnd_x, land.lnd_y, player->cnum);
- pr("%c", land.lnd_army);
+ pr("%1.1s", &land.lnd_army);
pr("%4d%%", land.lnd_effic);
pr("%4d", land.lnd_item[I_MILIT]);
pr("%4d", land.lnd_harden);
pr(" %d", yrel(np, land.lnd_y));
break;
case 4:
- if (land.lnd_army == ' ')
- pr(" ~");
- else
- pr(" %c", land.lnd_army);
+ pr(" %c ", land.lnd_army ? land.lnd_army : '~');
break;
case 5:
pr(" %d", land.lnd_effic);
pr(" %d", yrel(natp, plane.pln_y));
break;
case 4:
- if (plane.pln_wing == ' ')
- pr(" ~");
- else
- pr(" %c", plane.pln_wing);
+ pr(" %c ", plane.pln_wing ? plane.pln_wing : '~');
break;
case 5:
pr(" %d", plane.pln_effic);
pr("%3d ", plane.pln_own);
pr("%4d %-19.19s ", np.cur, plchr[(int)plane.pln_type].pl_name);
prxy("%4d,%-4d", plane.pln_x, plane.pln_y, player->cnum);
- pr(" %c %3d%% %3d %3d %4d %3d %3d",
- plane.pln_wing, plane.pln_effic,
- plane.pln_mobil,
+ pr(" %1.1s %3d%% %3d %3d %4d %3d %3d",
+ &plane.pln_wing, plane.pln_effic, plane.pln_mobil,
plane.pln_def, plane.pln_tech,
plane.pln_range, plane.pln_harden);
if (plane.pln_ship >= 0)
pr("%4d ", ni.cur);
pr("%-16.16s ", mchr[(int)ship.shp_type].m_name);
prxy("%4d,%-4d ", ship.shp_x, ship.shp_y, player->cnum);
- pr("%c", ship.shp_fleet);
+ pr("%1.1s", &ship.shp_fleet);
pr(" %-11s", ship.shp_rpath);
if (ship.shp_rflags & RET_GROUP)
pr("Yes ");
pr("%4d ", ni.cur);
pr("%-16.16s ", lchr[(int)land.lnd_type].l_name);
prxy("%4d,%-4d ", land.lnd_x, land.lnd_y, player->cnum);
- pr("%c", land.lnd_army);
+ pr("%1.1s", &land.lnd_army);
pr(" %-11s", land.lnd_rpath);
if (land.lnd_rflags & RET_GROUP)
pr("Yes ");
pr(" %d", yrel(np, ship.shp_y));
break;
case 4:
- if (ship.shp_fleet == ' ')
- pr(" ~");
- else
- pr(" %c", ship.shp_fleet);
+ pr(" %c ", ship.shp_fleet ? ship.shp_fleet : '~');
break;
case 5:
pr(" %d", ship.shp_effic);
pr("%4d ", ni.cur);
pr("%-16.16s ", mchr[(int)ship.shp_type].m_name);
prxy("%4d,%-4d ", ship.shp_x, ship.shp_y, player->cnum);
- pr("%c", ship.shp_fleet);
+ pr("%1.1s", &ship.shp_fleet);
pr("%4d%%", ship.shp_effic);
pr("%4d", ship.shp_item[I_CIVIL]);
tg.pln.pln_own = trade.trd_maxbidder;
makenotlost(EF_PLANE, tg.pln.pln_own, tg.pln.pln_uid,
tg.pln.pln_x, tg.pln.pln_y);
- tg.pln.pln_wing = ' ';
+ tg.pln.pln_wing = 0;
/* no cheap version of fly */
if (opt_MOB_ACCESS) {
tg.pln.pln_mobil = -(etu_per_update / sect_mob_neg_factor);
tg.lnd.lnd_own = trade.trd_maxbidder;
makenotlost(EF_LAND, tg.lnd.lnd_own, tg.lnd.lnd_uid,
tg.lnd.lnd_x, tg.lnd.lnd_y);
- tg.lnd.lnd_army = ' ';
+ tg.lnd.lnd_army = 0;
/* no cheap version of fly */
if (opt_MOB_ACCESS) {
tg.lnd.lnd_mobil = -(etu_per_update / sect_mob_neg_factor);
return RET_SYN;
}
if (c == '~')
- c = ' ';
+ c = 0;
if (!snxtitem(&nstr, EF_PLANE, player->argp[2]))
return RET_SYN;
count = 0;
char buf[1024];
char *p;
- if (army == ' ')
+ if (!army)
army = '~';
for (;;) {
p = getstring(prompt, buf);
att_mode[combat_mode],
prland(&land),
prcom(1, off),
- land.lnd_army == ' ' ? '~' : land.lnd_army,
+ land.lnd_army ? land.lnd_army : '~',
land.lnd_effic);
land_answer[(int)land.lnd_army] =
att_prompt(prompt, land.lnd_army);
continue;
sprintf(prompt, "Move in with %s (%c %d%%) [ynYNq?] ",
prland(&llp->land),
- llp->land.lnd_army == ' ' ? '~' : llp->land.lnd_army,
+ llp->land.lnd_army ? llp->land.lnd_army : '~',
llp->land.lnd_effic);
*answerp = att_prompt(prompt, llp->land.lnd_army);
if (player->aborted || att_get_combat(def, 0) < 0)
pr("%4d ", lnd->lnd_uid);
pr("%-16.16s ", llp->lcp->l_name);
prxy("%4d,%-4d ", lnd->lnd_x, lnd->lnd_y, llp->land.lnd_own);
- pr("%c", lnd->lnd_army);
+ pr("%1.1s", &lnd->lnd_army);
pr("%4d%%", lnd->lnd_effic);
pr("%4d", lnd->lnd_item[I_SHELL]);
pr("%4d", lnd->lnd_item[I_GUN]);
pr("%4d ", shp->shp_uid);
pr("%-16.16s ", mlp->mcp->m_name);
prxy("%4d,%-4d ", shp->shp_x, shp->shp_y, mlp->ship.shp_own);
- pr("%c", shp->shp_fleet);
+ pr("%1.1s", &shp->shp_fleet);
pr("%4d%%", shp->shp_effic);
pr("%4d", shp->shp_item[I_MILIT]);
pr("%4d", shp->shp_item[I_SHELL]);
* can select on NS_ALL, NS_AREA, NS_DIST, and NS_LIST.
* iterate thru the "condarg" string looking
* for arguments to compile into the nstr.
+ * Using this function for anything but command arguments is usually
+ * incorrect, because it respects conditionals. Use the snxtitem_FOO()
+ * instead.
*/
int
snxtitem(struct nstr_item *np, int type, char *str)
snxtitem_group(struct nstr_item *np, int type, char group)
{
if (group == '~')
- group = ' ';
+ group = 0;
memset(np, 0, sizeof(*np));
np->cur = -1;
np->sel = NS_GROUP;
pp->pln_own = newown;
makenotlost(EF_PLANE, pp->pln_own, pp->pln_uid, pp->pln_x, pp->pln_y);
pp->pln_mission = 0;
+ pp->pln_wing = 0;
putplane(pp->pln_uid, pp);
}
sp->shp_own = newown;
makenotlost(EF_SHIP, sp->shp_own, sp->shp_uid, sp->shp_x, sp->shp_y);
sp->shp_mission = 0;
- sp->shp_fleet = ' ';
+ sp->shp_fleet = 0;
sp->shp_rflags = 0;
/* Keep track of when this was taken over */
time(&sp->shp_access);
putland(landp->lnd_uid, landp);
return;
}
- landp->lnd_army = ' ';
+ landp->lnd_army = 0;
landp->lnd_mobil = 0;
landp->lnd_harden = 0;
/* Keep track of when this was taken over */