Rename variables

This commit is contained in:
shylie 2026-05-05 07:37:55 -04:00
parent bcc328c057
commit 24246c86a1
Signed by: shylie
GPG Key ID: 20C8D70580687D9D
2 changed files with 13 additions and 9 deletions

View File

@ -9,7 +9,7 @@
#ifdef TRACY_ENABLE #ifdef TRACY_ENABLE
#include <tracy/Tracy.hpp> #include <tracy/Tracy.hpp>
#endif #endif // TRACY_ENABLE
constexpr uint16_t WIDTH = 64; constexpr uint16_t WIDTH = 64;
constexpr uint16_t HEIGHT = 64; constexpr uint16_t HEIGHT = 64;
@ -158,8 +158,7 @@ int main(int argc, char** argv)
} }
if (count != prev_count) if (count != prev_count)
{ {
// SDL_Log("%d\n", count);
SDL_Log("%d\n", count);
} }
prev_count = count; prev_count = count;
} }

View File

@ -2,6 +2,10 @@
#include "sand/type.h" #include "sand/type.h"
#ifdef TRACY_ENABLE
#include <tracy/Tracy.hpp>
#endif // TRACY_ENABLE
sand::type sand::sand::get(int x, int y) const sand::type sand::sand::get(int x, int y) const
{ {
if (x < 0 || x >= width || y < 0 || y >= height) 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() void sand::sand::tick()
{ {
ZoneScoped;
#pragma omp parallel for #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 x = tile_index % width;
const int y = i / width; const int y = tile_index / width;
auto [begin, end] = metas[get(x, y)]; auto [begin, end] = metas[get(x, y)];
uint32_t mask = -1U; uint32_t mask = -1U;
int iter = 0; int neighbor_index = 0;
for (int dy = -1; dy <= 1; dy++) for (int dy = -1; dy <= 1; dy++)
{ {
for (int dx = -1; dx <= 1; dx++) for (int dx = -1; dx <= 1; dx++)
@ -37,10 +42,10 @@ void sand::sand::tick()
continue; 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]; + get(x, y) * types.size() * 8];
iter += 1; neighbor_index += 1;
} }
} }