LAPTOP-SNT8I5JK\Boounion
2025-05-15 217f07665553605caa3f3339321d04bd2c3e8256
SourceCode/Bond/Servo/CEquipment.cpp
@@ -311,13 +311,28 @@
         Unlock();
      }
      else {
         Lock();
         // addGlassToList前不需要上锁,因其内部有锁
         int count;
         ar >> count;
         for (int i = 0; i < count; i++) {
            CGlass* pGlass = new CGlass();
            pGlass->serialize(ar);
            addGlassToList(pGlass);
         }
         // 梳理各玻璃之间的绑定关系
         Lock();
         std::list<CGlass*> list = m_glassList;
         for (auto item : list) {
            std::string& strBuddyId = item->getBuddyId();
            if (!strBuddyId.empty()) {
               for (auto item2 : m_glassList) {
                  if (strBuddyId.compare(item2->getID()) == 0) {
                     item->setBuddy(item2);
                     TRACE("绑定关系: %s <- %s\n", item->getID().c_str(), item2->getID().c_str());
                  }
               }
            }
         }
         Unlock();
      }
@@ -786,6 +801,21 @@
      }
   }
   CGlass* CEquipment::getGlassFromList(const char* pszId)
   {
      CGlass* pGlass = nullptr;
      Lock();
      for (auto item : m_glassList) {
         if (item->getID().compare(pszId) == 0) {
            pGlass = item;
            break;
         }
      }
      Unlock();
      return pGlass;
   }
   BOOL CEquipment::removeClass(CGlass* pGlass)
   {
      Lock();