Change generate newDna

This commit is contained in:
2025-01-02 22:52:40 +01:00
parent 8066ba5103
commit 91f7966224
2 changed files with 8 additions and 22 deletions

View File

@@ -1,4 +1,5 @@
#include <cmath>
#include <cstddef>
#include "values/Dna.hpp"
#include "values/mrand.hpp"
@@ -7,11 +8,6 @@
void newDna(Dna &dna)
{
dna.moonX = mrand::getValue(0, 254);
dna.moonY = mrand::getValue(0, 254);
dna.moonSize = mrand::getValue(0, 254);
dna.colorSet = mrand::getValue(0, 254);
dna.mountenSeed.a = mrand::getInt();
dna.mountenSeed.b = mrand::getInt();
dna.mountenSeed.c = mrand::getInt();
@@ -27,13 +23,10 @@ void newDna(Dna &dna)
dna.branchSeed.c = mrand::getInt();
dna.branchSeed.d = mrand::getInt();
for (size_t i = 0; i < MAX_DEPTH; i++)
uint8_t *array = (uint8_t *)&dna;
for (size_t i = offsetof(Dna, moonX); i < sizeof(Dna); i++)
{
uint8_t *array = (uint8_t *)&dna.branches[i];
for (size_t i = 0; i < sizeof(Branch); i++)
{
array[i] = mrand::getValue(0, 254);
}
array[i] = mrand::getValue(0, 254);
}
return;