Change encoding of `not in any group' from space to 0, because that's
friendlier in conditionals: (army, build_ship, build_land, build_plane, doship, doplane, dounit) (flee, check_trade, wing, snxtitem_group, takeover_ship) (takeover_land): Assign 0 instead of space. (carg, lcarg, pr_ship, pr_plane, pr_land, ldump, land, pdump, plan) (retr, lretr, sdump, shi, lnd_list, shp_list, ask_olist, att_prompt) (ask_move_in): Update printing of group. (takeover_plane): Failed to clear wing.
This commit is contained in:
parent
a46de3d997
commit
1b94ddedc3
20 changed files with 38 additions and 44 deletions
|
@ -47,7 +47,7 @@ struct nukstr {
|
|||
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 */
|
||||
|
|
|
@ -62,7 +62,7 @@ army(void)
|
|||
return RET_SYN;
|
||||
}
|
||||
if (c == '~')
|
||||
c = ' ';
|
||||
c = 0;
|
||||
if (!snxtitem(&nstr, EF_LAND, player->argp[2]))
|
||||
return RET_SYN;
|
||||
count = 0;
|
||||
|
|
|
@ -369,7 +369,7 @@ build_ship(struct sctstr *sp, struct mchrstr *mp, short *vec, int tlev)
|
|||
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;
|
||||
|
@ -490,7 +490,7 @@ build_land(struct sctstr *sp, struct lchrstr *lp, short *vec, int tlev)
|
|||
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;
|
||||
|
@ -792,7 +792,7 @@ build_plane(struct sctstr *sp, struct plchrstr *pp, short *vec, int tlev)
|
|||
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;
|
||||
|
|
|
@ -63,7 +63,7 @@ carg(void)
|
|||
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]);
|
||||
|
@ -112,7 +112,7 @@ lcarg(void)
|
|||
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]);
|
||||
|
|
|
@ -329,7 +329,7 @@ pr_plane(struct plnstr *plane)
|
|||
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);
|
||||
|
@ -346,7 +346,7 @@ pr_land(struct lndstr *land)
|
|||
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);
|
||||
|
@ -387,7 +387,7 @@ pr_ship(struct shpstr *ship)
|
|||
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);
|
||||
|
@ -834,7 +834,7 @@ doship(char op, int arg, char *p, struct shpstr *ship)
|
|||
break;
|
||||
case 'F':
|
||||
if (p[0] == '~')
|
||||
ship->shp_fleet = ' ';
|
||||
ship->shp_fleet = 0;
|
||||
else if (isalpha(p[0]))
|
||||
ship->shp_fleet = p[0];
|
||||
else {
|
||||
|
@ -948,7 +948,7 @@ dounit(char op, int arg, char *p, struct lndstr *land)
|
|||
break;
|
||||
case 'a':
|
||||
if (p[0] == '~')
|
||||
land->lnd_army = ' ';
|
||||
land->lnd_army = 0;
|
||||
else if (isalpha(p[0]))
|
||||
land->lnd_army = p[0];
|
||||
else {
|
||||
|
@ -1079,7 +1079,7 @@ doplane(char op, int arg, char *p, struct plnstr *plane)
|
|||
break;
|
||||
case 'w':
|
||||
if (p[0] == '~')
|
||||
plane->pln_wing = ' ';
|
||||
plane->pln_wing = 0;
|
||||
else if (isalpha(p[0]))
|
||||
plane->pln_wing = p[0];
|
||||
else {
|
||||
|
|
|
@ -62,7 +62,7 @@ flee(void)
|
|||
return RET_SYN;
|
||||
}
|
||||
if (c == '~')
|
||||
c = ' ';
|
||||
c = 0;
|
||||
if (!snxtitem(&nstr, EF_SHIP, player->argp[2]))
|
||||
return RET_SYN;
|
||||
count = 0;
|
||||
|
|
|
@ -77,7 +77,7 @@ land(void)
|
|||
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);
|
||||
|
|
|
@ -326,10 +326,7 @@ ldump(void)
|
|||
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);
|
||||
|
|
|
@ -222,10 +222,7 @@ pdump(void)
|
|||
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);
|
||||
|
|
|
@ -65,9 +65,8 @@ plan(void)
|
|||
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)
|
||||
|
|
|
@ -160,7 +160,7 @@ retr(void)
|
|||
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 ");
|
||||
|
@ -289,7 +289,7 @@ lretr(void)
|
|||
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 ");
|
||||
|
|
|
@ -288,10 +288,7 @@ sdump(void)
|
|||
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);
|
||||
|
|
|
@ -75,7 +75,7 @@ shi(void)
|
|||
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]);
|
||||
|
|
|
@ -398,7 +398,7 @@ check_trade(void)
|
|||
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);
|
||||
|
@ -428,7 +428,7 @@ check_trade(void)
|
|||
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);
|
||||
|
|
|
@ -60,7 +60,7 @@ wing(void)
|
|||
return RET_SYN;
|
||||
}
|
||||
if (c == '~')
|
||||
c = ' ';
|
||||
c = 0;
|
||||
if (!snxtitem(&nstr, EF_PLANE, player->argp[2]))
|
||||
return RET_SYN;
|
||||
count = 0;
|
||||
|
|
|
@ -921,7 +921,7 @@ att_prompt(char *prompt, char army)
|
|||
char buf[1024];
|
||||
char *p;
|
||||
|
||||
if (army == ' ')
|
||||
if (!army)
|
||||
army = '~';
|
||||
for (;;) {
|
||||
p = getstring(prompt, buf);
|
||||
|
@ -1051,7 +1051,7 @@ ask_olist(int combat_mode, struct combat *off, struct combat *def,
|
|||
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);
|
||||
|
@ -2293,7 +2293,7 @@ ask_move_in(struct combat *off, struct emp_qelem *olist,
|
|||
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)
|
||||
|
|
|
@ -765,7 +765,7 @@ lnd_list(struct emp_qelem *land_list)
|
|||
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]);
|
||||
|
|
|
@ -333,7 +333,7 @@ shp_list(struct emp_qelem *ship_list)
|
|||
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]);
|
||||
|
|
|
@ -45,6 +45,9 @@
|
|||
* 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)
|
||||
|
@ -195,7 +198,7 @@ void
|
|||
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;
|
||||
|
|
|
@ -206,6 +206,7 @@ takeover_plane(struct plnstr *pp, natid newown)
|
|||
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);
|
||||
}
|
||||
|
||||
|
@ -224,7 +225,7 @@ takeover_ship(struct shpstr *sp, natid newown, int hostile)
|
|||
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);
|
||||
|
@ -279,7 +280,7 @@ takeover_land(struct lndstr *landp, natid newown, int hostile)
|
|||
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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue