1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-07 23:33:15 +02:00

Nullkiller: update / fix build, core changes required for Nullkiller AI

This commit is contained in:
Andrii Danylchenko
2021-05-16 20:53:11 +03:00
committed by Andrii Danylchenko
parent b4241670ba
commit 3fa7e0976f
28 changed files with 379 additions and 233 deletions

View File

@@ -901,8 +901,7 @@ TConstBonusListPtr CBonusSystemNode::getAllBonuses(const CSelector &selector, co
if (CBonusSystemNode::cachingEnabled && limitOnUs)
{
// Exclusive access for one thread
static boost::mutex m;
boost::mutex::scoped_lock lock(m);
boost::lock_guard<boost::mutex> lock(sync);
// If the bonus system tree changes(state of a single node or the relations to each other) then
// cache all bonus objects. Selector objects doesn't matter.
@@ -993,7 +992,8 @@ CBonusSystemNode::CBonusSystemNode()
: bonuses(true),
exportedBonuses(true),
nodeType(UNKNOWN),
cachedLast(0)
cachedLast(0),
sync()
{
}
@@ -1001,7 +1001,8 @@ CBonusSystemNode::CBonusSystemNode(ENodeTypes NodeType)
: bonuses(true),
exportedBonuses(true),
nodeType(NodeType),
cachedLast(0)
cachedLast(0),
sync()
{
}
@@ -1010,7 +1011,8 @@ CBonusSystemNode::CBonusSystemNode(CBonusSystemNode && other):
exportedBonuses(std::move(other.exportedBonuses)),
nodeType(other.nodeType),
description(other.description),
cachedLast(0)
cachedLast(0),
sync()
{
std::swap(parents, other.parents);
std::swap(children, other.children);
@@ -1189,7 +1191,6 @@ void CBonusSystemNode::childDetached(CBonusSystemNode *child)
logBonus->error("Error! %s #cannot be detached from# %s", child->nodeName(), nodeName());
throw std::runtime_error("internal error");
}
}
void CBonusSystemNode::detachFromAll()