MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / MergeWorkshopMods

Method MergeWorkshopMods

engine/Poseidon/UI/OptionsUIApp.cpp:1687–1730  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1685 _workshopStarted = true;
1686 StartWorkshopFetch();
1687 }
1688 if (_workshopFetch != nullptr && !_workshopMerged)
1689 {
1690 std::vector<MasterServerServiceModCatalogEntry> ready;
1691 bool take = false;
1692 {
1693 std::lock_guard<std::mutex> lk(_workshopFetch->mtx);
1694 if (_workshopFetch->done)
1695 {
1696 _workshopMerged = true;
1697 if (_workshopFetch->ok)
1698 {
1699 ready = std::move(_workshopFetch->mods);
1700 take = true;
1701 }
1702 }
1703 }
1704 if (take)
1705 MergeWorkshopMods(ready);
1706 }
1707 Display::OnSimulate(vehicle);
1708}
1709
1710void DisplayMods::StartWorkshopFetch()
1711{
1712 auto fetch = std::make_shared<ModsWorkshopFetch>();
1713 _workshopFetch = fetch;
1714 std::string host = (const char*)GetNetworkMasterServer();
1715 std::string proxy = (const char*)GetNetworkProxy();
1716 std::thread(
1717 [fetch, host, proxy]()
1718 {
1719 std::vector<MasterServerServiceModCatalogEntry> mods;
1720 const bool ok =
1721 FetchMasterServerServiceModList(host.c_str(), "", proxy.empty() ? nullptr : proxy.c_str(), mods);
1722 std::lock_guard<std::mutex> lk(fetch->mtx);
1723 fetch->mods = std::move(mods);
1724 fetch->ok = ok;
1725 fetch->done = true;
1726 })
1727 .detach();
1728}
1729
1730void DisplayMods::MergeWorkshopMods(const std::vector<MasterServerServiceModCatalogEntry>& catalog)
1731{
1732 CModsList* list = dynamic_cast<CModsList*>(GetCtrl(IDC_MODS_LIST));
1733 if (list == nullptr)

Callers 1

TriSeedWorkshopModsFunction · 0.80

Calls 11

GetCtrlFunction · 0.85
WorkshopModsRootFunction · 0.85
GetModInstallStatusFunction · 0.85
GetSourceModeMethod · 0.80
LowerStrFunction · 0.70
SizeMethod · 0.45
AddMethod · 0.45
emptyMethod · 0.45
countMethod · 0.45
SetRowsMethod · 0.45
SortMethod · 0.45

Tested by 1

TriSeedWorkshopModsFunction · 0.64