(build_bridge,build_tower,retreat_ship1): Mark "X" on sector

where mines were found when retreating.  Remove "X" when the
bridge span or tower is built.  Closes #1149809.
The bmap is now updated when the bridge span or tower is built.
A bulletin was added for when mines were swept when
retreating.
This commit is contained in:
Ron Koenderink 2005-05-08 18:39:09 +00:00
parent 250fc7d354
commit dcd0794104
2 changed files with 18 additions and 0 deletions

View file

@ -723,6 +723,8 @@ build_bridge(struct sctstr *sp, short *vec)
sect.sct_mobil = 0; sect.sct_mobil = 0;
} }
sect.sct_mines = 0; sect.sct_mines = 0;
map_set(player->cnum, sect.sct_x, sect.sct_y, dchr[SCT_BSPAN].d_mnem, 2);
writemap(player->cnum);
putsect(&sect); putsect(&sect);
pr("Bridge span built over %s\n", pr("Bridge span built over %s\n",
xyas(sect.sct_x, sect.sct_y, player->cnum)); xyas(sect.sct_x, sect.sct_y, player->cnum));
@ -1010,6 +1012,8 @@ build_tower(struct sctstr *sp, short *vec)
if (!opt_DEFENSE_INFRA) if (!opt_DEFENSE_INFRA)
sect.sct_defense = sect.sct_effic; sect.sct_defense = sect.sct_effic;
sect.sct_mines = 0; sect.sct_mines = 0;
map_set(player->cnum, sect.sct_x, sect.sct_y, dchr[SCT_BTOWER].d_mnem, 2);
writemap(player->cnum);
putsect(&sect); putsect(&sect);
pr("Bridge tower built in %s\n", pr("Bridge tower built in %s\n",
xyas(sect.sct_x, sect.sct_y, player->cnum)); xyas(sect.sct_x, sect.sct_y, player->cnum));

View file

@ -145,6 +145,7 @@ retreat_ship1(struct shpstr *sp, s_char code, int orig)
double mobcost; double mobcost;
struct mchrstr *mcp; struct mchrstr *mcp;
int time_to_stop; int time_to_stop;
int changed;
sp->shp_mission = 0; sp->shp_mission = 0;
if (sp->shp_own == 0) if (sp->shp_own == 0)
@ -276,6 +277,7 @@ retreat_ship1(struct shpstr *sp, s_char code, int orig)
continue; continue;
mines = sect.sct_mines; mines = sect.sct_mines;
changed = 0;
if ((mcp->m_flags & M_SWEEP) && mines > 0 && !player->owner) { if ((mcp->m_flags & M_SWEEP) && mines > 0 && !player->owner) {
max = mcp->m_item[I_SHELL]; max = mcp->m_item[I_SHELL];
shells = sp->shp_item[I_SHELL]; shells = sp->shp_item[I_SHELL];
@ -283,11 +285,21 @@ retreat_ship1(struct shpstr *sp, s_char code, int orig)
if (chance(0.66)) { if (chance(0.66)) {
mines--; mines--;
shells = min(max, shells + 1); shells = min(max, shells + 1);
changed |= map_set(sp->shp_own, sp->shp_x, sp->shp_y,
'X', 0);
} }
} }
if (sect.sct_mines != mines) {
wu(0, sp->shp_own,
"%s cleared %d mine%s in %s while retreating\n",
prship(sp), sect.sct_mines-mines, splur(sect.sct_mines-mines),
xyas(newx, newy, sp->shp_own));
}
sect.sct_mines = mines; sect.sct_mines = mines;
sect.sct_item[I_SHELL] = shells; sect.sct_item[I_SHELL] = shells;
putsect(&sect); putsect(&sect);
if (changed)
writemap(sp->shp_own);
} }
if (mines > 0 && !player->owner && chance(DMINE_HITCHANCE(mines))) { if (mines > 0 && !player->owner && chance(DMINE_HITCHANCE(mines))) {
wu(0, sp->shp_own, wu(0, sp->shp_own,
@ -298,6 +310,8 @@ retreat_ship1(struct shpstr *sp, s_char code, int orig)
m = MINE_DAMAGE(); m = MINE_DAMAGE();
shipdamage(sp, m); shipdamage(sp, m);
mines--; mines--;
if (map_set(sp->shp_own, sp->shp_x, sp->shp_y, 'X', 0))
writemap(sp->shp_own);
sect.sct_mines = mines; sect.sct_mines = mines;
putsect(&sect); putsect(&sect);
if (sp->shp_effic < SHIP_MINEFF) if (sp->shp_effic < SHIP_MINEFF)