void MSG::SetLength(std::int32_t dataLength) { MSG otherMsg(0, dataLength); std::copy_n(this->_pData, sizeof(MSG_HEADER) + std::min(GetLength(), dataLength), otherMsg._pData); reinterpret_cast<MSG_HEADER*>(otherMsg._pData)->msgLength = dataLength; this->Swap(otherMsg); }
bool CGlass::MouseDragEndMsg(CMouseDragEndMsg *msg) { showMouse(); if (msg->_dropTarget) { if (msg->_dropTarget->isPet()) { petAddToInventory(); } else { CCharacter *npc = dynamic_cast<CCharacter *>(msg->_dropTarget); if (npc) { CUseWithCharMsg useMsg(npc); useMsg.execute(this); } else { CUseWithOtherMsg otherMsg(msg->_dropTarget); otherMsg.execute(this); } } } else if (compareViewNameTo(_fullViewName) && msg->_mousePos.y < 360) { setPosition(_origPos); } else { petAddToInventory(); } return true; }