1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
#include "StdAfx.h"
#include "CResFile.h"
#include "T2PeopleDef.h"
#include "T2PeopleLoader.h"
#include "T2SilhouetteDef.h"
#include "T2TemplatePluginDB.h"
#include "T2TemplatePluginList.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/*static*/ void T2PeopleLoader::Load(T2PluginSpecifier* specifier, T2TemplatePluginDB* db) {
LoadSilhouette(specifier, db);
LoadPeople(specifier, db);
}
/*static*/ void T2PeopleLoader::Unload(T2TemplatePluginDB* db) {
LArrayIterator silhouetteIter(*db->GetTemplatePluginList('SlDf'));
T2SilhouetteDef *silhouetteDef;
while (silhouetteIter.Next(&silhouetteDef))
delete silhouetteDef;
LArrayIterator peopleIter(*db->GetTemplatePluginList('PPDf'));
T2PeopleDef *peopleDef;
while (peopleIter.Next(&peopleDef))
delete peopleDef;
}
/*static*/ BOOL T2PeopleLoader::LoadSilhouette(T2PluginSpecifier* specifier, T2TemplatePluginDB* db) {
CResFile resFile;
if (resFile.OpenResource(specifier->mInstance, 1, 'SlDf')) {
T2TemplatePluginList *silhouetteDefList = db->GetTemplatePluginList('SlDf');
int numOfDefs;
resFile >> numOfDefs;
for (int index = 0; index < numOfDefs; index++) {
#line 47
T2SilhouetteDef *silhouetteDef = new T2SilhouetteDef('SlDf', *specifier, &resFile);
if (!silhouetteDefList->FindSilhouette(silhouetteDef->GetSilhouetteType()))
silhouetteDefList->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 *peopleDefList = db->GetTemplatePluginList('PPDf');
T2TemplatePluginList *silhouetteDefList = db->GetTemplatePluginList('SlDf');
int numOfDefs;
resFile >> numOfDefs;
for (int index = 0; index < numOfDefs; index++) {
#line 70
T2PeopleDef *peopleDef = new T2PeopleDef('PPDf', *specifier, &resFile);
if (!peopleDefList->FindPeopleDef(peopleDef->GetPeopleType())) {
peopleDef->AssignSilhouette(silhouetteDefList);
peopleDefList->Add(peopleDef);
} else {
delete peopleDef;
}
}
return true;
}
return false;
}
|