@@ -45,7 +45,7 @@ TextureSet::TextureSet (MapChunkHeader const& header, MPQFile* f, size_t base, M
45
45
if (_layers_info[layer].flags & 0x100 )
46
46
{
47
47
f->seek (alpha_base + _layers_info[layer].ofsAlpha );
48
- alphamaps[layer - 1 ] = boost::in_place (f, _layers_info[layer].flags , use_big_alphamaps, do_not_fix_alpha_map);
48
+ alphamaps[layer - 1 ] = std::make_unique<Alphamap> (f, _layers_info[layer].flags , use_big_alphamaps, do_not_fix_alpha_map);
49
49
}
50
50
}
51
51
@@ -73,12 +73,12 @@ int TextureSet::addTexture (scoped_blp_texture_reference texture)
73
73
74
74
if (texLevel)
75
75
{
76
- alphamaps[texLevel - 1 ] = boost::in_place ();
76
+ alphamaps[texLevel - 1 ] = std::make_unique<Alphamap> ();
77
77
}
78
78
79
79
if (tmp_edit_values && nTextures == 1 )
80
80
{
81
- tmp_edit_values.get ()[0 ].fill (255 .f );
81
+ tmp_edit_values.get ()-> map [0 ].fill (255 .f );
82
82
}
83
83
}
84
84
@@ -175,7 +175,7 @@ void TextureSet::eraseTextures()
175
175
{
176
176
if (i > 0 )
177
177
{
178
- alphamaps[i - 1 ] = boost::none ;
178
+ alphamaps[i - 1 ]. reset () ;
179
179
}
180
180
_layers_info[i] = ENTRY_MCLY ();
181
181
}
@@ -188,7 +188,7 @@ void TextureSet::eraseTextures()
188
188
_need_amap_update = true ;
189
189
_need_lod_texture_map_update = true ;
190
190
191
- tmp_edit_values = boost::none ;
191
+ tmp_edit_values. reset () ;
192
192
}
193
193
194
194
void TextureSet::eraseTexture (size_t id)
@@ -203,21 +203,21 @@ void TextureSet::eraseTexture(size_t id)
203
203
{
204
204
if (i)
205
205
{
206
- alphamaps[i - 1 ] = boost::none ;
206
+ alphamaps[i - 1 ]. reset () ;
207
207
std::swap (alphamaps[i - 1 ], alphamaps[i]);
208
208
}
209
209
210
210
if (tmp_edit_values)
211
211
{
212
- tmp_edit_values.get ()[i].swap (tmp_edit_values.get ()[i+1 ]);
212
+ tmp_edit_values.get ()-> map [i].swap (tmp_edit_values.get ()-> map [i+1 ]);
213
213
}
214
214
215
215
_layers_info[i] = _layers_info[i + 1 ];
216
216
}
217
217
218
218
if (nTextures > 1 )
219
219
{
220
- alphamaps[nTextures - 2 ] = boost::none ;
220
+ alphamaps[nTextures - 2 ]. reset () ;
221
221
}
222
222
223
223
textures.erase (textures.begin ()+id);
@@ -229,7 +229,7 @@ void TextureSet::eraseTexture(size_t id)
229
229
// set the default values for the temporary alphamap too
230
230
if (tmp_edit_values)
231
231
{
232
- tmp_edit_values.get ()[nTextures].fill (0 .f );
232
+ tmp_edit_values.get ()-> map [nTextures].fill (0 .f );
233
233
}
234
234
235
235
_need_amap_update = true ;
@@ -295,7 +295,7 @@ bool TextureSet::eraseUnusedTextures()
295
295
296
296
if (tmp_edit_values)
297
297
{
298
- auto & amaps = tmp_edit_values.get ();
298
+ auto & amaps = * tmp_edit_values.get ();
299
299
300
300
for (int i = 0 ; i < 4096 && visible_tex.size () < nTextures; ++i)
301
301
{
@@ -394,7 +394,7 @@ bool TextureSet::paintTexture(float xbase, float zbase, float x, float z, Brush*
394
394
}
395
395
396
396
create_temporary_alphamaps_if_needed ();
397
- auto & amaps = tmp_edit_values.get ();
397
+ auto & amaps = * tmp_edit_values.get ();
398
398
399
399
zPos = zbase;
400
400
@@ -582,7 +582,7 @@ bool TextureSet::replace_texture( float xbase
582
582
}
583
583
584
584
create_temporary_alphamaps_if_needed ();
585
- auto & amap = tmp_edit_values.get ();
585
+ auto & amap = * tmp_edit_values.get ();
586
586
587
587
for (int j = 0 ; j < 64 ; j++)
588
588
{
@@ -701,7 +701,7 @@ std::vector<std::vector<uint8_t>> TextureSet::save_alpha(bool big_alphamap)
701
701
{
702
702
alphas_to_old_alpha (tab);
703
703
}
704
-
704
+
705
705
706
706
auto const combine_nibble
707
707
(
@@ -857,7 +857,7 @@ void TextureSet::merge_layers(size_t id1, size_t id2)
857
857
858
858
create_temporary_alphamaps_if_needed ();
859
859
860
- auto & amap = tmp_edit_values.get ();
860
+ auto & amap = * tmp_edit_values.get ();
861
861
862
862
for (int i = 0 ; i < 64 * 64 ; ++i)
863
863
{
@@ -902,7 +902,7 @@ void TextureSet::bind_alpha(std::size_t id)
902
902
if (tmp_edit_values)
903
903
{
904
904
std::vector<float > amap (3 * 64 * 64 );
905
- auto & tmp_amaps = tmp_edit_values.get ();
905
+ auto & tmp_amaps = * tmp_edit_values.get ();
906
906
907
907
for (int i = 0 ; i < 64 * 64 ; ++i)
908
908
{
@@ -951,12 +951,12 @@ void TextureSet::bind_alpha(std::size_t id)
951
951
namespace
952
952
{
953
953
misc::max_capacity_stack_vector<std::size_t , 4 > current_layer_values
954
- (std::uint8_t nTextures, boost::optional <Alphamap> const * alphamaps, std::size_t pz, std::size_t px)
954
+ (std::uint8_t nTextures, std::unique_ptr <Alphamap> const * alphamaps, std::size_t pz, std::size_t px)
955
955
{
956
956
misc::max_capacity_stack_vector<std::size_t , 4 > values (nTextures, 0xFF );
957
957
for (std::uint8_t i = 1 ; i < nTextures; ++i)
958
958
{
959
- values[i] = alphamaps[i - 1 ].get (). getAlpha (64 * pz + px);
959
+ values[i] = alphamaps[i - 1 ].get ()-> getAlpha (64 * pz + px);
960
960
values[0 ] -= values[i];
961
961
}
962
962
return values;
@@ -1028,11 +1028,11 @@ bool TextureSet::apply_alpha_changes()
1028
1028
{
1029
1029
if (!tmp_edit_values || nTextures < 2 )
1030
1030
{
1031
- tmp_edit_values = boost::none ;
1031
+ tmp_edit_values. reset () ;
1032
1032
return false ;
1033
1033
}
1034
1034
1035
- auto & new_amaps = tmp_edit_values.get ();
1035
+ auto & new_amaps = * tmp_edit_values.get ();
1036
1036
std::array<std::uint16_t , 64 * 64 > totals;
1037
1037
totals.fill (0 );
1038
1038
@@ -1059,7 +1059,7 @@ bool TextureSet::apply_alpha_changes()
1059
1059
_need_amap_update = true ;
1060
1060
_need_lod_texture_map_update = true ;
1061
1061
1062
- tmp_edit_values = boost::none ;
1062
+ tmp_edit_values. reset () ;
1063
1063
1064
1064
return true ;
1065
1065
}
@@ -1071,9 +1071,9 @@ void TextureSet::create_temporary_alphamaps_if_needed()
1071
1071
return ;
1072
1072
}
1073
1073
1074
- tmp_edit_values. emplace ();
1074
+ tmp_edit_values = std::make_unique<tmp_edit_alpha_values> ();
1075
1075
1076
- tmp_edit_alpha_values& values = tmp_edit_values.get ();
1076
+ tmp_edit_alpha_values& values = * tmp_edit_values.get ();
1077
1077
1078
1078
for (int i = 0 ; i < 64 * 64 ; ++i)
1079
1079
{
0 commit comments