Method: Api::ActionSelectIdleWorker#_encode

Defined in:
lib/sc2ai/protocol/ui_pb.rb

#_encode(buff) ⇒ Object



11905
11906
11907
11908
11909
11910
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
# File 'lib/sc2ai/protocol/ui_pb.rb', line 11905

def _encode(buff)
  val = @type
  if has_type?
    buff << 0x08

    loop do
      byte = val & 0x7F

      val >>= 7
      # This drops the top bits,
      # Otherwise, with a signed right shift,
      # we get infinity one bits at the top
      val &= (1 << 57) - 1

      byte |= 0x80 if val != 0
      buff << byte
      break if val == 0
    end
  end
  buff << @_unknown_fields if @_unknown_fields
  buff
end