From 24246c86a13247dea82323f3fdf60f15ab8e71d0 Mon Sep 17 00:00:00 2001 From: shylie Date: Tue, 5 May 2026 07:37:55 -0400 Subject: [PATCH] Rename variables --- src/main.cpp | 5 ++--- src/sand.cpp | 17 +++++++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 87af814..4cc3443 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -9,7 +9,7 @@ #ifdef TRACY_ENABLE #include -#endif +#endif // TRACY_ENABLE constexpr uint16_t WIDTH = 64; constexpr uint16_t HEIGHT = 64; @@ -158,8 +158,7 @@ int main(int argc, char** argv) } if (count != prev_count) { - - SDL_Log("%d\n", count); + // SDL_Log("%d\n", count); } prev_count = count; } diff --git a/src/sand.cpp b/src/sand.cpp index 57b640d..2b2aec2 100644 --- a/src/sand.cpp +++ b/src/sand.cpp @@ -2,6 +2,10 @@ #include "sand/type.h" +#ifdef TRACY_ENABLE +#include +#endif // TRACY_ENABLE + sand::type sand::sand::get(int x, int y) const { if (x < 0 || x >= width || y < 0 || y >= height) @@ -18,16 +22,17 @@ void sand::sand::set(int x, int y, type type) void sand::sand::tick() { + ZoneScoped; #pragma omp parallel for - for (int i = 0; i < width * height; i++) + for (int tile_index = 0; tile_index < width * height; tile_index++) { - const int x = i % width; - const int y = i / width; + const int x = tile_index % width; + const int y = tile_index / width; auto [begin, end] = metas[get(x, y)]; uint32_t mask = -1U; - int iter = 0; + int neighbor_index = 0; for (int dy = -1; dy <= 1; dy++) { for (int dx = -1; dx <= 1; dx++) @@ -37,10 +42,10 @@ void sand::sand::tick() continue; } - mask &= masks[iter + get(x + dx, y + dy) * 8 + mask &= masks[neighbor_index + get(x + dx, y + dy) * 8 + get(x, y) * types.size() * 8]; - iter += 1; + neighbor_index += 1; } }