@ -29,6 +29,7 @@
# include "editable_poly.h"
# include "editable_poly.h"
// STL includes
// STL includes
# include <iomanip>
// NeL includes
// NeL includes
// #include <nel/misc/debug.h>
// #include <nel/misc/debug.h>
@ -50,7 +51,12 @@ CEditablePoly::CEditablePoly(CScene *scene) : CPolyObject(scene)
CEditablePoly : : ~ CEditablePoly ( )
CEditablePoly : : ~ CEditablePoly ( )
{
{
if ( ! m_ChunksOwnsPointers )
{
for ( TStorageObjectContainer : : iterator it = m_EditablePolyUnknown . begin ( ) , end = m_EditablePolyUnknown . end ( ) ; it ! = end ; + + it )
delete it - > second ;
m_EditablePolyUnknown . clear ( ) ;
}
}
}
const ucstring CEditablePoly : : DisplayName = ucstring ( " EditablePoly " ) ;
const ucstring CEditablePoly : : DisplayName = ucstring ( " EditablePoly " ) ;
@ -62,6 +68,26 @@ const CEditablePolyClassDesc EditablePolyClassDesc(&DllPluginDescEPoly);
void CEditablePoly : : parse ( uint16 version , uint filter )
void CEditablePoly : : parse ( uint16 version , uint filter )
{
{
CPolyObject : : parse ( version ) ;
CPolyObject : : parse ( version ) ;
IStorageObject * so ;
so = getChunk ( 0x4039 ) ;
if ( so ) m_EditablePolyUnknown . push_back ( TStorageObjectWithId ( 0x4039 , so ) ) ;
so = getChunk ( 0x403a ) ;
if ( so ) m_EditablePolyUnknown . push_back ( TStorageObjectWithId ( 0x403a , so ) ) ;
for ( ; ; )
{ // note: also in editable mesh, copy paste or related somehow? / use a common parser class inbetween?
so = getChunk ( 0x3003 ) ;
if ( so ) m_EditablePolyUnknown . push_back ( TStorageObjectWithId ( 0x3003 , so ) ) ;
else break ;
so = getChunk ( 0x3004 ) ;
if ( so ) m_EditablePolyUnknown . push_back ( TStorageObjectWithId ( 0x3004 , so ) ) ;
}
so = getChunk ( 0x3002 ) ;
if ( so ) m_EditablePolyUnknown . push_back ( TStorageObjectWithId ( 0x3002 , so ) ) ;
so = getChunk ( 0x4038 ) ;
if ( so ) m_EditablePolyUnknown . push_back ( TStorageObjectWithId ( 0x4038 , so ) ) ;
CPolyObject : : parse ( version , PMB_POLY_OBJECT_PARSE_FILTER ) ;
}
}
void CEditablePoly : : clean ( )
void CEditablePoly : : clean ( )
@ -72,6 +98,11 @@ void CEditablePoly::clean()
void CEditablePoly : : build ( uint16 version , uint filter )
void CEditablePoly : : build ( uint16 version , uint filter )
{
{
CPolyObject : : build ( version ) ;
CPolyObject : : build ( version ) ;
for ( TStorageObjectContainer : : iterator it = m_EditablePolyUnknown . begin ( ) , end = m_EditablePolyUnknown . end ( ) ; it ! = end ; + + it )
putChunk ( it - > first , it - > second ) ;
CPolyObject : : build ( version , PMB_POLY_OBJECT_PARSE_FILTER ) ;
}
}
void CEditablePoly : : disown ( )
void CEditablePoly : : disown ( )
@ -98,6 +129,20 @@ const ISceneClassDesc *CEditablePoly::classDesc() const
void CEditablePoly : : toStringLocal ( std : : ostream & ostream , const std : : string & pad , uint filter ) const
void CEditablePoly : : toStringLocal ( std : : ostream & ostream , const std : : string & pad , uint filter ) const
{
{
CPolyObject : : toStringLocal ( ostream , pad ) ;
CPolyObject : : toStringLocal ( ostream , pad ) ;
std : : string padpad = pad + " \t " ;
sint i = 0 ;
for ( TStorageObjectContainer : : const_iterator it = m_EditablePolyUnknown . begin ( ) , end = m_EditablePolyUnknown . end ( ) ; it ! = end ; + + it )
{
std : : stringstream ss ;
ss < < std : : hex < < std : : setfill ( ' 0 ' ) ;
ss < < std : : setw ( 4 ) < < it - > first ;
ostream < < " \n " < < pad < < " EditablePolyUnkown[ " < < i < < " ] 0x " < < ss . str ( ) < < " : " ;
it - > second - > toString ( ostream , padpad ) ;
+ + i ;
}
CPolyObject : : toStringLocal ( ostream , pad , PMB_POLY_OBJECT_PARSE_FILTER ) ;
}
}
IStorageObject * CEditablePoly : : createChunkById ( uint16 id , bool container )
IStorageObject * CEditablePoly : : createChunkById ( uint16 id , bool container )