From 055c80a41fb49ba86423c5c129acda4552b57206 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 3 Mar 2008 08:31:03 +0100 Subject: [PATCH] use_supply() is now unused, remove --- include/prototypes.h | 1 - src/lib/subs/supply.c | 73 ------------------------------------------- 2 files changed, 74 deletions(-) diff --git a/include/prototypes.h b/include/prototypes.h index 4a10d416..1ce9be30 100644 --- a/include/prototypes.h +++ b/include/prototypes.h @@ -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); diff --git a/src/lib/subs/supply.c b/src/lib/subs/supply.c index 9c56da88..7792ef98 100644 --- a/src/lib/subs/supply.c +++ b/src/lib/subs/supply.c @@ -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; -}