Complete disaster-recovery snapshot: engine/game source, game data assets, VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive. Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false, no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
77 lines
1.8 KiB
C++
77 lines
1.8 KiB
C++
// FileNode.cpp: implementation of the CFileNode class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#include "stdafx.h"
|
|
#include "Megatron.h"
|
|
#include "FileNode.h"
|
|
|
|
#ifdef _DEBUG
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[]=__FILE__;
|
|
#define new DEBUG_NEW
|
|
#endif
|
|
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Construction/Destruction
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
CFileNode::CFileNode(CString filename)
|
|
{
|
|
strName = filename;
|
|
pFile = new Stuff::NotationFile(filename);
|
|
ReadBuildFile(pFile);
|
|
pParent = NULL;
|
|
}
|
|
|
|
CFileNode::~CFileNode()
|
|
{
|
|
delete pFile;
|
|
POSITION pos = listChildren.GetHeadPosition();
|
|
while (pos)
|
|
{
|
|
CFileNode *pChild = (CFileNode *)listChildren.GetNext(pos);
|
|
delete pChild;
|
|
}
|
|
}
|
|
|
|
int CFileNode::ReadBuildFile(Stuff::NotationFile *notefile)
|
|
{
|
|
int count = 0;
|
|
Stuff::NotationFile::PageIterator *pages = notefile->MakePageIterator();
|
|
Register_Object(pages);
|
|
Stuff::Page *page;
|
|
while (page = pages->ReadAndNext())
|
|
{
|
|
CString pagename = page->GetName();
|
|
if (pagename.GetLength() ==0)
|
|
{
|
|
Stuff::Page::NoteIterator *notes = page->MakeNoteIterator();
|
|
Stuff::Note *note;
|
|
while (note = notes->ReadAndNext())
|
|
{
|
|
count++;
|
|
CString notename = note->GetName();
|
|
|
|
notename = "content\\"+notename;
|
|
CFileNode *pNode = new CFileNode(notename);
|
|
listChildren.AddHead(pNode);
|
|
pNode->pParent = this;
|
|
|
|
{
|
|
Stuff::NotationFile entryfile;
|
|
note->GetEntry(&entryfile);
|
|
{
|
|
CString entryfilename = entryfile.GetFileName();
|
|
count += pNode->ReadBuildFile(&entryfile);
|
|
}
|
|
}
|
|
|
|
}
|
|
delete notes;
|
|
}
|
|
}
|
|
Unregister_Object(pages);
|
|
delete pages;
|
|
return count;
|
|
} |