#include "CResFile.h" #include "T2PeopleDef.h" #include "T2PeopleLoader.h" #include "T2SilhouetteDef.h" #include "T2TemplatePluginDB.h" #include "T2TemplatePluginList.h" /*static*/ void T2PeopleLoader::Load(T2PluginSpecifier* specifier, T2TemplatePluginDB* db) { LoadSilhouette(specifier, db); LoadPeople(specifier, db); } /*static*/ void T2PeopleLoader::Unload(T2TemplatePluginDB* db) { LArrayIterator silhouetteIterator(*db->GetTemplatePluginList('SlDf')); T2SilhouetteDef *silhouetteDef; while (silhouetteIterator.Next(&silhouetteDef)) delete silhouetteDef; LArrayIterator peopleIterator(*db->GetTemplatePluginList('PPDf')); T2PeopleDef *peopleDef; while (peopleIterator.Next(&peopleDef)) delete peopleDef; } /*static*/ BOOL T2PeopleLoader::LoadSilhouette(T2PluginSpecifier* specifier, T2TemplatePluginDB* db) { CResFile resFile; if (resFile.OpenResource(specifier->mInstance, 1, 'SlDf')) { T2TemplatePluginList *silhouetteList = db->GetTemplatePluginList('SlDf'); int count; resFile >> count; for (int i = 0; i < count; i++) { #line 47 T2SilhouetteDef *silhouetteDef = DEBUG_NEW T2SilhouetteDef('SlDf', *specifier, &resFile); if (!silhouetteList->FindSilhouette(silhouetteDef->GetSilhouetteType())) silhouetteList->Add(silhouetteDef); else delete silhouetteDef; } return true; } return false; } /*static*/ BOOL T2PeopleLoader::LoadPeople(T2PluginSpecifier* specifier, T2TemplatePluginDB* db) { CResFile resFile; if (resFile.OpenResource(specifier->mInstance, 1, 'PPDf')) { T2TemplatePluginList *peopleList = db->GetTemplatePluginList('PPDf'); T2TemplatePluginList *silhouetteList = db->GetTemplatePluginList('SlDf'); int count; resFile >> count; for (int i = 0; i < count; i++) { #line 70 T2PeopleDef *peopleDef = DEBUG_NEW T2PeopleDef('PPDf', *specifier, &resFile); if (!peopleList->FindPeopleDef(peopleDef->GetPeopleType())) { peopleDef->AssignSilhouette(silhouetteList); peopleList->Add(peopleDef); } else { delete peopleDef; } } return true; } return false; }