| 599 | } |
| 600 | |
| 601 | void UniverseServer::processUniverseFlags() { |
| 602 | RecursiveMutexLocker locker(m_mainLock); |
| 603 | ReadLocker clientsLocker(m_clientsLock); |
| 604 | |
| 605 | if (auto actions = m_universeSettings->pullPendingFlagActions()) { |
| 606 | for (auto action : *actions) { |
| 607 | if (action.is<PlaceDungeonFlagAction>()) { |
| 608 | auto placeDungeonAction = action.get<PlaceDungeonFlagAction>(); |
| 609 | if (instanceWorldStoredOrActive(placeDungeonAction.targetInstance)) { |
| 610 | auto worldId = InstanceWorldId(placeDungeonAction.targetInstance); |
| 611 | m_pendingFlagActions.append(pair<WorldId, UniverseFlagAction>{worldId, placeDungeonAction}); |
| 612 | } |
| 613 | } |
| 614 | } |
| 615 | } |
| 616 | |
| 617 | eraseWhere(m_pendingFlagActions, [&](pair<WorldId, UniverseFlagAction> const& p) { |
| 618 | if (p.first.is<InstanceWorldId>() && instanceWorldStoredOrActive(p.first.get<InstanceWorldId>())) { |
| 619 | // world is stored or active; perform flag actions once it loads |
| 620 | if (auto maybeTargetWorld = triggerWorldCreation(p.first)) { |
| 621 | if (auto targetWorld = maybeTargetWorld.value()) { |
| 622 | if (p.second.is<PlaceDungeonFlagAction>()) { |
| 623 | auto placeDungeonAction = p.second.get<PlaceDungeonFlagAction>(); |
| 624 | locker.unlock(); |
| 625 | targetWorld->executeAction([&](WorldServerThread*, WorldServer* worldServer) { |
| 626 | worldServer->placeDungeon(placeDungeonAction.dungeonId, placeDungeonAction.targetPosition, 0); |
| 627 | }); |
| 628 | locker.lock(); |
| 629 | } |
| 630 | return true; |
| 631 | } |
| 632 | } |
| 633 | return false; |
| 634 | } else { |
| 635 | // world hasn't yet been created; flag actions will be handled by normal creation |
| 636 | return true; |
| 637 | } |
| 638 | }); |
| 639 | } |
| 640 | |
| 641 | void UniverseServer::sendPendingChat() { |
| 642 | RecursiveMutexLocker locker(m_mainLock); |
nothing calls this directly
no test coverage detected