summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2DateTime.cpp
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-07-01 02:43:29 +0100
committerAsh Wolf <ninji@wuffs.org>2023-07-01 02:43:29 +0100
commit5c6a48b2ff362a70416a6a00fda7d06e0f276f2d (patch)
tree62cf542c68d91aa6f7a4e3bfa9eddca4ab352970 /src/T2DLL/T2DateTime.cpp
parentc0c336500955a23e344651e5412c9d9d441ef4ee (diff)
downloadt2win-5c6a48b2ff362a70416a6a00fda7d06e0f276f2d.tar.gz
t2win-5c6a48b2ff362a70416a6a00fda7d06e0f276f2d.zip
i am in hell
Diffstat (limited to '')
-rw-r--r--src/T2DLL/T2DateTime.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/T2DLL/T2DateTime.cpp b/src/T2DLL/T2DateTime.cpp
index 023fb98..9938e93 100644
--- a/src/T2DLL/T2DateTime.cpp
+++ b/src/T2DLL/T2DateTime.cpp
@@ -1,5 +1,7 @@
#include "T2Archive.h"
#include "T2DateTime.h"
+#include "T2TowerDoc.h"
+#include "T2WorldPlugin.h"
T2DateTime::T2DateTime() {
mYear = 0;
@@ -100,20 +102,20 @@ BOOL T2DateTime::WithinHour(int a, int b) const {
}
BOOL T2DateTime::WithinMinutes(int a, int b) const {
- BOOL ret = true;
+ BOOL isWithin = true;
- int minA = AdjustMinutes(a);
- int minB = AdjustMinutes(b);
+ int minL = AdjustMinutes(a);
+ int minR = AdjustMinutes(b);
- if (minA < minB) {
- if ((mRawMinutes < minA) || (mRawMinutes >= minB))
- ret = false;
- } else if (minA > minB) {
- if ((mRawMinutes >= minB) && (mRawMinutes < minA))
- ret = false;
+ if (minL < minR) {
+ if ((mRawMinutes < minL) || (mRawMinutes >= minR))
+ isWithin = false;
+ } else if (minL > minR) {
+ if ((mRawMinutes >= minR) && (mRawMinutes < minL))
+ isWithin = false;
}
- return ret;
+ return isWithin;
}
int T2DateTime::AdjustMinutes(int m) const {
@@ -137,8 +139,8 @@ int T2DateTime::AdjustMinutes(int m) const {
}
BOOL T2DateTime::IsHoliday(T2TowerDoc* doc) {
- // TODO virt
- return false;
+ T2WorldPlugin *thePlugin = doc->mWorldPlugin;
+ return thePlugin->IsHoliday(this);
}
void T2DateTime::Validate() {