summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2SubPlugin.cpp
blob: 4d265a79d815ebc41a42bc6324d16b2ca58be96b (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "CResFile.h"
#include "T2BitImage.h"
#include "T2ImageObj.h"
#include "T2SubPlugin.h"

T2SubPlugin::T2SubPlugin(DWORD type, T2PluginSpecifier& specifier)
	: CResourcePlugin(type, specifier)
{
	mDupCustomerTableDefRes = false;
	mTieup = 0;
	mTitle[0] = 0;
	mTieup = NULL;
	mOpenTime = 0;
	mCloseTime = 0;
    mImage = NULL;
	mImageObj = NULL;
}

/*virtual*/ T2SubPlugin::~T2SubPlugin() {
	if (mTieup)
		delete mTieup;
	if (mImage)
		delete mImage;
	if (mImageObj)
		delete mImageObj;
}

BOOL T2SubPlugin::IsTieupFinish() {
	BOOL result = false;

	if (mTieup) {
		CTime now = CTime::GetTickCount();
		if (*mTieup < now)
			result = true;
	}

	return result;
}

/*virtual*/ void T2SubPlugin::GetTitle(CString& outStr) {
	outStr = mTitle;
}

/*virtual*/ void T2SubPlugin::LoadRsrcFromStream(CResFile& resFile) {
	resFile >> mTitle;

	unsigned int t;
	resFile >> t;
	if (t != 0) {
		int year = (t >> 28) & 0xF;
		year *= 10;
		year += (t >> 24) & 0xF;
		year *= 10;
		year += (t >> 20) & 0xF;
		year *= 10;
		year += (t >> 16) & 0xF;

		int month = (t >> 12) & 0xF;
		month *= 10;
		month += (t >> 8) & 0xF;

		int day = (t >> 4) & 0xF;
		day *= 10;
		day += (t & 0xF) + 1;

		mTieup = new CTime(year, month, day, 0, 0, 0);
	}
}