Rename variables
This commit is contained in:
parent
bcc328c057
commit
24246c86a1
@ -9,7 +9,7 @@
|
||||
|
||||
#ifdef TRACY_ENABLE
|
||||
#include <tracy/Tracy.hpp>
|
||||
#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;
|
||||
}
|
||||
|
||||
17
src/sand.cpp
17
src/sand.cpp
@ -2,6 +2,10 @@
|
||||
|
||||
#include "sand/type.h"
|
||||
|
||||
#ifdef TRACY_ENABLE
|
||||
#include <tracy/Tracy.hpp>
|
||||
#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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user