leocad/common/group.cpp

38 lines
688 B
C++
Raw Normal View History

#include "lc_global.h"
2011-09-07 23:06:51 +02:00
#include <stdlib.h>
#include "group.h"
#include "lc_file.h"
2011-09-07 23:06:51 +02:00
2014-05-25 03:45:19 +02:00
lcGroup::lcGroup()
2011-09-07 23:06:51 +02:00
{
2014-05-25 03:45:19 +02:00
mGroup = NULL;
2011-09-07 23:06:51 +02:00
}
2014-05-25 03:45:19 +02:00
lcGroup::~lcGroup()
2011-09-07 23:06:51 +02:00
{
}
2014-05-25 20:23:09 +02:00
void lcGroup::FileLoad(lcFile* File)
2011-09-07 23:06:51 +02:00
{
2014-05-25 20:23:09 +02:00
lcuint8 Version;
lcint32 GroupIndex;
Version = File->ReadU8();
File->ReadBuffer(m_strName, 65);
File->ReadVector3();
File->ReadS32(&GroupIndex, 1);
mGroup = (lcGroup*)(long)GroupIndex;
2011-09-07 23:06:51 +02:00
}
2014-05-25 20:23:09 +02:00
void lcGroup::FileSave(lcFile* File, const lcArray<lcGroup*>& Groups)
2011-09-07 23:06:51 +02:00
{
2014-05-25 20:23:09 +02:00
lcuint8 Version = 1; // LeoCAD 0.60
2011-09-07 23:06:51 +02:00
2014-05-25 20:23:09 +02:00
File->WriteU8(Version);
File->WriteBuffer(m_strName, 65);
File->WriteVector3(lcVector3(0.0f, 0.0f, 0.0f));
2011-09-07 23:06:51 +02:00
2014-05-25 03:45:19 +02:00
lcint32 GroupIndex = Groups.FindIndex(mGroup);
2014-05-25 20:23:09 +02:00
File->WriteS32(&GroupIndex, 1);
2011-09-07 23:06:51 +02:00
}