From 22f23da023b0a7fe25f07a947d36d429bddfc887 Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期三, 28 五月 2025 16:31:02 +0800
Subject: [PATCH] 1.Slot的存储和加载;
---
SourceCode/Bond/x64/Debug/Master.dat | 0
SourceCode/Bond/Servo/CSlot.cpp | 31 +++++++++++++++++++++++++++++--
SourceCode/Bond/Servo/CEquipment.cpp | 3 +++
3 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/SourceCode/Bond/Servo/CEquipment.cpp b/SourceCode/Bond/Servo/CEquipment.cpp
index edd9ed3..319cb86 100644
--- a/SourceCode/Bond/Servo/CEquipment.cpp
+++ b/SourceCode/Bond/Servo/CEquipment.cpp
@@ -321,6 +321,9 @@
Lock();
for (int i = 0; i < SLOT_MAX; i++) {
m_slot[i].serialize(ar);
+ if (m_slot[i].getContext() != nullptr) {
+ ((CGlass*)m_slot[i].getContext())->serialize(ar);
+ }
}
Unlock();
}
diff --git a/SourceCode/Bond/Servo/CSlot.cpp b/SourceCode/Bond/Servo/CSlot.cpp
index 74a1e57..ed297f2 100644
--- a/SourceCode/Bond/Servo/CSlot.cpp
+++ b/SourceCode/Bond/Servo/CSlot.cpp
@@ -105,10 +105,37 @@
void CSlot::serialize(CArchive& ar)
{
if (ar.IsStoring()) {
-
+ ar << m_nPosition;
+ ar << m_nNo;
+ ar << (int)m_materialsType;
+ WriteString(ar, m_strName);
+ ar << (__int64)m_pContext;
+ ar << m_bEnable;
+ ar << m_bLock;
}
else {
-
+ int i32;
+ __int64 i64;
+ ar >> m_nPosition;
+ ar >> m_nNo;
+ ar >> i32; m_materialsType = (MaterialsType)i32;
+ ReadString(ar, m_strName);
+ ar >> i64; m_pContext = (CContext*)i64;
+ ar >> m_bEnable;
+ ar >> m_bLock;
}
}
+
+ void CSlot::WriteString(CArchive& ar, std::string& string)
+ {
+ CString strTemp = string.c_str();
+ ar << strTemp;
+ }
+
+ void CSlot::ReadString(CArchive& ar, std::string& string)
+ {
+ CString strTemp;
+ ar >> strTemp;
+ string = (LPTSTR)(LPCTSTR)strTemp;
+ }
}
diff --git a/SourceCode/Bond/x64/Debug/Master.dat b/SourceCode/Bond/x64/Debug/Master.dat
index 86656a2..697ea90 100644
--- a/SourceCode/Bond/x64/Debug/Master.dat
+++ b/SourceCode/Bond/x64/Debug/Master.dat
Binary files differ
--
Gitblit v1.9.3