extern void resupply_all(struct lndstr *);
extern void resupply_commod(struct lndstr *, i_type);
extern int supply_commod(int, int, int, i_type, int);
-extern int has_supply(struct lndstr *);
+extern int lnd_in_supply(struct lndstr *);
+extern int lnd_could_be_supplied(struct lndstr *);
/* takeover.c */
extern void takeover_land(struct lndstr *, natid);
extern void takeover(struct sctstr *, natid);
resupply_all(&land);
#endif
putland(land.lnd_uid, &land);
- if (!has_supply(&land))
+ if (!lnd_in_supply(&land))
pr("WARNING: %s is out of supply!\n", prland(&land));
} else {
sprintf(buf, "unloaded in your %s at %s",
resupply_all(&land);
#endif
putland(land.lnd_uid, &land);
- if (!has_supply(&land))
+ if (!lnd_in_supply(&land))
pr("WARNING: %s is out of supply!\n", prland(&land));
} else {
sprintf(buf, "unloaded in your %s at %s",
if (land.lnd_ship >= 0)
continue;
d_unit = defense_val(&land);
- if (!has_supply(&land))
+ if (!lnd_could_be_supplied(&land))
d_unit /= 2.0;
dtotal += d_unit;
}
nunits++;
resupply_all(&land);
putland(land.lnd_uid, &land);
- if (has_supply(&land))
+ if (lnd_in_supply(&land))
pr("%s has supplies\n", prland(&land));
else
pr("%s is out of supply\n", prland(&land));
}
resupply_all(&land);
putland(land.lnd_uid, &land);
- if (!has_supply(&land)) {
+ if (!lnd_in_supply(&land)) {
pr("%s is out of supply, and cannot %s\n",
prland(&land), att_mode[combat_mode]);
continue;
}
memset(llp, 0, sizeof(struct ulist));
emp_insque(&llp->queue, list);
- llp->supplied = has_supply(&land);
+ resupply_all(&land);
+ putland(land.lnd_uid, &land);
+ llp->supplied = lnd_in_supply(&land);
if (!get_land(A_DEFEND, def, land.lnd_uid, llp, 1))
continue;
if (lnd_spyval(&land) > *d_spyp)
continue;
/* Only supplied units can react */
- if (!has_supply(&land))
- continue;
+ if (list) {
+ resupply_all(&land);
+ putland(land.lnd_uid, &land);
+ if (!lnd_in_supply(&land))
+ continue;
+ } else {
+ if (!lnd_could_be_supplied(&land))
+ continue;
+ }
if (!in_oparea((struct empobj *)&land, def->x, def->y))
continue;
}
}
+int
+lnd_in_supply(struct lndstr *lp)
+{
+ if (!opt_NOFOOD) {
+ if (lp->lnd_item[I_FOOD] < get_minimum(lp, I_FOOD))
+ return 0;
+ }
+ return lp->lnd_item[I_SHELL] >= get_minimum(lp, I_SHELL);
+}
+
/*
* Actually get the commod
*/
}
int
-has_supply(struct lndstr *lp)
+lnd_could_be_supplied(struct lndstr *lp)
{
int shells_needed, shells, keepshells;
int food, food_needed, keepfood;