Introduce Player::getLightPosition
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Wed, 10 Aug 2011 05:38:51 +0000 (07:38 +0200)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Thu, 11 Aug 2011 13:22:35 +0000 (15:22 +0200)
This is currently only used in the lighting update for remote
players in client.

src/environment.cpp
src/player.h

index 680d209fc2dbdf87b66e23a6f4659c0e284b8a77..e293eb511f3ac0ddebdcce429582bebd218d66de 100644 (file)
@@ -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());
                        }
index b91c3cb1b71074709b63f66104bc8119ea506ef8..00a1d440832995fd23467bd807815c92f8996f85 100644 (file)
@@ -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;