修复开启 BOOK_LEARNING 宏后编译不通过的问题

This commit is contained in:
CalciteM Team 2019-07-21 13:59:54 +08:00
parent 58d42fb8ba
commit 5899b14f92
2 changed files with 6 additions and 5 deletions

View File

@ -1059,10 +1059,10 @@ bool NineChessAi_ab::findBookHash(uint64_t hash, HashValue &hashValue)
return bookHashMap.find(hash, hashValue);
}
int NineChessAi_ab::recordBookHash(const HashValue &hashValue)
int NineChessAi_ab::recordBookHash(uint64_t hash, const HashValue &hashValue)
{
//hashMapMutex.lock();
bookHashMap.insert(hashValue.hash, hashValue);
bookHashMap.insert(hash, hashValue);
//hashMapMutex.unlock();
return 0;
@ -1078,6 +1078,7 @@ void NineChessAi_ab::clearBookHashMap()
void NineChessAi_ab::recordOpeningBookToHashMap()
{
HashValue hashValue;
uint64_t hash = 0;
for (auto iter = openingBook.begin(); iter != openingBook.end(); ++iter)
{
@ -1087,8 +1088,8 @@ void NineChessAi_ab::recordOpeningBookToHashMap()
}
#endif
memset(&hashValue, 0, sizeof(HashValue));
hashValue.hash = *iter;
recordBookHash(hashValue); // 暂时使用直接覆盖策略
hash = *iter;
recordBookHash(hash, hashValue); // 暂时使用直接覆盖策略
}
openingBook.clear();

View File

@ -113,7 +113,7 @@ public:
#ifdef BOOK_LEARNING
bool findBookHash(uint64_t hash, HashValue &hashValue);
static int recordBookHash(const HashValue &hashValue);
static int recordBookHash(uint64_t hash, const HashValue &hashValue);
void clearBookHashMap();
static void recordOpeningBookToHashMap();
#endif // BOOK_LEARNING