summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2SubPlugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/T2DLL/T2SubPlugin.cpp68
1 files changed, 68 insertions, 0 deletions
diff --git a/src/T2DLL/T2SubPlugin.cpp b/src/T2DLL/T2SubPlugin.cpp
new file mode 100644
index 0000000..fbdbe01
--- /dev/null
+++ b/src/T2DLL/T2SubPlugin.cpp
@@ -0,0 +1,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;
+ mBitImage = NULL;
+ mImageObj = NULL;
+}
+
+/*virtual*/ T2SubPlugin::~T2SubPlugin() {
+ if (mTieup)
+ delete mTieup;
+ if (mBitImage)
+ delete mBitImage;
+ if (mImageObj)
+ delete mImageObj;
+}
+
+int T2SubPlugin::IsTieupFinish() {
+ int 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);
+ }
+}