Android Fix doesnt call deinit
This commit is contained in:
parent
7498b2675d
commit
2439a986a3
@ -29,6 +29,8 @@ public:
|
||||
int generation;
|
||||
|
||||
private:
|
||||
void saveData();
|
||||
void saveVec();
|
||||
uint128 randSeed;
|
||||
uint128 id;
|
||||
int queued;
|
||||
|
@ -71,6 +71,10 @@ void DnaManager::init()
|
||||
}
|
||||
|
||||
void DnaManager::deinit()
|
||||
{
|
||||
}
|
||||
|
||||
void DnaManager::saveData()
|
||||
{
|
||||
const char *filename = sys::transformFilePath("data");
|
||||
|
||||
@ -92,9 +96,12 @@ void DnaManager::deinit()
|
||||
fwrite(disliked.data(), sizeof(tmp) * tmp, 1, file);
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
filename = sys::transformFilePath("array");
|
||||
file = fopen(filename, "wb");
|
||||
void DnaManager::saveVec()
|
||||
{
|
||||
const char *filename = sys::transformFilePath("array");
|
||||
FILE *file = fopen(filename, "wb");
|
||||
if (file == NULL)
|
||||
return;
|
||||
fwrite(vector.data(), sizeof(Dna) * NUM_PER_GEN, 1, file);
|
||||
@ -143,7 +150,9 @@ void DnaManager::like(Unit unit)
|
||||
queued = 0;
|
||||
showed = 0;
|
||||
generation += 1;
|
||||
saveVec();
|
||||
}
|
||||
saveData();
|
||||
}
|
||||
|
||||
void DnaManager::newGen()
|
||||
|
Loading…
x
Reference in New Issue
Block a user