fix bug in scriptapi line_of_sight
authorsapier <Sapier at GMX dot net>
Tue, 9 Apr 2013 18:33:59 +0000 (20:33 +0200)
committerkwolekr <kwolekr@minetest.net>
Wed, 10 Apr 2013 20:50:24 +0000 (16:50 -0400)
fix warnings for pathfinder debug traces

src/pathfinder.cpp
src/scriptapi_env.cpp

index c7621177ee951f5dde2f3450ab6415e3bd32a3f2..0d1cfe476cf2567cbe8045f8d7a6d6656ca40832 100644 (file)
@@ -687,9 +687,8 @@ bool pathfinder::update_all_costs(  v3s16 ipos,
 
                                if ((g_pos2.totalcost < 0) ||
                                                (g_pos2.totalcost > new_cost)) {
-                                       int old_cost = g_pos2.totalcost;
                                        DEBUG_OUT(LVL "Pathfinder: updating path at: "<<
-                                                       PPOS(ipos2) << " from: " << old_cost << " to "<<
+                                                       PPOS(ipos2) << " from: " << g_pos2.totalcost << " to "<<
                                                        new_cost << std::endl);
                                        if (update_all_costs(ipos2,invert(directions[i]),
                                                                                        new_cost,level)) {
@@ -847,9 +846,8 @@ bool pathfinder::update_cost_heuristic(     v3s16 ipos,
 
                                if ((g_pos2.totalcost < 0) ||
                                                (g_pos2.totalcost > new_cost)) {
-                                       int old_cost = g_pos2.totalcost;
                                        DEBUG_OUT(LVL "Pathfinder: updating path at: "<<
-                                                       PPOS(ipos2) << " from: " << old_cost << " to "<<
+                                                       PPOS(ipos2) << " from: " << g_pos2.totalcost << " to "<<
                                                        new_cost << " srcdir=" <<
                                                        PPOS(invert(direction))<< std::endl);
                                        if (update_cost_heuristic(ipos2,invert(direction),
index 9bf7f0b556205980d472a890dc0c359921d97d62..efed58e66ed553be454d9035c8d685bf2e1f880a 100644 (file)
@@ -662,9 +662,11 @@ int EnvRef::l_line_of_sight(lua_State *L) {
        v3f pos2 = checkFloatPos(L, 2);
        //read step size from lua
        if(lua_isnumber(L, 3))
-       stepsize = lua_tonumber(L, 3);
+               stepsize = lua_tonumber(L, 3);
 
-       return (env->line_of_sight(pos1,pos2,stepsize));
+       lua_pushboolean(L, env->line_of_sight(pos1,pos2,stepsize));
+
+       return 1;
 }
 
 int EnvRef::l_find_path(lua_State *L)