From dbd845c5e6e9af3b85b1d232309d6c6fe6aaddbf Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Sun, 20 Sep 2009 19:12:59 +0000 Subject: [PATCH] Forced cost function to return a value >= 1. --- src/scripting/lua.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index 778f962cf98..fe910c955ee 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -1378,7 +1378,7 @@ double lua_calculator::cost(const map_location &loc, double so_far) const double cost = lua_tonumber(L, -1); lua_pop(L, 2); - return cost; + return !(cost >= 1.) ? 1. : cost; } lua_calculator::~lua_calculator()