Simplify retreat_ship1() and retreat_land1() slightly
No functional change.
This commit is contained in:
parent
3722bafaf7
commit
3ea4e1ac60
1 changed files with 10 additions and 8 deletions
|
@ -267,7 +267,9 @@ retreat_ship1(struct shpstr *sp, char code, int orig)
|
||||||
|
|
||||||
mines = sect.sct_mines;
|
mines = sect.sct_mines;
|
||||||
changed = 0;
|
changed = 0;
|
||||||
if ((mcp->m_flags & M_SWEEP) && sect.sct_type == SCT_WATER) {
|
if (sect.sct_type != SCT_WATER || mines <= 0)
|
||||||
|
continue;
|
||||||
|
if (mcp->m_flags & M_SWEEP) {
|
||||||
max = mcp->m_item[I_SHELL];
|
max = mcp->m_item[I_SHELL];
|
||||||
shells = sp->shp_item[I_SHELL];
|
shells = sp->shp_item[I_SHELL];
|
||||||
for (m = 0; mines > 0 && m < 5; m++) {
|
for (m = 0; mines > 0 && m < 5; m++) {
|
||||||
|
@ -281,7 +283,8 @@ retreat_ship1(struct shpstr *sp, char code, int orig)
|
||||||
if (sect.sct_mines != mines) {
|
if (sect.sct_mines != mines) {
|
||||||
wu(0, sp->shp_own,
|
wu(0, sp->shp_own,
|
||||||
"%s cleared %d mine%s in %s while retreating\n",
|
"%s cleared %d mine%s in %s while retreating\n",
|
||||||
prship(sp), sect.sct_mines-mines, splur(sect.sct_mines-mines),
|
prship(sp), sect.sct_mines - mines,
|
||||||
|
splur(sect.sct_mines - mines),
|
||||||
xyas(newx, newy, sp->shp_own));
|
xyas(newx, newy, sp->shp_own));
|
||||||
sect.sct_mines = mines;
|
sect.sct_mines = mines;
|
||||||
sp->shp_item[I_SHELL] = shells;
|
sp->shp_item[I_SHELL] = shells;
|
||||||
|
@ -290,8 +293,7 @@ retreat_ship1(struct shpstr *sp, char code, int orig)
|
||||||
if (changed)
|
if (changed)
|
||||||
writemap(sp->shp_own);
|
writemap(sp->shp_own);
|
||||||
}
|
}
|
||||||
if (sect.sct_type == SCT_WATER && mines > 0
|
if (chance(DMINE_HITCHANCE(mines))) {
|
||||||
&& chance(DMINE_HITCHANCE(mines))) {
|
|
||||||
wu(0, sp->shp_own,
|
wu(0, sp->shp_own,
|
||||||
"%s %s,\nand hit a mine in %s while retreating!\n",
|
"%s %s,\nand hit a mine in %s while retreating!\n",
|
||||||
prship(sp), conditions[findcondition(code)].desc[orig],
|
prship(sp), conditions[findcondition(code)].desc[orig],
|
||||||
|
@ -476,8 +478,9 @@ retreat_land1(struct lndstr *lp, char code, int orig)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
mines = SCT_LANDMINES(§);
|
mines = SCT_LANDMINES(§);
|
||||||
if ((lcp->l_flags & L_ENGINEER) && mines > 0 &&
|
if (mines <= 0 || sect.sct_oldown == lp->lnd_own)
|
||||||
(sect.sct_oldown != lp->lnd_own)) {
|
continue;
|
||||||
|
if (lcp->l_flags & L_ENGINEER) {
|
||||||
max = lcp->l_item[I_SHELL];
|
max = lcp->l_item[I_SHELL];
|
||||||
shells = lp->lnd_item[I_SHELL];
|
shells = lp->lnd_item[I_SHELL];
|
||||||
for (m = 0; mines > 0 && m < 5; m++) {
|
for (m = 0; mines > 0 && m < 5; m++) {
|
||||||
|
@ -490,8 +493,7 @@ retreat_land1(struct lndstr *lp, char code, int orig)
|
||||||
lp->lnd_item[I_SHELL] = shells;
|
lp->lnd_item[I_SHELL] = shells;
|
||||||
putsect(§);
|
putsect(§);
|
||||||
}
|
}
|
||||||
if (mines > 0 && (sect.sct_oldown != lp->lnd_own) &&
|
if (chance(DMINE_LHITCHANCE(mines))) {
|
||||||
chance(DMINE_LHITCHANCE(mines))) {
|
|
||||||
wu(0, lp->lnd_own,
|
wu(0, lp->lnd_own,
|
||||||
"%s %s,\nand hit a mine in %s while retreating!\n",
|
"%s %s,\nand hit a mine in %s while retreating!\n",
|
||||||
prland(lp),
|
prland(lp),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue