]> git.pond.sub.org Git - empserver/commitdiff
(is_engineer, has_helpful_engineer): Rename. Require allied
authorMarkus Armbruster <armbru@pond.sub.org>
Wed, 28 Jan 2004 10:46:57 +0000 (10:46 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Wed, 28 Jan 2004 10:46:57 +0000 (10:46 +0000)
engineers.  This affecs command `fortify'.

include/prototypes.h
src/lib/common/land.c
src/lib/subs/lndsub.c

index ade09bd08ebfe2754cf68cdb521965d2f07af140..c717185d25afa9e1c5b8ccf82b9be905034fd1fb 100644 (file)
@@ -330,7 +330,7 @@ extern int gamehours(time_t, int *);
 extern int has_units(coord, coord, natid, struct lndstr *);
 extern int has_units_with_mob(coord, coord, natid);
 extern int adj_units(coord, coord, natid);
 extern int has_units(coord, coord, natid, struct lndstr *);
 extern int has_units_with_mob(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 */
 extern void loginit(void);
 extern void logerror(s_char *, ...);
 /* log.c */
 extern void loginit(void);
 extern void logerror(s_char *, ...);
index 627f7e6f16b47be832d05a0bbbf83cb009864aa5..8ebebfd847b066dad048c0bb773cd0fd6f5ba611 100644 (file)
@@ -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 lndstr land;
 
     snxtitem_xy(&ni, EF_LAND, x, y);
     while (nxtitem(&ni, (s_char *)&land)) {
 {
     struct nstr_item ni;
     struct lndstr land;
 
     snxtitem_xy(&ni, EF_LAND, x, y);
     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)
            return 1;
     }
        if (lchr[(int)land.lnd_type].l_flags & L_ENGINEER)
            return 1;
     }
index 80f9230a4158d3cf522cdf821cd27136aec16c2a..8799864c861aff8a36f8cb22672dcc194af3ba27 100644 (file)
@@ -1367,7 +1367,7 @@ lnd_fortify (struct lndstr *lp, int hard_amt)
     if ((lp->lnd_harden + hard_amt) > land_mob_max)
        hard_amt = land_mob_max - lp->lnd_harden;
 
     if ((lp->lnd_harden + hard_amt) > land_mob_max)
        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)
        hard_amt = ((float)hard_amt * 1.5);
 
     if (eng)
        hard_amt = ((float)hard_amt * 1.5);