fixed warnings
[xonotic/netradiant.git] / contrib / bobtoolz / DBrush.cpp
index 75b2a6e84cd3217be60e7e50f7f14cd6f0bd9b06..96c884d22e69528ecab72a4861f7e488d7b7cbbd 100644 (file)
@@ -55,6 +55,7 @@ DBrush::DBrush(int ID)
 {
        m_nBrushID = ID;
        bBoundsBuilt = false;
 {
        m_nBrushID = ID;
        bBoundsBuilt = false;
+       QER_entity = NULL;
        QER_brush = NULL;
 }
 
        QER_brush = NULL;
 }
 
@@ -125,7 +126,7 @@ int DBrush::BuildPoints()
 //     Sys_Printf("%i points on brush\n", pointList.size());
 #endif
 
 //     Sys_Printf("%i points on brush\n", pointList.size());
 #endif
 
-       return pointList.size();
+       return static_cast<int>(pointList.size());
 }
 
 void DBrush_addFace(DBrush& brush, const _QERFaceData& faceData)
 }
 
 void DBrush_addFace(DBrush& brush, const _QERFaceData& faceData)
@@ -140,14 +141,15 @@ void DBrush_addFaceTextured(DBrush& brush, const _QERFaceData& faceData)
 }
 typedef ReferenceCaller1<DBrush, const _QERFaceData&, DBrush_addFaceTextured> DBrushAddFaceTexturedCaller;
 
 }
 typedef ReferenceCaller1<DBrush, const _QERFaceData&, DBrush_addFaceTextured> DBrushAddFaceTexturedCaller;
 
-void DBrush::LoadFromBrush(scene::Node& brush, bool textured)
+void DBrush::LoadFromBrush(scene::Instance& brush, bool textured)
 {
        ClearFaces();
        ClearPoints();
 
 {
        ClearFaces();
        ClearPoints();
 
-  GlobalBrushCreator().forEachBrushFace(brush, textured ? BrushFaceDataCallback(DBrushAddFaceTexturedCaller(*this)) : BrushFaceDataCallback(DBrushAddFaceCaller(*this)));
+  GlobalBrushCreator().Brush_forEachFace(brush.path().top(), textured ? BrushFaceDataCallback(DBrushAddFaceTexturedCaller(*this)) : BrushFaceDataCallback(DBrushAddFaceCaller(*this)));
 
 
-       QER_brush = &brush;
+  QER_entity = brush.path().parent().get_pointer();
+       QER_brush = brush.path().top().get_pointer();
 }
 
 int DBrush::PointPosition(vec3_t pnt)
 }
 
 int DBrush::PointPosition(vec3_t pnt)
@@ -394,7 +396,7 @@ scene::Node* DBrush::BuildInRadiant(bool allowDestruction, int* changeCnt, scene
        }
        //-djbob
 
        }
        //-djbob
 
-  scene::Node& node = GlobalBrushCreator().createBrush();
+  NodeSmartReference node(GlobalBrushCreator().createBrush());
 
        for(std::list<DPlane *>::const_iterator buildPlane=faceList.begin(); buildPlane!=faceList.end(); buildPlane++) {
                if((*buildPlane)->AddToBrush(node) && changeCnt) {
 
        for(std::list<DPlane *>::const_iterator buildPlane=faceList.begin(); buildPlane!=faceList.end(); buildPlane++) {
                if((*buildPlane)->AddToBrush(node) && changeCnt) {
@@ -408,7 +410,10 @@ scene::Node* DBrush::BuildInRadiant(bool allowDestruction, int* changeCnt, scene
                Node_getTraversable(GlobalRadiant().getMapWorldEntity())->insert(node);
        }
 
                Node_getTraversable(GlobalRadiant().getMapWorldEntity())->insert(node);
        }
 
-       return &node;
+  QER_entity = entity;
+  QER_brush = node.get_pointer();
+
+       return node.get_pointer();
 }
 
 void DBrush::CutByPlane(DPlane *cutPlane, DBrush **newBrush1, DBrush **newBrush2)
 }
 
 void DBrush::CutByPlane(DPlane *cutPlane, DBrush **newBrush1, DBrush **newBrush2)