From 2153965cf92ab61b0d7e095cf3c2755924fdc221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Juh=C3=A1sz?= Date: Thu, 1 Dec 2016 20:15:37 +0100 Subject: Line_of_sight: Improve using VoxelLineIterator This commit rewrites line_of_sight with VoxelLineIterator. Stepsize is no longer needed, the results will be always accurate. --- src/serverenvironment.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/serverenvironment.h') diff --git a/src/serverenvironment.h b/src/serverenvironment.h index a15d87ee2..ea295b919 100644 --- a/src/serverenvironment.h +++ b/src/serverenvironment.h @@ -328,8 +328,15 @@ public: // This makes stuff happen void step(f32 dtime); - //check if there's a line of sight between two positions - bool line_of_sight(v3f pos1, v3f pos2, float stepsize=1.0, v3s16 *p=NULL); + /*! + * Returns false if the given line intersects with a + * non-air node, true otherwise. + * \param pos1 start of the line + * \param pos2 end of the line + * \param p output, position of the first non-air node + * the line intersects + */ + bool line_of_sight(v3f pos1, v3f pos2, v3s16 *p = NULL); u32 getGameTime() const { return m_game_time; } -- cgit v1.2.3