Skip to content

Commit dda2071

Browse files
sapierkwolekr
sapier
authored andcommittedApr 10, 2013
fix bug in scriptapi line_of_sight
fix warnings for pathfinder debug traces
1 parent 6e4fdf3 commit dda2071

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed
 

‎src/pathfinder.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -687,9 +687,8 @@ bool pathfinder::update_all_costs( v3s16 ipos,
687687

688688
if ((g_pos2.totalcost < 0) ||
689689
(g_pos2.totalcost > new_cost)) {
690-
int old_cost = g_pos2.totalcost;
691690
DEBUG_OUT(LVL "Pathfinder: updating path at: "<<
692-
PPOS(ipos2) << " from: " << old_cost << " to "<<
691+
PPOS(ipos2) << " from: " << g_pos2.totalcost << " to "<<
693692
new_cost << std::endl);
694693
if (update_all_costs(ipos2,invert(directions[i]),
695694
new_cost,level)) {
@@ -847,9 +846,8 @@ bool pathfinder::update_cost_heuristic( v3s16 ipos,
847846

848847
if ((g_pos2.totalcost < 0) ||
849848
(g_pos2.totalcost > new_cost)) {
850-
int old_cost = g_pos2.totalcost;
851849
DEBUG_OUT(LVL "Pathfinder: updating path at: "<<
852-
PPOS(ipos2) << " from: " << old_cost << " to "<<
850+
PPOS(ipos2) << " from: " << g_pos2.totalcost << " to "<<
853851
new_cost << " srcdir=" <<
854852
PPOS(invert(direction))<< std::endl);
855853
if (update_cost_heuristic(ipos2,invert(direction),

‎src/scriptapi_env.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -662,9 +662,11 @@ int EnvRef::l_line_of_sight(lua_State *L) {
662662
v3f pos2 = checkFloatPos(L, 2);
663663
//read step size from lua
664664
if(lua_isnumber(L, 3))
665-
stepsize = lua_tonumber(L, 3);
665+
stepsize = lua_tonumber(L, 3);
666666

667-
return (env->line_of_sight(pos1,pos2,stepsize));
667+
lua_pushboolean(L, env->line_of_sight(pos1,pos2,stepsize));
668+
669+
return 1;
668670
}
669671

670672
int EnvRef::l_find_path(lua_State *L)

0 commit comments

Comments
 (0)
Please sign in to comment.