Skip to content

Commit

Permalink
a
Browse files Browse the repository at this point in the history
  • Loading branch information
sthalik committed Jan 11, 2024
1 parent e990e7c commit 618af3c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 31 deletions.
33 changes: 4 additions & 29 deletions editor/update.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,12 @@ namespace floormat {

//#define FM_NO_BINDINGS

void app::maybe_initialize_chunk_(const chunk_coords_& pos, chunk& c)
void app::maybe_initialize_chunk_([[maybe_unused]] const chunk_coords_& pos, chunk& c)
{
auto floor1 = loader.ground_atlas("ground-tiles");
auto floor2 = loader.ground_atlas("metal1");
auto wall1 = loader.ground_atlas("wood2");
auto wall2 = loader.ground_atlas("wood1");
auto door = loader.anim_atlas("door-close", loader.SCENERY_PATH);
auto table = loader.anim_atlas("table", loader.SCENERY_PATH);
auto control_panel = loader.anim_atlas("control-panel", loader.SCENERY_PATH);
auto floor1 = loader.ground_atlas("floor-tiles");

(void)pos; (void)c;

[[maybe_unused]] constexpr auto N = TILE_MAX_DIM;
for (auto [x, k, pt] : c) {
#if 1
const auto& atlas = floor1;
#else
const auto& atlas = pt.x == N/2 || pt.y == N/2 ? _floor2 : _floor1;
#endif
x.ground() = { atlas, variant_t(k % atlas->num_tiles()) };
}
#if 0
constexpr auto K = N/2;
c[{K, K }].wall_north() = { _wall1, 0 };
c[{K, K }].wall_west() = { _wall2, 0 };
c[{K, K+1}].wall_north() = { _wall1, 0 };
c[{K+1, K }].wall_west() = { _wall2, 0 };
c[{K+3, K+1}].scenery() = { scenery::door, _door, rotation::N, };
c[{ 3, 4 }].scenery() = { scenery::generic, _table, rotation::W, };
c[{K, K+1}].scenery() = { scenery::generic, _control_panel, rotation::N, scenery::frame_t{0}, pass_mode::pass };
#endif
for (auto [x, k, pt] : c)
x.ground() = { floor1, variant_t(k % floor1->num_tiles()) };
c.mark_modified();
}

Expand Down
4 changes: 3 additions & 1 deletion loader/ground-atlas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,10 @@ std::shared_ptr<class ground_atlas> loader_impl::ground_atlas(StringView name, b
ArrayView<const ground_info> loader_impl::ground_atlas_list() noexcept(false)
{
if (ground_atlas_map.empty()) [[unlikely]]
{
get_ground_atlas_list();
fm_assert(!ground_atlas_map.empty());
fm_assert(!ground_atlas_map.empty());
}
return ground_atlas_array;
}

Expand Down
4 changes: 3 additions & 1 deletion loader/wall-atlas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,10 @@ void loader_impl::get_wall_atlas_list()
ArrayView<const wall_info> loader_impl::wall_atlas_list()
{
if (wall_atlas_map.empty()) [[unlikely]]
{
get_wall_atlas_list();
fm_assert(!wall_atlas_map.empty());
fm_assert(!wall_atlas_map.empty());
}
return wall_atlas_array;
}

Expand Down

0 comments on commit 618af3c

Please sign in to comment.