summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2MoviePluginList.cpp
blob: 976c00dca3a304862d8b5278252e391cafadae01 (plain)
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
#include "T2Archive.h"
#include "T2MoviePlugin.h"
#include "T2MoviePluginList.h"

T2MoviePluginList::T2MoviePluginList()
    : CFilePluginList('MoPl')
{
}

/*virtual*/ T2MoviePluginList::~T2MoviePluginList() {
}

void T2MoviePluginList::Read(T2Archive& inArchive) {
    unsigned int i, count;
    T2MoviePlugin *thePlugin;

    inArchive >> count;
    for (i = 0; i < count; i++) {
        DWORD id;
        inArchive >> id;

        thePlugin = (T2MoviePlugin *) GetItem(id);
        if (thePlugin)
            thePlugin->Read(inArchive);
        else
            T2MoviePlugin::sDummyRead(inArchive);
    }
}

void T2MoviePluginList::Write(T2Archive& inArchive) {
    unsigned int count;
    T2MoviePlugin *thePlugin;

    count = GetCount();
    inArchive << count;

    POSITION pos = GetHeadPosition();
    while (pos) {
        thePlugin = (T2MoviePlugin *) GetNext(pos);

        DWORD id = thePlugin->GetID();
        inArchive << id;
        thePlugin->Write(inArchive);
    }
}