summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSergeanur <s.anureev@yandex.ua>2020-01-27 23:16:38 +0100
committerSergeanur <s.anureev@yandex.ua>2020-01-27 23:16:38 +0100
commitc6b6e9d0df11d408a14e7ea7bbe114e4726e23b8 (patch)
treeb7badc730f4d775b0ede2555faf562770b71580b /src
parentfix var names (diff)
downloadre3-c6b6e9d0df11d408a14e7ea7bbe114e4726e23b8.tar
re3-c6b6e9d0df11d408a14e7ea7bbe114e4726e23b8.tar.gz
re3-c6b6e9d0df11d408a14e7ea7bbe114e4726e23b8.tar.bz2
re3-c6b6e9d0df11d408a14e7ea7bbe114e4726e23b8.tar.lz
re3-c6b6e9d0df11d408a14e7ea7bbe114e4726e23b8.tar.xz
re3-c6b6e9d0df11d408a14e7ea7bbe114e4726e23b8.tar.zst
re3-c6b6e9d0df11d408a14e7ea7bbe114e4726e23b8.zip
Diffstat (limited to 'src')
-rw-r--r--src/save/Date.cpp91
-rw-r--r--src/save/Date.h18
-rw-r--r--src/save/GenericGameStorage.cpp90
-rw-r--r--src/save/GenericGameStorage.h19
4 files changed, 111 insertions, 107 deletions
diff --git a/src/save/Date.cpp b/src/save/Date.cpp
new file mode 100644
index 00000000..ca75bb5e
--- /dev/null
+++ b/src/save/Date.cpp
@@ -0,0 +1,91 @@
+#include "common.h"
+#include "Date.h"
+
+CDate::CDate()
+{
+ m_nYear = 0;
+ m_nSecond = 0;
+ m_nMinute = 0;
+ m_nHour = 0;
+ m_nDay = 0;
+ m_nMonth = 0;
+}
+
+bool
+CDate::operator>(const CDate &right)
+{
+ if (m_nYear > right.m_nYear)
+ return true;
+ if (m_nYear != right.m_nYear)
+ return false;
+
+ if (m_nMonth > right.m_nMonth)
+ return true;
+ if (m_nMonth != right.m_nMonth)
+ return false;
+
+ if (m_nDay > right.m_nDay)
+ return true;
+ if (m_nDay != right.m_nDay)
+ return false;
+
+ if (m_nHour > right.m_nHour)
+ return true;
+ if (m_nHour != right.m_nHour)
+ return false;
+
+ if (m_nMinute > right.m_nMinute)
+ return true;
+ if (m_nMinute != right.m_nMinute)
+ return false;
+ return m_nSecond > right.m_nSecond;
+}
+
+bool
+CDate::operator<(const CDate &right)
+{
+ if (m_nYear < right.m_nYear)
+ return true;
+ if (m_nYear != right.m_nYear)
+ return false;
+
+ if (m_nMonth < right.m_nMonth)
+ return true;
+ if (m_nMonth != right.m_nMonth)
+ return false;
+
+ if (m_nDay < right.m_nDay)
+ return true;
+ if (m_nDay != right.m_nDay)
+ return false;
+
+ if (m_nHour < right.m_nHour)
+ return true;
+ if (m_nHour != right.m_nHour)
+ return false;
+
+ if (m_nMinute < right.m_nMinute)
+ return true;
+ if (m_nMinute != right.m_nMinute)
+ return false;
+ return m_nSecond < right.m_nSecond;
+}
+
+bool
+CDate::operator==(const CDate &right)
+{
+ if (m_nYear != right.m_nYear || m_nMonth != right.m_nMonth || m_nDay != right.m_nDay || m_nHour != right.m_nHour || m_nMinute != right.m_nMinute)
+ return false;
+ return m_nSecond == right.m_nSecond;
+}
+
+void
+CDate::PopulateDateFields(int8 &second, int8 &minute, int8 &hour, int8 &day, int8 &month, int16 year)
+{
+ m_nSecond = second;
+ m_nMinute = minute;
+ m_nHour = hour;
+ m_nDay = day;
+ m_nMonth = month;
+ m_nYear = year;
+} \ No newline at end of file
diff --git a/src/save/Date.h b/src/save/Date.h
new file mode 100644
index 00000000..3e022d09
--- /dev/null
+++ b/src/save/Date.h
@@ -0,0 +1,18 @@
+#pragma once
+
+class CDate
+{
+public:
+ int m_nSecond;
+ int m_nMinute;
+ int m_nHour;
+ int m_nDay;
+ int m_nMonth;
+ int m_nYear;
+
+ CDate();
+ bool operator>(const CDate &right);
+ bool operator<(const CDate &right);
+ bool operator==(const CDate &right);
+ void PopulateDateFields(int8 &second, int8 &minute, int8 &hour, int8 &day, int8 &month, int16 year);
+}; \ No newline at end of file
diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp
index 302b050d..13480b6a 100644
--- a/src/save/GenericGameStorage.cpp
+++ b/src/save/GenericGameStorage.cpp
@@ -3,6 +3,7 @@
#include "patcher.h"
#include "Camera.h"
#include "Clock.h"
+#include "Date.h"
#include "FileMgr.h"
#include "GameLogic.h"
#include "Garages.h"
@@ -28,95 +29,6 @@ CDate &CompileDateAndTime = *(CDate*)0x72BCB8;
C_PcSave &PcSaveHelper = *(C_PcSave*)0x8E2C60;
-CDate::CDate()
-{
- m_nYear = 0;
- m_nSecond = 0;
- m_nMinute = 0;
- m_nHour = 0;
- m_nDay = 0;
- m_nMonth = 0;
-}
-
-bool
-CDate::operator>(const CDate &right)
-{
- if (m_nYear > right.m_nYear)
- return true;
- if (m_nYear != right.m_nYear)
- return false;
-
- if (m_nMonth > right.m_nMonth)
- return true;
- if (m_nMonth != right.m_nMonth)
- return false;
-
- if (m_nDay > right.m_nDay)
- return true;
- if (m_nDay != right.m_nDay)
- return false;
-
- if (m_nHour > right.m_nHour)
- return true;
- if (m_nHour != right.m_nHour)
- return false;
-
- if (m_nMinute > right.m_nMinute)
- return true;
- if (m_nMinute != right.m_nMinute)
- return false;
- return m_nSecond > right.m_nSecond;
-}
-
-bool
-CDate::operator<(const CDate &right)
-{
- if (m_nYear < right.m_nYear)
- return true;
- if (m_nYear != right.m_nYear)
- return false;
-
- if (m_nMonth < right.m_nMonth)
- return true;
- if (m_nMonth != right.m_nMonth)
- return false;
-
- if (m_nDay < right.m_nDay)
- return true;
- if (m_nDay != right.m_nDay)
- return false;
-
- if (m_nHour < right.m_nHour)
- return true;
- if (m_nHour != right.m_nHour)
- return false;
-
- if (m_nMinute < right.m_nMinute)
- return true;
- if (m_nMinute != right.m_nMinute)
- return false;
- return m_nSecond < right.m_nSecond;
-}
-
-bool
-CDate::operator==(const CDate &right)
-{
- if (m_nYear != right.m_nYear || m_nMonth != right.m_nMonth || m_nDay != right.m_nDay || m_nHour != right.m_nHour || m_nMinute != right.m_nMinute)
- return false;
- return m_nSecond == right.m_nSecond;
-}
-
-void
-CDate::PopulateDateFields(int8 &second, int8 &minute, int8 &hour, int8 &day, int8 &month, int16 year)
-{
- m_nSecond = second;
- m_nMinute = minute;
- m_nHour = hour;
- m_nDay = day;
- m_nMonth = month;
- m_nYear = year;
-}
-
WRAPPER bool GenericSave(int file) { EAXJMP(0x58F8D0); }
WRAPPER bool GenericLoad() { EAXJMP(0x590A00); }
diff --git a/src/save/GenericGameStorage.h b/src/save/GenericGameStorage.h
index 86861e5e..b8be1e79 100644
--- a/src/save/GenericGameStorage.h
+++ b/src/save/GenericGameStorage.h
@@ -2,23 +2,6 @@
#include "PCSave.h"
-class CDate
-{
-public:
- int m_nSecond;
- int m_nMinute;
- int m_nHour;
- int m_nDay;
- int m_nMonth;
- int m_nYear;
-
- CDate();
- bool operator>(const CDate &right);
- bool operator<(const CDate &right);
- bool operator==(const CDate &right);
- void PopulateDateFields(int8 &second, int8 &minute, int8 &hour, int8 &day, int8 &month, int16 year);
-};
-
#define SLOT_COUNT (8)
bool GenericSave(int file);
@@ -38,7 +21,7 @@ bool CheckDataNotCorrupt(int32 slot, char *name);
bool RestoreForStartLoad();
int align4bytes(int32 size);
-extern CDate& CompileDateAndTime;
+extern class CDate& CompileDateAndTime;
extern char (&DefaultPCSaveFileName)[260];
extern char (&ValidSaveName)[260];