Noise: Prevent unittest crash caused by division by zero
[oweals/minetest.git] / src / content_cso.cpp
index c337472ffa93b0d406e0b8cf85a5a850f52630e0..10d1f498b82b74fe47d731540dcaa8ef2f55c0ea 100644 (file)
@@ -20,37 +20,23 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 #include "content_cso.h"
 #include <IBillboardSceneNode.h>
 #include "client/tile.h"
-#include "environment.h"
-#include "gamedef.h"
-#include "log.h"
+#include "clientenvironment.h"
+#include "client.h"
 #include "map.h"
 
-/*
-static void setBillboardTextureMatrix(scene::IBillboardSceneNode *bill,
-               float txs, float tys, int col, int row)
-{
-       video::SMaterial& material = bill->getMaterial(0);
-       core::matrix4& matrix = material.getTextureMatrix(0);
-       matrix.setTextureTranslate(txs*col, tys*row);
-       matrix.setTextureScale(txs, tys);
-}
-*/
-
 class SmokePuffCSO: public ClientSimpleObject
 {
-       float m_age;
-       scene::IBillboardSceneNode *m_spritenode;
+       float m_age = 0.0f;
+       scene::IBillboardSceneNode *m_spritenode = nullptr;
 public:
        SmokePuffCSO(scene::ISceneManager *smgr,
-                       ClientEnvironment *env, v3f pos, v2f size):
-               m_age(0),
-               m_spritenode(NULL)
+                       ClientEnvironment *env, v3f pos, v2f size)
        {
                infostream<<"SmokePuffCSO: constructing"<<std::endl;
                m_spritenode = smgr->addBillboardSceneNode(
                                NULL, v2f(1,1), pos, -1);
                m_spritenode->setMaterialTexture(0,
-                               env->getGameDef()->tsrc()->getTexture("smoke_puff.png"));
+                               env->getGameDef()->tsrc()->getTextureForMesh("smoke_puff.png"));
                m_spritenode->setMaterialFlag(video::EMF_LIGHTING, false);
                m_spritenode->setMaterialFlag(video::EMF_BILINEAR_FILTER, false);
                //m_spritenode->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);