(sctstr): Member sct_che encoded number of che and their target.
Simplify. Split into member sct_che (number) and sct_che_target. Users changed. (get_che_cnum, set_che_cnum, get_che_value, get_che_value): Che encoding/decoding functions; remove. (CHE_MAX): Move from var.h to sect.h. (prsect, doland): Print / edit the new field.
This commit is contained in:
parent
eccc5cb7d7
commit
5bad9875a5
11 changed files with 56 additions and 59 deletions
|
@ -187,6 +187,7 @@ add(void)
|
|||
sect.sct_pstage = PLG_HEALTHY;
|
||||
sect.sct_ptime = 0;
|
||||
sect.sct_che = 0;
|
||||
sect.sct_che_target = 0;
|
||||
sect.sct_fallout = 0;
|
||||
putsect(§);
|
||||
pr("wiped\n");
|
||||
|
|
|
@ -77,8 +77,8 @@ anti(void)
|
|||
pr(" ---- --------------------------\n");
|
||||
}
|
||||
mil = sect.sct_item[I_MILIT];
|
||||
che = get_che_value(sect.sct_che);
|
||||
target = get_che_cnum(sect.sct_che);
|
||||
che = sect.sct_che;
|
||||
target = sect.sct_che_target;
|
||||
avail_mil = sect.sct_mobil / 2;
|
||||
if (mil <= avail_mil)
|
||||
avail_mil = mil;
|
||||
|
@ -114,8 +114,8 @@ anti(void)
|
|||
sect.sct_mobil = sect.sct_mobil - chekilled - milkilled;
|
||||
sect.sct_item[I_MILIT] = mil - milkilled;
|
||||
if (ache == 0)
|
||||
sect.sct_che = 0;
|
||||
set_che_value(sect.sct_che, ache);
|
||||
sect.sct_che_target = 0;
|
||||
sect.sct_che = ache;
|
||||
putsect(§);
|
||||
pr(" Body count: Military %d - Guerillas %d.\n",
|
||||
milkilled, chekilled);
|
||||
|
@ -138,9 +138,11 @@ anti(void)
|
|||
/* Ok, now leave anywhere from 16% to 25% of the che */
|
||||
n_cheleft = (ache / (n_cheleft + 3));
|
||||
ache -= n_cheleft;
|
||||
set_che_value(sect.sct_che, n_cheleft);
|
||||
} else
|
||||
sect.sct_che = n_cheleft;
|
||||
} else {
|
||||
sect.sct_che = 0;
|
||||
sect.sct_che_target = 0;
|
||||
}
|
||||
sect.sct_item[I_MILIT] = ache;
|
||||
if (sect.sct_own == sect.sct_oldown)
|
||||
sect.sct_oldown = 0;
|
||||
|
|
|
@ -273,10 +273,8 @@ grab_sect(register struct sctstr *sp, natid to)
|
|||
sp->sct_avail = 0;
|
||||
|
||||
if (sp->sct_oldown == to) {
|
||||
oldche = get_che_value(sp->sct_che);
|
||||
set_che_value(oldche, 0);
|
||||
set_che_cnum(oldche, 0);
|
||||
sp->sct_che = oldche;
|
||||
sp->sct_che = 0; /* FIXME where do these guys go? */
|
||||
sp->sct_che_target = 0;
|
||||
sp->sct_loyal = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -284,13 +284,14 @@ prsect(struct sctstr *sect)
|
|||
xyas(sect->sct_dist_x, sect->sct_dist_y, player->cnum));
|
||||
pr("Designation <s>: %c\t New designation <S>: %c\n",
|
||||
dchr[sect->sct_type].d_mnem, dchr[sect->sct_newtype].d_mnem);
|
||||
pr("own oo eff mob min gld frt oil urn wrk lty che plg ptime fall avail\n");
|
||||
pr(" o O e m i g f c u w l x p t F a\n");
|
||||
pr("%3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %4d %3d %5d %4d %5d\n",
|
||||
pr("own oo eff mob min gld frt oil urn wrk lty che ctg plg ptime fall avail\n");
|
||||
pr(" o O e m i g f c u w l x X p t F a\n");
|
||||
pr("%3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %5d %4d %5d\n",
|
||||
sect->sct_own, sect->sct_oldown, sect->sct_effic, sect->sct_mobil,
|
||||
sect->sct_min, sect->sct_gmin, sect->sct_fertil, sect->sct_oil,
|
||||
sect->sct_uran, sect->sct_work, sect->sct_loyal,
|
||||
sect->sct_che, sect->sct_pstage, sect->sct_ptime,
|
||||
sect->sct_che, sect->sct_che_target,
|
||||
sect->sct_pstage, sect->sct_ptime,
|
||||
sect->sct_fallout, sect->sct_avail);
|
||||
|
||||
pr("Mines <M>: %d\t", sect->sct_mines);
|
||||
|
@ -586,11 +587,19 @@ doland(s_char op, int arg, s_char *p, struct sctstr *sect)
|
|||
break;
|
||||
case 'x':
|
||||
old = sect->sct_che;
|
||||
new = errcheck(arg, 0, 65536);
|
||||
pr("Guerillas in %s changed from %d to %d%\n",
|
||||
new = errcheck(arg, 0, CHE_MAX);
|
||||
pr("Guerillas in %s changed from %d to %d\n",
|
||||
xyas(sect->sct_x, sect->sct_y, player->cnum), old, new);
|
||||
sect->sct_che = new;
|
||||
break;
|
||||
case 'X':
|
||||
old = sect->sct_che_target;
|
||||
new = errcheck(arg, 0, MAXNOC - 1);
|
||||
pr("Old owner of %s changed from %s (#%d) to %s (#%d).\n",
|
||||
xyas(sect->sct_x, sect->sct_y, player->cnum),
|
||||
cname(old), old, cname(new), new);
|
||||
sect->sct_che_target = new;
|
||||
break;
|
||||
case 'p':
|
||||
old = sect->sct_pstage;
|
||||
new = errcheck(arg, 0, PLG_EXPOSED);
|
||||
|
|
|
@ -71,8 +71,7 @@ hidd(void)
|
|||
pr(" %c %3d%% %3d %3d %3d %3d %3d %3d %3d",
|
||||
dchr[sect.sct_type].d_mnem, sect.sct_effic,
|
||||
sect.sct_oldown, sect.sct_loyal,
|
||||
get_che_cnum(sect.sct_che),
|
||||
get_che_value(sect.sct_che),
|
||||
sect.sct_che_target, sect.sct_che,
|
||||
sect.sct_pstage, sect.sct_ptime, sect.sct_mines);
|
||||
pr("\n");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue