diff --git a/src/submap.cpp b/src/submap.cpp index a58b4626103de..55c6c0b7c0954 100644 --- a/src/submap.cpp +++ b/src/submap.cpp @@ -35,8 +35,6 @@ void maptile_soa::swap_soa_tile( const point &p, maptile_soa<1, 1> &othe submap::submap() { - constexpr size_t elements = SEEX * SEEY; - std::uninitialized_fill_n( &ter[0][0], elements, t_null ); std::uninitialized_fill_n( &frn[0][0], elements, f_null ); std::uninitialized_fill_n( &lum[0][0], elements, 0 ); diff --git a/src/submap.h b/src/submap.h index 17d96bd997d52..8913ced9cc40d 100644 --- a/src/submap.h +++ b/src/submap.h @@ -74,8 +74,7 @@ class submap : maptile_soa } void set_all_traps( const trap_id &trap ) { - constexpr size_t block_size = SEEX * SEEY; - std::uninitialized_fill_n( &trp[0][0], block_size, trap ); + std::uninitialized_fill_n( &trp[0][0], elements, trap ); } furn_id get_furn( const point &p ) const { @@ -88,8 +87,7 @@ class submap : maptile_soa } void set_all_furn( const furn_id &furn ) { - constexpr size_t block_size = SEEX * SEEY; - std::uninitialized_fill_n( &frn[0][0], block_size, furn ); + std::uninitialized_fill_n( &frn[0][0], elements, furn ); } ter_id get_ter( const point &p ) const { @@ -102,8 +100,7 @@ class submap : maptile_soa } void set_all_ter( const ter_id &terr ) { - constexpr size_t block_size = SEEX * SEEY; - std::uninitialized_fill_n( &ter[0][0], block_size, terr ); + std::uninitialized_fill_n( &ter[0][0], elements, terr ); } int get_radiation( const point &p ) const { @@ -251,6 +248,8 @@ class submap : maptile_soa int temperature = 0; void update_legacy_computer(); + + static constexpr size_t elements = SEEX * SEEY; }; /**