From fd90db66af474f5f262ecc1e959888e2a548099c Mon Sep 17 00:00:00 2001 From: Alberth Date: Thu, 15 Jan 2015 21:44:27 +0100 Subject: [PATCH] Fix: Only add town destinations when the center allows receiving cargo. --- main.nut | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/main.nut b/main.nut index 02e4185..c76f6a9 100644 --- a/main.nut +++ b/main.nut @@ -174,11 +174,24 @@ function BusyBeeClass::FindDestinations(cargo_index, company) local rating = GSTown.GetRating(town, company); if (rating in acceptable_ratings) { local loc = GSTown.GetLocation(town); - dests[num_dests] <- {town=town, loc=loc}; - num_dests += 1; + local amount = GSTile.GetCargoAcceptance(loc, cargo.cid, 1, 1, 4); + if (amount > 8) { + dests[num_dests] <- {town=town, loc=loc}; + num_dests += 1; + } } } } +// Dump destinations for a cargo. +// GSLog.Info("Destinations for " + GSCargo.GetCargoLabel(cargo.cid)); +// foreach (_, dst in dests) { +// if ("ind" in dst) { +// GSLog.Info("Industry " + GSIndustry.GetName(dst.ind) + " accepts"); +// } else { +// GSLog.Info("Town " + GSTown.GetName(dst.town) + " accepts"); +// } +// } +// GSLog.Info(""); return dests; }