diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-03 19:40:11 +0100 |
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-03-03 20:34:02 +0100 |
| commit | 3d7ae4c401d5bd6109a7fd25eb22e5bc77f0a4aa (patch) | |
| tree | 7c673746944b85fbafae891ac69594326b15b517 /src/chunk.cpp | |
| parent | 6d0a594e618f165eb2823bb31eb3cfe21ec1e7c5 (diff) | |
src: rework scenery updates
Diffstat (limited to 'src/chunk.cpp')
| -rw-r--r-- | src/chunk.cpp | 51 |
1 files changed, 48 insertions, 3 deletions
diff --git a/src/chunk.cpp b/src/chunk.cpp index 8310c756..72b35b84 100644 --- a/src/chunk.cpp +++ b/src/chunk.cpp @@ -31,10 +31,55 @@ auto chunk::cend() const noexcept -> const_iterator { return const_iterator { *t auto chunk::begin() const noexcept -> const_iterator { return cbegin(); } auto chunk::end() const noexcept -> const_iterator { return cend(); } -void chunk::mark_ground_modified() noexcept { _ground_modified = true; _pass_modified = true; } -void chunk::mark_walls_modified() noexcept { _walls_modified = true; _pass_modified = true; } -void chunk::mark_scenery_modified() noexcept { _scenery_modified = true; _pass_modified = true; } +//#define FM_DEBUG_RELOAD + +#ifdef FM_DEBUG_RELOAD +static std::size_t _reloadno_ = 0; +#endif + +void chunk::mark_ground_modified() noexcept +{ +#ifdef FM_DEBUG_RELOAD + if (!_ground_modified) + fm_debug("ground reload %zu", ++_reloadno_); +#endif + _ground_modified = true; + mark_passability_modified(); +} + +// todo this can use _replace_bbox too +void chunk::mark_walls_modified() noexcept +{ +#ifdef FM_DEBUG_RELOAD + if (!_walls_modified) + fm_debug("wall reload %zu", ++_reloadno_); +#endif + _walls_modified = true; + mark_passability_modified(); +} + +void chunk::mark_scenery_modified(bool collision_too) noexcept // todo remove bool +{ +#ifdef FM_DEBUG_RELOAD + if (!_scenery_modified) + fm_debug("scenery reload %zu", ++_reloadno_); +#endif + _scenery_modified = true; + if (collision_too) + mark_passability_modified(); +} + +void chunk::mark_passability_modified() noexcept +{ +#ifdef FM_DEBUG_RELOAD + if (!_pass_modified) + fm_debug("pass reload %zu", ++_reloadno_); +#endif + _pass_modified = true; +} + bool chunk::is_passability_modified() const noexcept { return _pass_modified; } +bool chunk::is_scenery_modified() const noexcept { return _scenery_modified; } void chunk::mark_modified() noexcept { |
