@@ -714,7 +714,7 @@ namespace mc {
714
714
715
715
C->p [C->pos ++] = section_name::None;
716
716
717
- if (in_level_section (C)) {
717
+ if (in_level_section_a (C) || in_level_section_c (C)) {
718
718
C->sections .emplace_back ();
719
719
} else if (in_palette_section (C)) {
720
720
C->sections .back ().PaletteProperties .emplace_back ();
@@ -914,7 +914,7 @@ namespace mc {
914
914
* indice_bit_count is the number of bits in the slice and may not exceed 32 since the return type is int.
915
915
*/
916
916
template <typename T, size_t indice_bit_count>
917
- inline boost::optional<int > get_indice (int x, int z, int y, boost::shared_ptr<nbt::Array<T>> &arr) {
917
+ inline boost::optional<uint32_t > get_indice (int x, int z, int y, boost::shared_ptr<nbt::Array<T>> &arr) {
918
918
size_t indice_index = (y * 16 + z) * 16 + x;
919
919
920
920
// Compiler should catch that this is static and pre-compute it,
@@ -927,11 +927,11 @@ namespace mc {
927
927
size_t element_index = (indice_index - index_in_element) / indice_count_in_element;
928
928
929
929
if (arr->length < 0 || element_index >= static_cast <size_t >(arr->length ))
930
- return boost::optional<int >();
930
+ return boost::optional<uint32_t >();
931
931
932
932
T element = arr->values [element_index];
933
- int out_bits = ~(0xFFFFFFFF << indice_bit_count);
934
- return boost::optional<int >((element >> (indice_bit_count * index_in_element)) & out_bits);
933
+ uint32_t out_bits = ~(0xFFFFFFFF << indice_bit_count);
934
+ return boost::optional<uint32_t >((element >> (indice_bit_count * index_in_element)) & out_bits);
935
935
}
936
936
937
937
/* *
@@ -943,7 +943,7 @@ namespace mc {
943
943
* indice_bit_count is the number of bits in the slice and may not exceed 32 since the return type is int.
944
944
*/
945
945
template <typename T, size_t indice_bit_count>
946
- inline boost::optional<int > get_stream_indice (int x, int z, int y, boost::shared_ptr<nbt::Array<T>> &arr) {
946
+ inline boost::optional<uint32_t > get_stream_indice (int x, int z, int y, boost::shared_ptr<nbt::Array<T>> &arr) {
947
947
size_t indice_index = (y * 16 + z) * 16 + x;
948
948
949
949
size_t bits_into_stream = indice_index * indice_bit_count;
@@ -953,26 +953,26 @@ namespace mc {
953
953
size_t element_index = (bits_into_stream - bits_in_element) / element_bits;
954
954
955
955
if (arr->length < 0 || element_index >= static_cast <size_t >(arr->length ))
956
- return boost::optional<int >();
956
+ return boost::optional<uint32_t >();
957
957
958
958
T element = arr->values [element_index];
959
959
int result = element >> bits_in_element;
960
960
size_t got = element_bits - bits_in_element;
961
961
if (got < indice_bit_count) {
962
962
if (element_index + 1 >= static_cast <size_t >(arr->length ))
963
- return boost::optional<int >();
963
+ return boost::optional<uint32_t >();
964
964
element = arr->values [element_index + 1 ];
965
965
int got_bits = ~(0xFFFFFFFF << got);
966
966
result = (result & got_bits) | (element << got);
967
967
}
968
968
969
- int out_bits = ~(0xFFFFFFFF << indice_bit_count);
970
- return boost::optional<int >(result & out_bits);
969
+ uint32_t out_bits = ~(0xFFFFFFFF << indice_bit_count);
970
+ return boost::optional<uint32_t >(result & out_bits);
971
971
}
972
972
973
973
bool Modern_Section_Compound::get_block (BlockT& block, int x, int z, int y) {
974
974
if (this ->BlockStates ) {
975
- boost::optional<int > block_data = boost::optional<int >();
975
+ boost::optional<uint32_t > block_data = boost::optional<uint32_t >();
976
976
977
977
// Static expansion of dynamic palette resolver;
978
978
// each section (16**3) contains 4096 unique blocks wihch yields max 2**12
@@ -1036,11 +1036,11 @@ namespace mc {
1036
1036
}
1037
1037
1038
1038
bool Legacy_Section_Compound::get_block (BlockT& block, int x, int z, int y) {
1039
- boost::optional<int > lower_block_type;
1040
- boost::optional<int > block_type = get_indice<nbt::Byte , 8 >(x, z, y, this ->Blocks );
1039
+ boost::optional<uint32_t > lower_block_type;
1040
+ boost::optional<uint32_t > block_type = get_indice<nbt::Byte , 8 >(x, z, y, this ->Blocks );
1041
1041
// Data values are packed two by two and the position LSB decides which
1042
1042
// half-byte contains the requested block data value.
1043
- boost::optional<int > block_data = get_indice<nbt::Byte , 4 >(x, z, y, this ->Data );
1043
+ boost::optional<uint32_t > block_data = get_indice<nbt::Byte , 4 >(x, z, y, this ->Data );
1044
1044
1045
1045
if (block_type && block_data) {
1046
1046
boost::optional<MaterialT*> material = get_material_legacy (block_type.get (), block_data.get ());
0 commit comments