module Rattletrap.Encode.ReservationAttribute ( putReservationAttribute ) where import Rattletrap.Encode.CompressedWord import Rattletrap.Encode.Str import Rattletrap.Encode.UniqueIdAttribute import Rattletrap.Type.ReservationAttribute import qualified Data.Binary.Bits.Put as BinaryBits putReservationAttribute :: ReservationAttribute -> BinaryBits.BitPut () putReservationAttribute :: ReservationAttribute -> BitPut () putReservationAttribute ReservationAttribute reservationAttribute = do CompressedWord -> BitPut () putCompressedWord (ReservationAttribute -> CompressedWord reservationAttributeNumber ReservationAttribute reservationAttribute) UniqueIdAttribute -> BitPut () putUniqueIdAttribute (ReservationAttribute -> UniqueIdAttribute reservationAttributeUniqueId ReservationAttribute reservationAttribute) case ReservationAttribute -> Maybe Str reservationAttributeName ReservationAttribute reservationAttribute of Maybe Str Nothing -> () -> BitPut () forall (f :: * -> *) a. Applicative f => a -> f a pure () Just Str name -> Str -> BitPut () putTextBits Str name Bool -> BitPut () BinaryBits.putBool (ReservationAttribute -> Bool reservationAttributeUnknown1 ReservationAttribute reservationAttribute) Bool -> BitPut () BinaryBits.putBool (ReservationAttribute -> Bool reservationAttributeUnknown2 ReservationAttribute reservationAttribute) case ReservationAttribute -> Maybe Word8 reservationAttributeUnknown3 ReservationAttribute reservationAttribute of Maybe Word8 Nothing -> () -> BitPut () forall (f :: * -> *) a. Applicative f => a -> f a pure () Just Word8 c -> Int -> Word8 -> BitPut () BinaryBits.putWord8 Int 6 Word8 c