perfect: Enable PERFECT_AI_SUPPORT only on MSVC

This commit is contained in:
Calcitem 2021-01-24 14:16:41 +08:00
parent 744a0df873
commit e2f87cb477
3 changed files with 13 additions and 1 deletions

View File

@ -52,7 +52,7 @@
//#define PVS_AI //#define PVS_AI
#define MTDF_AI #define MTDF_AI
#ifdef WIN32 #ifdef _MSC_VER
#define PERFECT_AI_SUPPORT #define PERFECT_AI_SUPPORT
#endif #endif

View File

@ -31,7 +31,9 @@
#include "option.h" #include "option.h"
#include "test.h" #include "test.h"
#ifdef PERFECT_AI_SUPPORT
#include "perfect/perfect.h" #include "perfect/perfect.h"
#endif
#ifdef TEST_MODE #ifdef TEST_MODE
#ifdef QT_GUI_LIB #ifdef QT_GUI_LIB
@ -220,9 +222,11 @@ void Test::readFromMemory()
sharedMemory.unlock(); sharedMemory.unlock();
readStr = str; readStr = str;
#ifdef PERFECT_AI_SUPPORT
if (gameOptions.getPerfectAiEnabled()) { if (gameOptions.getPerfectAiEnabled()) {
perfect_command(str.toStdString().c_str()); perfect_command(str.toStdString().c_str());
} }
#endif
emit command(str.toStdString()); emit command(str.toStdString());
} }

View File

@ -40,7 +40,9 @@
#include "client.h" #include "client.h"
#include "option.h" #include "option.h"
#ifdef PERFECT_AI_SUPPORT
#include "perfect/perfect.h" #include "perfect/perfect.h"
#endif
using namespace std; using namespace std;
@ -230,9 +232,11 @@ void Game::gameReset()
moveHistory.emplace_back(bak); moveHistory.emplace_back(bak);
} }
#ifdef PERFECT_AI_SUPPORT
if (gameOptions.getPerfectAiEnabled()) { if (gameOptions.getPerfectAiEnabled()) {
perfect_reset(); perfect_reset();
} }
#endif
position.reset(); position.reset();
elapsedSeconds[BLACK] = elapsedSeconds[WHITE] = 0; elapsedSeconds[BLACK] = elapsedSeconds[WHITE] = 0;
@ -596,11 +600,13 @@ void Game::setPerfectAi(bool enabled)
gameOptions.setPerfectAiEnabled(enabled); gameOptions.setPerfectAiEnabled(enabled);
settings->setValue("Options/PerfectAI", enabled); settings->setValue("Options/PerfectAI", enabled);
#ifdef PERFECT_AI_SUPPORT
if (enabled) { if (enabled) {
perfect_reset(); perfect_reset();
} else { } else {
perfect_exit(); perfect_exit();
} }
#endif
} }
void Game::setIDS(bool enabled) void Game::setIDS(bool enabled)
@ -918,9 +924,11 @@ bool Game::actionPiece(QPointF p)
} }
if (result) { if (result) {
#ifdef PERFECT_AI_SUPPORT
if (gameOptions.getPerfectAiEnabled()) { if (gameOptions.getPerfectAiEnabled()) {
perfect_command((char *)position.record); perfect_command((char *)position.record);
} }
#endif
moveHistory.emplace_back(position.record); moveHistory.emplace_back(position.record);