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.
(cherry picked from commit 7f17369491)
This commit is contained in:
Markus Armbruster 2008-05-28 07:35:22 +02:00 committed by Markus Armbruster
parent d3a2130b26
commit 2410535a05

View file

@ -124,7 +124,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);
}
@ -135,7 +135,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);