perfect: Init only once

This commit is contained in:
Calcitem 2021-01-23 08:37:06 +08:00
parent dd8fafacd4
commit cbd92f9a08
1 changed files with 6 additions and 2 deletions

View File

@ -2,8 +2,8 @@
// Perfect AI
Mill *mill;
PerfectAI *ai;
Mill *mill = nullptr;
PerfectAI *ai = nullptr;
int perfect_init(void)
{
@ -13,6 +13,10 @@ int perfect_init(void)
char databaseDirectory[] = "";
#endif
if (mill != nullptr) {
return 0;
}
mill = new Mill();
ai = new PerfectAI(databaseDirectory);
ai->setDatabasePath(databaseDirectory);