Class: Api::SpatialCameraSetup
- Inherits:
-
Object
- Object
- Api::SpatialCameraSetup
- Defined in:
- lib/sc2ai/protocol/sc2api_pb.rb
Instance Attribute Summary collapse
-
#allow_cheating_layers ⇒ Object
Returns the value of attribute allow_cheating_layers.
-
#crop_to_playable_area ⇒ Object
Returns the value of attribute crop_to_playable_area.
-
#minimap_resolution ⇒ Object
Returns the value of attribute minimap_resolution.
-
#resolution ⇒ Object
optional field readers.
-
#width ⇒ Object
Returns the value of attribute width.
Class Method Summary collapse
Instance Method Summary collapse
- #_encode(buff) ⇒ Object
- #decode_from(buff, index, len) ⇒ Object
- #has_allow_cheating_layers? ⇒ Boolean
- #has_crop_to_playable_area? ⇒ Boolean
- #has_minimap_resolution? ⇒ Boolean
- #has_resolution? ⇒ Boolean
- #has_width? ⇒ Boolean
-
#initialize(resolution: nil, minimap_resolution: nil, width: nil, crop_to_playable_area: nil, allow_cheating_layers: nil) ⇒ SpatialCameraSetup
constructor
END writers for optional fields.
- #to_h ⇒ Object
- #to_proto(_options = {}) ⇒ Object
Constructor Details
#initialize(resolution: nil, minimap_resolution: nil, width: nil, crop_to_playable_area: nil, allow_cheating_layers: nil) ⇒ SpatialCameraSetup
END writers for optional fields
35537 35538 35539 35540 35541 35542 35543 35544 35545 35546 35547 35548 35549 35550 35551 35552 35553 35554 35555 35556 35557 35558 35559 35560 35561 35562 35563 35564 35565 35566 35567 35568 35569 35570 35571 35572 35573 35574 35575 35576 35577 35578 35579 35580 |
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 35537 def initialize( resolution: nil, minimap_resolution: nil, width: nil, crop_to_playable_area: nil, allow_cheating_layers: nil ) @_bitmask = 0 if resolution == nil @resolution = nil else @_bitmask |= 0x0000000000000001 @resolution = resolution end if minimap_resolution == nil @minimap_resolution = nil else @_bitmask |= 0x0000000000000002 @minimap_resolution = minimap_resolution end if width == nil @width = 0.0 else @_bitmask |= 0x0000000000000004 @width = width end if crop_to_playable_area == nil @crop_to_playable_area = false else @_bitmask |= 0x0000000000000008 @crop_to_playable_area = crop_to_playable_area end if allow_cheating_layers == nil @allow_cheating_layers = false else @_bitmask |= 0x0000000000000010 @allow_cheating_layers = allow_cheating_layers end end |
Instance Attribute Details
#allow_cheating_layers ⇒ Object
Returns the value of attribute allow_cheating_layers.
35507 35508 35509 |
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 35507 def allow_cheating_layers @allow_cheating_layers end |
#crop_to_playable_area ⇒ Object
Returns the value of attribute crop_to_playable_area.
35505 35506 35507 |
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 35505 def crop_to_playable_area @crop_to_playable_area end |
#minimap_resolution ⇒ Object
Returns the value of attribute minimap_resolution.
35501 35502 35503 |
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 35501 def minimap_resolution @minimap_resolution end |
#resolution ⇒ Object
optional field readers
35499 35500 35501 |
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 35499 def resolution @resolution end |
#width ⇒ Object
Returns the value of attribute width.
35503 35504 35505 |
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 35503 def width @width end |
Class Method Details
.decode(buff) ⇒ Object
35488 35489 35490 |
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 35488 def self.decode(buff) allocate.decode_from(buff.b, 0, buff.bytesize) end |
.encode(obj) ⇒ Object
35492 35493 35494 |
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 35492 def self.encode(obj) obj._encode("".b) end |
Instance Method Details
#_encode(buff) ⇒ Object
36217 36218 36219 36220 36221 36222 36223 36224 36225 36226 36227 36228 36229 36230 36231 36232 36233 36234 36235 36236 36237 36238 36239 36240 36241 36242 36243 36244 36245 36246 36247 36248 36249 36250 36251 36252 36253 36254 36255 36256 36257 36258 36259 36260 36261 36262 36263 36264 36265 36266 36267 36268 36269 36270 36271 36272 36273 36274 36275 36276 36277 36278 36279 36280 36281 36282 36283 36284 36285 36286 36287 36288 36289 36290 36291 36292 36293 36294 36295 36296 36297 36298 36299 36300 36301 36302 36303 36304 36305 36306 36307 36308 36309 36310 36311 36312 36313 36314 36315 36316 36317 36318 36319 36320 36321 36322 36323 36324 36325 36326 36327 36328 36329 36330 36331 36332 36333 36334 36335 36336 36337 36338 36339 36340 36341 36342 36343 36344 |
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 36217 def _encode(buff) val = @resolution if val buff << 0x12 # Save the buffer size before appending the submessage current_len = buff.bytesize # Write a single dummy byte to later store encoded length buff << 42 # "*" val._encode(buff) # Calculate the submessage's size = buff.bytesize - current_len - 1 # Hope the size fits in one byte byte = & 0x7F >>= 7 byte |= 0x80 if > 0 buff.setbyte(current_len, byte) # If the sub message was bigger if > 0 current_len += 1 # compute how much we need to shift encoded_int_len = 0 remaining_size = while remaining_size != 0 remaining_size >>= 7 encoded_int_len += 1 end # Make space in the string with dummy bytes buff.bytesplice(current_len, 0, "*********", 0, encoded_int_len) # Overwrite the dummy bytes with the encoded length while != 0 byte = & 0x7F >>= 7 byte |= 0x80 if > 0 buff.setbyte(current_len, byte) current_len += 1 end end buff end val = @minimap_resolution if val buff << 0x1a # Save the buffer size before appending the submessage current_len = buff.bytesize # Write a single dummy byte to later store encoded length buff << 42 # "*" val._encode(buff) # Calculate the submessage's size = buff.bytesize - current_len - 1 # Hope the size fits in one byte byte = & 0x7F >>= 7 byte |= 0x80 if > 0 buff.setbyte(current_len, byte) # If the sub message was bigger if > 0 current_len += 1 # compute how much we need to shift encoded_int_len = 0 remaining_size = while remaining_size != 0 remaining_size >>= 7 encoded_int_len += 1 end # Make space in the string with dummy bytes buff.bytesplice(current_len, 0, "*********", 0, encoded_int_len) # Overwrite the dummy bytes with the encoded length while != 0 byte = & 0x7F >>= 7 byte |= 0x80 if > 0 buff.setbyte(current_len, byte) current_len += 1 end end buff end val = @width if val != 0 buff << 0x0d [val].pack("e", buffer: buff) end val = @crop_to_playable_area if val == true buff << 0x20 buff << 1 elsif val == false # Default value, encode nothing else raise "bool values should be true or false" end val = @allow_cheating_layers if val == true buff << 0x28 buff << 1 elsif val == false # Default value, encode nothing else raise "bool values should be true or false" end buff end |
#decode_from(buff, index, len) ⇒ Object
35606 35607 35608 35609 35610 35611 35612 35613 35614 35615 35616 35617 35618 35619 35620 35621 35622 35623 35624 35625 35626 35627 35628 35629 35630 35631 35632 35633 35634 35635 35636 35637 35638 35639 35640 35641 35642 35643 35644 35645 35646 35647 35648 35649 35650 35651 35652 35653 35654 35655 35656 35657 35658 35659 35660 35661 35662 35663 35664 35665 35666 35667 35668 35669 35670 35671 35672 35673 35674 35675 35676 35677 35678 35679 35680 35681 35682 35683 35684 35685 35686 35687 35688 35689 35690 35691 35692 35693 35694 35695 35696 35697 35698 35699 35700 35701 35702 35703 35704 35705 35706 35707 35708 35709 35710 35711 35712 35713 35714 35715 35716 35717 35718 35719 35720 35721 35722 35723 35724 35725 35726 35727 35728 35729 35730 35731 35732 35733 35734 35735 35736 35737 35738 35739 35740 35741 35742 35743 35744 35745 35746 35747 35748 35749 35750 35751 35752 35753 35754 35755 35756 35757 35758 35759 35760 35761 35762 35763 35764 35765 35766 35767 35768 35769 35770 35771 35772 35773 35774 35775 35776 35777 35778 35779 35780 35781 35782 35783 35784 35785 35786 35787 35788 35789 35790 35791 35792 35793 35794 35795 35796 35797 35798 35799 35800 35801 35802 35803 35804 35805 35806 35807 35808 35809 35810 35811 35812 35813 35814 35815 35816 35817 35818 35819 35820 35821 35822 35823 35824 35825 35826 35827 35828 35829 35830 35831 35832 35833 35834 35835 35836 35837 35838 35839 35840 35841 35842 35843 35844 35845 35846 35847 35848 35849 35850 35851 35852 35853 35854 35855 35856 35857 35858 35859 35860 35861 35862 35863 35864 35865 35866 35867 35868 35869 35870 35871 35872 35873 35874 35875 35876 35877 35878 35879 35880 35881 35882 35883 35884 35885 35886 35887 35888 35889 35890 35891 35892 35893 35894 35895 35896 35897 35898 35899 35900 35901 35902 35903 35904 35905 35906 35907 35908 35909 35910 35911 35912 35913 35914 35915 35916 35917 35918 35919 35920 35921 35922 35923 35924 35925 35926 35927 35928 35929 35930 35931 35932 35933 35934 35935 35936 35937 35938 35939 35940 35941 35942 35943 35944 35945 35946 35947 35948 35949 35950 35951 35952 35953 35954 35955 35956 35957 35958 35959 35960 35961 35962 35963 35964 35965 35966 35967 35968 35969 35970 35971 35972 35973 35974 35975 35976 35977 35978 35979 35980 35981 35982 35983 35984 35985 35986 35987 35988 35989 35990 35991 35992 35993 35994 35995 35996 35997 35998 35999 36000 36001 36002 36003 36004 36005 36006 36007 36008 36009 36010 36011 36012 36013 36014 36015 36016 36017 36018 36019 36020 36021 36022 36023 36024 36025 36026 36027 36028 36029 36030 36031 36032 36033 36034 36035 36036 36037 36038 36039 36040 36041 36042 36043 36044 36045 36046 36047 36048 36049 36050 36051 36052 36053 36054 36055 36056 36057 36058 36059 36060 36061 36062 36063 36064 36065 36066 36067 36068 36069 36070 36071 36072 36073 36074 36075 36076 36077 36078 36079 36080 36081 36082 36083 36084 36085 36086 36087 36088 36089 36090 36091 36092 36093 36094 36095 36096 36097 36098 36099 36100 36101 36102 36103 36104 36105 36106 36107 36108 36109 36110 36111 36112 36113 36114 36115 36116 36117 36118 36119 36120 36121 36122 36123 36124 36125 36126 36127 36128 36129 36130 36131 36132 36133 36134 36135 36136 36137 36138 36139 36140 36141 36142 36143 36144 36145 36146 36147 36148 36149 36150 36151 36152 36153 36154 36155 36156 36157 36158 36159 36160 36161 36162 36163 36164 36165 36166 36167 36168 36169 36170 36171 36172 36173 36174 36175 36176 36177 36178 36179 36180 36181 36182 36183 36184 36185 36186 36187 36188 36189 36190 36191 36192 36193 36194 36195 36196 36197 36198 36199 36200 36201 36202 36203 36204 36205 36206 36207 36208 36209 36210 36211 36212 36213 36214 36215 36216 |
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 35606 def decode_from(buff, index, len) @_bitmask = 0 @resolution = nil @minimap_resolution = nil @width = 0.0 @crop_to_playable_area = false @allow_cheating_layers = false return self if index >= len ## PULL_UINT64 tag = if (byte0 = buff.getbyte(index)) < 0x80 index += 1 byte0 elsif (byte1 = buff.getbyte(index + 1)) < 0x80 index += 2 (byte1 << 7) | (byte0 & 0x7F) elsif (byte2 = buff.getbyte(index + 2)) < 0x80 index += 3 (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte3 = buff.getbyte(index + 3)) < 0x80 index += 4 (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte4 = buff.getbyte(index + 4)) < 0x80 index += 5 (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte5 = buff.getbyte(index + 5)) < 0x80 index += 6 (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte6 = buff.getbyte(index + 6)) < 0x80 index += 7 (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte7 = buff.getbyte(index + 7)) < 0x80 index += 8 (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte8 = buff.getbyte(index + 8)) < 0x80 index += 9 (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte9 = buff.getbyte(index + 9)) < 0x80 index += 10 (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) else raise "integer decoding error" end ## END PULL_UINT64 found = true while true # If we have looped around since the last found tag this one is # unexpected, so discard it and continue. if !found wire_type = tag & 0x7 case wire_type when 0 i = 0 while true newbyte = buff.getbyte(index) index += 1 break if newbyte.nil? || newbyte < 0x80 i += 1 break if i > 9 end when 1 index += 8 when 2 ## PULL_BYTES value = if (byte0 = buff.getbyte(index)) < 0x80 index += 1 byte0 elsif (byte1 = buff.getbyte(index + 1)) < 0x80 index += 2 (byte1 << 7) | (byte0 & 0x7F) elsif (byte2 = buff.getbyte(index + 2)) < 0x80 index += 3 (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte3 = buff.getbyte(index + 3)) < 0x80 index += 4 (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte4 = buff.getbyte(index + 4)) < 0x80 index += 5 (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte5 = buff.getbyte(index + 5)) < 0x80 index += 6 (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte6 = buff.getbyte(index + 6)) < 0x80 index += 7 (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte7 = buff.getbyte(index + 7)) < 0x80 index += 8 (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte8 = buff.getbyte(index + 8)) < 0x80 index += 9 (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte9 = buff.getbyte(index + 9)) < 0x80 index += 10 (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) else raise "integer decoding error" end buff.byteslice(index, value) index += value ## END PULL_BYTES when 5 index += 4 else raise "unknown wire type #{wire_type}" end return self if index >= len ## PULL_UINT64 tag = if (byte0 = buff.getbyte(index)) < 0x80 index += 1 byte0 elsif (byte1 = buff.getbyte(index + 1)) < 0x80 index += 2 (byte1 << 7) | (byte0 & 0x7F) elsif (byte2 = buff.getbyte(index + 2)) < 0x80 index += 3 (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte3 = buff.getbyte(index + 3)) < 0x80 index += 4 (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte4 = buff.getbyte(index + 4)) < 0x80 index += 5 (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte5 = buff.getbyte(index + 5)) < 0x80 index += 6 (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte6 = buff.getbyte(index + 6)) < 0x80 index += 7 (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte7 = buff.getbyte(index + 7)) < 0x80 index += 8 (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte8 = buff.getbyte(index + 8)) < 0x80 index += 9 (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte9 = buff.getbyte(index + 9)) < 0x80 index += 10 (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) else raise "integer decoding error" end ## END PULL_UINT64 end found = false if tag == 0x12 found = true ## PULL_MESSAGE ## PULL_UINT64 msg_len = if (byte0 = buff.getbyte(index)) < 0x80 index += 1 byte0 elsif (byte1 = buff.getbyte(index + 1)) < 0x80 index += 2 (byte1 << 7) | (byte0 & 0x7F) elsif (byte2 = buff.getbyte(index + 2)) < 0x80 index += 3 (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte3 = buff.getbyte(index + 3)) < 0x80 index += 4 (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte4 = buff.getbyte(index + 4)) < 0x80 index += 5 (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte5 = buff.getbyte(index + 5)) < 0x80 index += 6 (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte6 = buff.getbyte(index + 6)) < 0x80 index += 7 (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte7 = buff.getbyte(index + 7)) < 0x80 index += 8 (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte8 = buff.getbyte(index + 8)) < 0x80 index += 9 (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte9 = buff.getbyte(index + 9)) < 0x80 index += 10 (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) else raise "integer decoding error" end ## END PULL_UINT64 @resolution = Api::Size2DI.allocate.decode_from(buff, index, index += msg_len) ## END PULL_MESSAGE @_bitmask |= 0x0000000000000001 return self if index >= len ## PULL_UINT64 tag = if (byte0 = buff.getbyte(index)) < 0x80 index += 1 byte0 elsif (byte1 = buff.getbyte(index + 1)) < 0x80 index += 2 (byte1 << 7) | (byte0 & 0x7F) elsif (byte2 = buff.getbyte(index + 2)) < 0x80 index += 3 (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte3 = buff.getbyte(index + 3)) < 0x80 index += 4 (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte4 = buff.getbyte(index + 4)) < 0x80 index += 5 (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte5 = buff.getbyte(index + 5)) < 0x80 index += 6 (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte6 = buff.getbyte(index + 6)) < 0x80 index += 7 (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte7 = buff.getbyte(index + 7)) < 0x80 index += 8 (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte8 = buff.getbyte(index + 8)) < 0x80 index += 9 (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte9 = buff.getbyte(index + 9)) < 0x80 index += 10 (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) else raise "integer decoding error" end ## END PULL_UINT64 end if tag == 0x1a found = true ## PULL_MESSAGE ## PULL_UINT64 msg_len = if (byte0 = buff.getbyte(index)) < 0x80 index += 1 byte0 elsif (byte1 = buff.getbyte(index + 1)) < 0x80 index += 2 (byte1 << 7) | (byte0 & 0x7F) elsif (byte2 = buff.getbyte(index + 2)) < 0x80 index += 3 (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte3 = buff.getbyte(index + 3)) < 0x80 index += 4 (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte4 = buff.getbyte(index + 4)) < 0x80 index += 5 (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte5 = buff.getbyte(index + 5)) < 0x80 index += 6 (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte6 = buff.getbyte(index + 6)) < 0x80 index += 7 (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte7 = buff.getbyte(index + 7)) < 0x80 index += 8 (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte8 = buff.getbyte(index + 8)) < 0x80 index += 9 (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte9 = buff.getbyte(index + 9)) < 0x80 index += 10 (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) else raise "integer decoding error" end ## END PULL_UINT64 @minimap_resolution = Api::Size2DI.allocate.decode_from(buff, index, index += msg_len) ## END PULL_MESSAGE @_bitmask |= 0x0000000000000002 return self if index >= len ## PULL_UINT64 tag = if (byte0 = buff.getbyte(index)) < 0x80 index += 1 byte0 elsif (byte1 = buff.getbyte(index + 1)) < 0x80 index += 2 (byte1 << 7) | (byte0 & 0x7F) elsif (byte2 = buff.getbyte(index + 2)) < 0x80 index += 3 (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte3 = buff.getbyte(index + 3)) < 0x80 index += 4 (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte4 = buff.getbyte(index + 4)) < 0x80 index += 5 (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte5 = buff.getbyte(index + 5)) < 0x80 index += 6 (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte6 = buff.getbyte(index + 6)) < 0x80 index += 7 (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte7 = buff.getbyte(index + 7)) < 0x80 index += 8 (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte8 = buff.getbyte(index + 8)) < 0x80 index += 9 (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte9 = buff.getbyte(index + 9)) < 0x80 index += 10 (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) else raise "integer decoding error" end ## END PULL_UINT64 end if tag == 0xd found = true @width = buff.unpack1("e", offset: index) index += 4 @_bitmask |= 0x0000000000000004 return self if index >= len ## PULL_UINT64 tag = if (byte0 = buff.getbyte(index)) < 0x80 index += 1 byte0 elsif (byte1 = buff.getbyte(index + 1)) < 0x80 index += 2 (byte1 << 7) | (byte0 & 0x7F) elsif (byte2 = buff.getbyte(index + 2)) < 0x80 index += 3 (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte3 = buff.getbyte(index + 3)) < 0x80 index += 4 (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte4 = buff.getbyte(index + 4)) < 0x80 index += 5 (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte5 = buff.getbyte(index + 5)) < 0x80 index += 6 (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte6 = buff.getbyte(index + 6)) < 0x80 index += 7 (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte7 = buff.getbyte(index + 7)) < 0x80 index += 8 (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte8 = buff.getbyte(index + 8)) < 0x80 index += 9 (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte9 = buff.getbyte(index + 9)) < 0x80 index += 10 (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) else raise "integer decoding error" end ## END PULL_UINT64 end if tag == 0x20 found = true ## PULL BOOLEAN @crop_to_playable_area = (buff.getbyte(index) == 1) index += 1 ## END PULL BOOLEAN @_bitmask |= 0x0000000000000008 return self if index >= len ## PULL_UINT64 tag = if (byte0 = buff.getbyte(index)) < 0x80 index += 1 byte0 elsif (byte1 = buff.getbyte(index + 1)) < 0x80 index += 2 (byte1 << 7) | (byte0 & 0x7F) elsif (byte2 = buff.getbyte(index + 2)) < 0x80 index += 3 (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte3 = buff.getbyte(index + 3)) < 0x80 index += 4 (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte4 = buff.getbyte(index + 4)) < 0x80 index += 5 (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte5 = buff.getbyte(index + 5)) < 0x80 index += 6 (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte6 = buff.getbyte(index + 6)) < 0x80 index += 7 (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte7 = buff.getbyte(index + 7)) < 0x80 index += 8 (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte8 = buff.getbyte(index + 8)) < 0x80 index += 9 (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte9 = buff.getbyte(index + 9)) < 0x80 index += 10 (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) else raise "integer decoding error" end ## END PULL_UINT64 end if tag == 0x28 found = true ## PULL BOOLEAN @allow_cheating_layers = (buff.getbyte(index) == 1) index += 1 ## END PULL BOOLEAN @_bitmask |= 0x0000000000000010 return self if index >= len ## PULL_UINT64 tag = if (byte0 = buff.getbyte(index)) < 0x80 index += 1 byte0 elsif (byte1 = buff.getbyte(index + 1)) < 0x80 index += 2 (byte1 << 7) | (byte0 & 0x7F) elsif (byte2 = buff.getbyte(index + 2)) < 0x80 index += 3 (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte3 = buff.getbyte(index + 3)) < 0x80 index += 4 (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte4 = buff.getbyte(index + 4)) < 0x80 index += 5 (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte5 = buff.getbyte(index + 5)) < 0x80 index += 6 (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte6 = buff.getbyte(index + 6)) < 0x80 index += 7 (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte7 = buff.getbyte(index + 7)) < 0x80 index += 8 (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte8 = buff.getbyte(index + 8)) < 0x80 index += 9 (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte9 = buff.getbyte(index + 9)) < 0x80 index += 10 (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) else raise "integer decoding error" end ## END PULL_UINT64 end return self if index >= len end end |
#has_allow_cheating_layers? ⇒ Boolean
35602 35603 35604 |
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 35602 def has_allow_cheating_layers? (@_bitmask & 0x0000000000000010) == 0x0000000000000010 end |
#has_crop_to_playable_area? ⇒ Boolean
35598 35599 35600 |
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 35598 def has_crop_to_playable_area? (@_bitmask & 0x0000000000000008) == 0x0000000000000008 end |
#has_minimap_resolution? ⇒ Boolean
35590 35591 35592 |
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 35590 def has_minimap_resolution? (@_bitmask & 0x0000000000000002) == 0x0000000000000002 end |
#has_resolution? ⇒ Boolean
35586 35587 35588 |
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 35586 def has_resolution? (@_bitmask & 0x0000000000000001) == 0x0000000000000001 end |
#has_width? ⇒ Boolean
35594 35595 35596 |
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 35594 def has_width? (@_bitmask & 0x0000000000000004) == 0x0000000000000004 end |
#to_h ⇒ Object
36346 36347 36348 36349 36350 36351 36352 36353 36354 |
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 36346 def to_h result = {} result["resolution".to_sym] = @resolution.to_h result["minimap_resolution".to_sym] = @minimap_resolution.to_h result["width".to_sym] = @width result["crop_to_playable_area".to_sym] = @crop_to_playable_area result["allow_cheating_layers".to_sym] = @allow_cheating_layers result end |
#to_proto(_options = {}) ⇒ Object
35582 35583 35584 |
# File 'lib/sc2ai/protocol/sc2api_pb.rb', line 35582 def to_proto( = {}) self.class.encode(self) end |