From: Giuseppe Bilotta Date: Wed, 10 Aug 2011 05:38:51 +0000 (+0200) Subject: Introduce Player::getLightPosition X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=98fa00db12b4658f6bce61f0a2c03c69b963f8f2;p=zefram%2Fminetest%2Fminetest_engine.git Introduce Player::getLightPosition This is currently only used in the lighting update for remote players in client. --- diff --git a/src/environment.cpp b/src/environment.cpp index 680d209f..e293eb51 100644 --- a/src/environment.cpp +++ b/src/environment.cpp @@ -1653,7 +1653,7 @@ void ClientEnvironment::step(float dtime) u8 light = LIGHT_MAX; try{ // Get node at head - v3s16 p = floatToInt(playerpos + v3f(0,BS+BS/2,0), BS); + v3s16 p = player->getLightPosition(); MapNode n = m_map->getNode(p); light = n.getLightBlend(getDayNightRatio()); } diff --git a/src/player.h b/src/player.h index b91c3cb1..00a1d440 100644 --- a/src/player.h +++ b/src/player.h @@ -62,6 +62,11 @@ public: return m_position; } + v3s16 getLightPosition() const + { + return floatToInt(m_position + v3f(0,BS+BS/2,0), BS); + } + virtual void setPosition(const v3f &position) { m_position = position;