Don't run supply machinery to get zero units

Change supply_commod() and try_supply_commod() not to call s_commod()
when zero units are wanted.

This isn't just for efficiency, it's also for limiting exposure to
supply bugs a bit.
This commit is contained in:
Markus Armbruster 2008-05-28 07:35:22 +02:00
parent 84c4ddd994
commit 7f17369491

View file

@ -109,7 +109,7 @@ resupply_commod(struct lndstr *lp, i_type type)
int
supply_commod(int own, int x, int y, i_type type, int total_wanted)
{
if (total_wanted < 0)
if (total_wanted <= 0)
return 0;
return s_commod(own, x, y, type, total_wanted, !player->simulation);
}
@ -120,7 +120,7 @@ supply_commod(int own, int x, int y, i_type type, int total_wanted)
static int
try_supply_commod(int own, int x, int y, i_type type, int total_wanted)
{
if (total_wanted < 0)
if (total_wanted <= 0)
return 0;
return s_commod(own, x, y, type, total_wanted, 0);