use_supply() is now unused, remove
This commit is contained in:
parent
f6c87d21ff
commit
055c80a41f
2 changed files with 0 additions and 74 deletions
|
@ -692,7 +692,6 @@ extern void resupply_commod(struct lndstr *, i_type);
|
|||
extern int supply_commod(int, int, int, i_type, int);
|
||||
extern int try_supply_commod(int, int, int, i_type, int);
|
||||
extern int has_supply(struct lndstr *);
|
||||
extern int use_supply(struct lndstr *);
|
||||
/* takeover.c */
|
||||
extern void takeover_land(struct lndstr *, natid, int);
|
||||
extern void takeover(struct sctstr *, natid);
|
||||
|
|
|
@ -527,76 +527,3 @@ has_supply(struct lndstr *lp)
|
|||
/* end opt_FUEL */
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
use_supply(struct lndstr *lp)
|
||||
{
|
||||
int shells_needed, shells, food, food_needed;
|
||||
int fuel_needed, fuel, petrol_needed, petrol;
|
||||
|
||||
shells_needed = lp->lnd_ammo;
|
||||
shells = lp->lnd_item[I_SHELL];
|
||||
if (shells < shells_needed) {
|
||||
lp->lnd_item[I_SHELL] = 0;
|
||||
putland(lp->lnd_uid, lp);
|
||||
shells += supply_commod(lp->lnd_own, lp->lnd_x, lp->lnd_y,
|
||||
I_SHELL, shells_needed - shells);
|
||||
lp->lnd_item[I_SHELL] = shells;
|
||||
}
|
||||
|
||||
lp->lnd_item[I_SHELL] = MAX(lp->lnd_item[I_SHELL] - shells_needed, 0);
|
||||
|
||||
if (lp->lnd_dam) /* artillery */
|
||||
goto done;
|
||||
|
||||
food_needed = get_minimum(lp, I_FOOD);
|
||||
food = lp->lnd_item[I_SHELL];
|
||||
|
||||
if (food < food_needed) {
|
||||
lp->lnd_item[I_FOOD] = 0;
|
||||
putland(lp->lnd_uid, lp);
|
||||
food += supply_commod(lp->lnd_own, lp->lnd_x, lp->lnd_y,
|
||||
I_FOOD, food_needed - food);
|
||||
lp->lnd_item[I_FOOD] = food;
|
||||
}
|
||||
|
||||
lp->lnd_item[I_FOOD] = MAX(lp->lnd_item[I_FOOD] - food_needed, 0);
|
||||
|
||||
if (opt_FUEL) {
|
||||
fuel_needed = lp->lnd_fuelu;
|
||||
fuel = lp->lnd_fuel;
|
||||
|
||||
petrol = petrol_needed = 0;
|
||||
|
||||
if (fuel < fuel_needed) {
|
||||
petrol_needed =
|
||||
ldround((fuel_needed - fuel) / 10.0, 1);
|
||||
petrol = lp->lnd_item[I_PETROL];
|
||||
}
|
||||
|
||||
if (petrol < petrol_needed) {
|
||||
lp->lnd_item[I_PETROL] = 0;
|
||||
putland(lp->lnd_uid, lp);
|
||||
petrol += supply_commod(lp->lnd_own, lp->lnd_x, lp->lnd_y,
|
||||
I_PETROL, petrol_needed - petrol);
|
||||
lp->lnd_item[I_PETROL] = petrol;
|
||||
}
|
||||
|
||||
if (petrol_needed) {
|
||||
if (petrol >= petrol_needed) {
|
||||
lp->lnd_item[I_PETROL]
|
||||
= MAX(lp->lnd_item[I_PETROL] - petrol_needed, 0);
|
||||
lp->lnd_fuel += petrol_needed * 10;
|
||||
} else {
|
||||
lp->lnd_fuel += lp->lnd_item[I_PETROL] * 10;
|
||||
lp->lnd_item[I_PETROL] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
lp->lnd_fuel = MAX(lp->lnd_fuel - fuel_needed, 0);
|
||||
}
|
||||
/* end opt_FUEL */
|
||||
done:
|
||||
putland(lp->lnd_uid, lp);
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue