X-Git-Url: https://ruin.nu/git/?p=icfp05.git;a=blobdiff_plain;f=botsrc%2Fbot.cpp;h=411d933ee50d7bab0ab689b320a753d464cb3f06;hp=a98a42bfb8fc5978a41c7ddcd14ad2b1cd6e0489;hb=7ea4f9f073009ba9a6bbf2fec398b0742f798658;hpb=d9ea67edb4cdaab1f5f7810de640f8fb722a15d1 diff --git a/botsrc/bot.cpp b/botsrc/bot.cpp index a98a42b..411d933 100644 --- a/botsrc/bot.cpp +++ b/botsrc/bot.cpp @@ -369,10 +369,12 @@ std::list Bot::shortestPath(const std::string& from, PlayerType typ return list(); } -SimpleSPGoal::SimpleSPGoal(std::string to):_to(to){ +SimpleSPGoal::SimpleSPGoal(const std::string& to, int limit):_to(to), _limit(limit){ } int SimpleSPGoal::operator()(const SPInfo* node) const{ + if (_limit > 0 && node->cost >= _limit) + return -1; if (node->name == _to) return 1; return 0;