Method: Api::ResponseSaveMap#_encode

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

#_encode(buff) ⇒ Object



35468
35469
35470
35471
35472
35473
35474
35475
35476
35477
35478
35479
35480
35481
35482
35483
35484
35485
35486
35487
35488
35489
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 35468

def _encode(buff)
  val = @error
  if has_error?
    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