From 7f17369491f9d6a01f35d1017d9da49b308f80b4 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 28 May 2008 07:35:22 +0200 Subject: [PATCH] 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. --- src/lib/subs/supply.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/subs/supply.c b/src/lib/subs/supply.c index 9f998a27..dcff9455 100644 --- a/src/lib/subs/supply.c +++ b/src/lib/subs/supply.c @@ -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);