updated pthfinding.cpp