mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 01:43:27 +02:00
Fix replicated nodes not being properly updated when logging in or changing settings
This commit is contained in:
parent
ca196f6141
commit
8d5dc21de8
1 changed files with 13 additions and 6 deletions
|
@ -2234,17 +2234,24 @@ void DomainServer::updateReplicatedNodes() {
|
||||||
}
|
}
|
||||||
|
|
||||||
auto nodeList = DependencyManager::get<LimitedNodeList>();
|
auto nodeList = DependencyManager::get<LimitedNodeList>();
|
||||||
nodeList->eachNode([&](const SharedNodePointer& otherNode) {
|
nodeList->eachMatchingNode([this](const SharedNodePointer& otherNode) -> bool {
|
||||||
if (shouldReplicateNode(*otherNode)) {
|
return otherNode->getType() == NodeType::Agent;
|
||||||
qDebug() << "Setting node to replicated: " << otherNode->getUUID();
|
}, [this](const SharedNodePointer& otherNode) {
|
||||||
otherNode->setIsReplicated(true);
|
auto shouldReplicate = shouldReplicateNode(*otherNode);
|
||||||
|
auto isReplicated = otherNode->isReplicated();
|
||||||
|
qDebug() << "Checking " << otherNode->getPermissions().getVerifiedUserName();
|
||||||
|
if (isReplicated && !shouldReplicate) {
|
||||||
|
qDebug() << "Setting node to NOT be replicated: " << otherNode->getUUID();
|
||||||
|
} else if (!isReplicated && shouldReplicate) {
|
||||||
|
qDebug() << "Setting node to replicated: " << otherNode->getUUID();
|
||||||
|
}
|
||||||
|
otherNode->setIsReplicated(shouldReplicate);
|
||||||
}
|
}
|
||||||
});
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DomainServer::shouldReplicateNode(const Node& node) {
|
bool DomainServer::shouldReplicateNode(const Node& node) {
|
||||||
QString verifiedUsername = node.getPermissions().getVerifiedUserName();
|
QString verifiedUsername = node.getPermissions().getVerifiedUserName();
|
||||||
qDebug() << "Verified username: " << verifiedUsername;
|
|
||||||
auto it = find(_replicatedUsernames.cbegin(), _replicatedUsernames.cend(), verifiedUsername);
|
auto it = find(_replicatedUsernames.cbegin(), _replicatedUsernames.cend(), verifiedUsername);
|
||||||
return it != _replicatedUsernames.end() && node.getType() == NodeType::Agent;
|
return it != _replicatedUsernames.end() && node.getType() == NodeType::Agent;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue