diff --git a/modules/wfc/wave_form_collapse.cpp b/modules/wfc/wave_form_collapse.cpp index 1399db1bd..b1fceb12d 100644 --- a/modules/wfc/wave_form_collapse.cpp +++ b/modules/wfc/wave_form_collapse.cpp @@ -230,13 +230,11 @@ void WaveFormCollapse::propagate() { while (propagating.size() != 0) { // The cell and pattern that has been set to false. - const PropagatingEntry &e = propagating[propagating.size() - 1]; + uint32_t y1 = propagating[propagating.size() - 1]; + uint32_t x1 = propagating[propagating.size() - 2]; + uint32_t pattern = propagating[propagating.size() - 3]; - uint32_t y1 = e.data[0]; - uint32_t x1 = e.data[1]; - uint32_t pattern = e.data[2]; - - propagating.resize(propagating.size() - 1); + propagating.resize(propagating.size() - 3); // We propagate the information in all 4 directions. for (uint32_t direction = 0; direction < 4; direction++) { diff --git a/modules/wfc/wave_form_collapse.h b/modules/wfc/wave_form_collapse.h index d47a045cd..d5fee998a 100644 --- a/modules/wfc/wave_form_collapse.h +++ b/modules/wfc/wave_form_collapse.h @@ -7,6 +7,7 @@ #include "array_2d.h" #include "array_3d.h" #include "core/vector.h" +#include "core/pool_vector.h" #include "core/reference.h" @@ -24,22 +25,6 @@ public: Vector directions[4]; }; - struct PropagatingEntry { - uint32_t data[3]; - - PropagatingEntry() { - for (int i = 0; i < 3; ++i) { - data[i] = 0; - } - } - - PropagatingEntry(uint32_t x, uint32_t y, uint32_t z) { - data[0] = x; - data[1] = y; - data[2] = z; - } - }; - struct CompatibilityEntry { int direction[4]; @@ -105,7 +90,9 @@ public: CompatibilityEntry temp; compatible.get(y, x, pattern) = temp; - propagating.push_back(PropagatingEntry(y, x, pattern)); + propagating.push_back(pattern); + propagating.push_back(x); + propagating.push_back(y); } constexpr uint32_t get_opposite_direction(uint32_t direction) { @@ -172,7 +159,7 @@ private: // All the tuples (y, x, pattern) that should be propagated. // The tuple should be propagated when wave.get(y, x, pattern) is set to false. - Vector propagating; + Vector propagating; // compatible.get(y, x, pattern)[direction] contains the number of patterns // present in the wave that can be placed in the cell next to (y,x) in the