diff options
| author | untodesu <kirill@untode.su> | 2025-03-22 15:08:17 +0500 |
|---|---|---|
| committer | untodesu <kirill@untode.su> | 2025-03-22 15:08:17 +0500 |
| commit | e34a973f647bc6b7814ad1f3e837689f8478b84a (patch) | |
| tree | 7c8cb1702c16eb68e7acf942d46633a3833bba00 /game/shared/feature.cc | |
| parent | d8f0fcb101c21b3c4d746d20da6e56e7591006e4 (diff) | |
| download | voxelius-e34a973f647bc6b7814ad1f3e837689f8478b84a.tar.bz2 voxelius-e34a973f647bc6b7814ad1f3e837689f8478b84a.zip | |
A bunch of pre-release fixes
- Updated localization for protocol messages
- Added item registry check into server-side
- Slightly improved how features are stored
Diffstat (limited to 'game/shared/feature.cc')
| -rw-r--r-- | game/shared/feature.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/game/shared/feature.cc b/game/shared/feature.cc index 6f884b2..845bb40 100644 --- a/game/shared/feature.cc +++ b/game/shared/feature.cc @@ -6,10 +6,10 @@ #include "shared/dimension.hh" #include "shared/voxel_storage.hh" -void Feature::place(const voxel_pos &vpos, Dimension *dimension, bool overwrite) const +void Feature::place(const voxel_pos &vpos, Dimension *dimension) const { - for(const auto &it : (*this)) { - auto it_vpos = vpos + it.first; + for(const auto [rpos, voxel, overwrite] : (*this)) { + auto it_vpos = vpos + rpos; auto it_cpos = coord::to_chunk(it_vpos); if(auto chunk = dimension->create_chunk(it_cpos)) { @@ -23,15 +23,15 @@ void Feature::place(const voxel_pos &vpos, Dimension *dimension, bool overwrite) continue; } - chunk->set_voxel(it.second, it_index); + chunk->set_voxel(voxel, it_index); } } } -void Feature::place(const voxel_pos &vpos, const chunk_pos &cpos, VoxelStorage &voxels, bool overwrite) const +void Feature::place(const voxel_pos &vpos, const chunk_pos &cpos, VoxelStorage &voxels) const { - for(const auto &it : (*this)) { - auto it_vpos = vpos + it.first; + for(const auto [rpos, voxel, overwrite] : (*this)) { + auto it_vpos = vpos + rpos; auto it_cpos = coord::to_chunk(it_vpos); if(it_cpos == cpos) { @@ -45,7 +45,7 @@ void Feature::place(const voxel_pos &vpos, const chunk_pos &cpos, VoxelStorage & continue; } - voxels[it_index] = it.second; + voxels[it_index] = voxel; } } } |
