From 58b5bb07de4bcbf670db5ad79ff8b9bd7afc1e28 Mon Sep 17 00:00:00 2001
From: mrDarker <mr.darker@163.com>
Date: 星期二, 17 六月 2025 11:35:47 +0800
Subject: [PATCH] Merge branch 'clh' into liuyang
---
SourceCode/Bond/Servo/CEquipment.cpp | 43 ++++++++++++++++++++++++++-----------------
1 files changed, 26 insertions(+), 17 deletions(-)
diff --git a/SourceCode/Bond/Servo/CEquipment.cpp b/SourceCode/Bond/Servo/CEquipment.cpp
index 7f10e53..473afdb 100644
--- a/SourceCode/Bond/Servo/CEquipment.cpp
+++ b/SourceCode/Bond/Servo/CEquipment.cpp
@@ -255,13 +255,21 @@
if (!m_slot[i].isEnable()) continue;
CGlass* pGlass = (CGlass*)m_slot[i].getContext();
+ CGlass* pBuddy = nullptr;
if (pGlass == nullptr) {
attrubutes.addAttribute(new CAttribute(m_slot[i].getName().c_str(),
"", "", weight++));
}
else {
- attrubutes.addAttribute(new CAttribute(m_slot[i].getName().c_str(),
- pGlass->getID().c_str(), "", weight++));
+ pBuddy = pGlass->getBuddy();
+ if (pBuddy == nullptr) {
+ attrubutes.addAttribute(new CAttribute(m_slot[i].getName().c_str(),
+ pGlass->getID().c_str(), "", weight++));
+ }
+ else {
+ attrubutes.addAttribute(new CAttribute(m_slot[i].getName().c_str(),
+ (pGlass->getID() + " -> " + pBuddy->getID()).c_str(), "", weight++));
+ }
}
}
@@ -317,8 +325,13 @@
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);
+ CGlass* pGlass = (CGlass *)m_slot[i].getContext();
+ if (pGlass != nullptr) {
+ pGlass->serialize(ar);
+ CGlass* pBuddy = pGlass->getBuddy();
+ if (pBuddy != nullptr) {
+ pBuddy->serialize(ar);
+ }
}
}
Unlock();
@@ -330,10 +343,16 @@
CGlass* pGlass = theApp.m_model.m_glassPool.allocaGlass();
pGlass->serialize(ar);
m_slot[i].setContext(pGlass);
+ if (pGlass->getBuddy() != nullptr) {
+ CGlass* pBuddy = theApp.m_model.m_glassPool.allocaGlass();
+ pBuddy->serialize(ar);
+ pGlass->forceSetBuddy(pBuddy);
+ }
}
}
// 梳理各玻璃之间的绑定关系
+ /*
Lock();
for (int i = 0; i < SLOT_MAX; i++) {
CGlass* pGlass = (CGlass*)m_slot[i].getContext();
@@ -351,6 +370,7 @@
}
}
Unlock();
+ */
}
}
@@ -770,18 +790,6 @@
return -3;
}
- // 如果此玻璃已经贴合,贴合的玻璃也要从列表中移除
- CGlass* pBuddy = pContext->getBuddy();
- if (pBuddy != nullptr) {
- for (int i = 0; i < SLOT_MAX; i++) {
- CGlass* pGlass = (CGlass*)m_slot[i].getContext();
- if (pGlass != nullptr && compareJobDataB(pBuddy->getJobDataB(), pGlass->getJobDataB())) {
- m_slot[i].setContext(nullptr);
- break;
- }
- }
- }
-
((CArm*)m_pArm)->tempStore(pContext);
pContext->release();
@@ -815,6 +823,7 @@
// 如果此玻璃已经贴合,贴合的玻璃也要从加入到列表中
+ /*
CGlass* pBuddy = pGlass->getBuddy();
if (pBuddy != nullptr) {
Lock();
@@ -827,7 +836,7 @@
}
Unlock();
}
-
+ */
if (m_listener.onDataChanged != nullptr) {
m_listener.onDataChanged(this, EDCC_STORED_JOB);
--
Gitblit v1.9.3