(is_engineer, has_helpful_engineer): Rename. Require allied
engineers. This affecs command `fortify'.
This commit is contained in:
parent
f7faeb6470
commit
c4ae0d89eb
3 changed files with 8 additions and 3 deletions
|
@ -330,7 +330,7 @@ extern int gamehours(time_t, int *);
|
||||||
extern int has_units(coord, coord, natid, struct lndstr *);
|
extern int has_units(coord, coord, natid, struct lndstr *);
|
||||||
extern int has_units_with_mob(coord, coord, natid);
|
extern int has_units_with_mob(coord, coord, natid);
|
||||||
extern int adj_units(coord, coord, natid);
|
extern int adj_units(coord, coord, natid);
|
||||||
extern int is_engineer(int x, int y);
|
extern int has_helpful_engineer(coord x, coord y, natid cn);
|
||||||
/* log.c */
|
/* log.c */
|
||||||
extern void loginit(void);
|
extern void loginit(void);
|
||||||
extern void logerror(s_char *, ...);
|
extern void logerror(s_char *, ...);
|
||||||
|
|
|
@ -97,14 +97,19 @@ has_units_with_mob(coord x, coord y, natid cn)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Is there a engineer unit at X,Y that can help nation CN?
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
is_engineer(int x, int y)
|
has_helpful_engineer(coord x, coord y, natid cn)
|
||||||
{
|
{
|
||||||
struct nstr_item ni;
|
struct nstr_item ni;
|
||||||
struct lndstr land;
|
struct lndstr land;
|
||||||
|
|
||||||
snxtitem_xy(&ni, EF_LAND, x, y);
|
snxtitem_xy(&ni, EF_LAND, x, y);
|
||||||
while (nxtitem(&ni, (s_char *)&land)) {
|
while (nxtitem(&ni, (s_char *)&land)) {
|
||||||
|
if (land.lnd_own != cn && getrel(getnatp(land.lnd_own), cn) != ALLIED)
|
||||||
|
continue;
|
||||||
if (lchr[(int)land.lnd_type].l_flags & L_ENGINEER)
|
if (lchr[(int)land.lnd_type].l_flags & L_ENGINEER)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1367,7 +1367,7 @@ lnd_fortify (struct lndstr *lp, int hard_amt)
|
||||||
if ((lp->lnd_harden + hard_amt) > land_mob_max)
|
if ((lp->lnd_harden + hard_amt) > land_mob_max)
|
||||||
hard_amt = land_mob_max - lp->lnd_harden;
|
hard_amt = land_mob_max - lp->lnd_harden;
|
||||||
|
|
||||||
eng = is_engineer(lp->lnd_x, lp->lnd_y);
|
eng = has_helpful_engineer(lp->lnd_x, lp->lnd_y, lp->lnd_own);
|
||||||
|
|
||||||
if (eng)
|
if (eng)
|
||||||
hard_amt = ((float)hard_amt * 1.5);
|
hard_amt = ((float)hard_amt * 1.5);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue