summaryrefslogtreecommitdiff
path: root/src/T2DLL/CFilePlugin.cpp
blob: 02442f9d2074d231d8b277eaf8d5b91f864d8b1f (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
46
47
48
49
50
51
52
53
#include "StdAfx.h"
#include "CFilePlugin.h"
#include "CPluginInfo.h"
#include "CResFile.h"

CFilePlugin::CFilePlugin(DWORD type, T2PluginSpecifier& specifier)
	: CPlugin(type, specifier)
{
	mAttrib = 0;
	mGameLevel = 0;

	CResFile file;
	int success = false;
	if (specifier.mIsSubPlugin) {
		success = file.OpenResource(specifier.mPath, 128, 'ATTR');
		specifier.mIsLoaded = true;
	} else {
		success = file.OpenResource(specifier.mInstance, 128, "Attr");
	}

	if (success) {
		file >> mID;
		file >> mAttrib;
		file >> mDependID;
		file >> mGameLevel;
		file >> mSecretItem;
		file >> mItemType;
		file >> mMustItem;
		file >> mPluginName;
	}
}

/*virtual*/ CFilePlugin::~CFilePlugin() {
	Unload();
}

/*virtual*/ void CFilePlugin::GetName(CString& outStr) {
	outStr = mPluginName;
}

/*virtual*/ BOOL CFilePlugin::Load() {
	return true;
}

/*virtual*/ BOOL CFilePlugin::Unload() {
	return true;
}

CPluginInfo* CFilePlugin::GetPluginInfo() {
	char buf[500];
	GetModuleFileName(mModuleHandle, buf, sizeof(buf));
	return new CPluginInfo(mType, mID, mItemType, mMustItem, mPluginName, buf);
}