コード例 #1
0
dmz::Boolean
dmz::NetExtPacketCodecObjectNative::encode_object (
      const Handle ObjectHandle,
      const NetObjectEncodeEnum EncodeMode,
      Marshal &data) {

   Boolean result (False);

   if (_attrMod && _objMod) {

      UUID objectID;

      if (_objMod->lookup_uuid (ObjectHandle, objectID)) {

         data.set_next_uuid (_SysID);
         data.set_next_uuid (objectID);

         if (EncodeMode == NetObjectDeactivate) {

            data.set_next_int8 (0);
            result = True;
         }
         else {

            const ObjectType Type (_objMod->lookup_object_type (ObjectHandle));
            ArrayUInt32 typeArray;

            if (_attrMod->to_net_object_type (Type, typeArray)) {

               const Int32 TypeSize (typeArray.get_size ());
               data.set_next_int8 (Int8 (TypeSize));

               for (Int32 ix = 0; ix < TypeSize; ix++) {

                  data.set_next_uint8 (UInt8 (typeArray.get (ix)));
               }

               ObjectAttributeAdapter *current (_adapterList);

               while (current) {

                  current->encode (ObjectHandle, *_objMod, data);
                  current = current->next;
               }

               result = True;
            }

            _objMod->store_time_stamp (
               ObjectHandle,
               _lnvHandle,
               _time.get_last_frame_time ());
         }
      }
   }

   return result;
}