diff --git a/Dependencies/easywsclient/easywsclient.cpp b/Dependencies/easywsclient/easywsclient.cpp index 7d684c1cc..952d380ee 100644 --- a/Dependencies/easywsclient/easywsclient.cpp +++ b/Dependencies/easywsclient/easywsclient.cpp @@ -514,8 +514,7 @@ easywsclient::WebSocket::pointer from_url(const std::string& url, bool useMask, } if (is_ssl) { - int res = 0; - auto err_out = [res,ptConnCtx]() { + auto err_out = [ptConnCtx] { ERR_print_errors_cb(print_error_callback, 0); char err_str[255]; wolfSSL_ERR_error_string(SSL_get_error(ptConnCtx->sslHandle, 0),err_str); diff --git a/GWToolboxdll/Modules/SalvageInfoModule.cpp b/GWToolboxdll/Modules/SalvageInfoModule.cpp index 8333c0c4b..77080e33d 100644 --- a/GWToolboxdll/Modules/SalvageInfoModule.cpp +++ b/GWToolboxdll/Modules/SalvageInfoModule.cpp @@ -229,7 +229,7 @@ namespace { // Detected weapon type page. We need to go to the weapon with same name page and fetch materials from there const auto expected_token = std::format("{} (weapon)", info->en_name.string()); std::unordered_set sub_urls; - std::string::const_iterator sub_search_start(response.cbegin()); + auto sub_search_start(response.cbegin()); while (std::regex_search(sub_search_start, response.cend(), m, sub_links_regex)) { const auto entry = m[1].str(); // Search for entries that match [WeaponName] (weapon) token @@ -252,7 +252,7 @@ namespace { } // Iterate over all skills in this list. - const auto infobox_row_regex = std::regex( + static const std::regex infobox_row_regex( "(?:|]+>)[\\s\\S]*?(?:|]+>)([\\s\\S]*?)[\\s\\S]*?(?:|]+>)([\\s\\S]*?)[\\s\\S]*?" ); auto words_begin = std::sregex_iterator(infobox_content.begin(), infobox_content.end(), infobox_row_regex); @@ -272,13 +272,12 @@ namespace { } info->loading = false; // Now we've got the wiki info parsed, trigger an item update ui message; this will refresh the item tooltip - GW::GameThread::Enqueue([info]() { + GW::GameThread::Enqueue([info] { const auto item = GW::Items::GetHoveredItem(); if (item && wcscmp(item->name_enc, info->en_name.encoded().c_str()) == 0) { GW::UI::SendUIMessage(GW::UI::UIMessage::kItemUpdated, item); } - }); - (response); + }); } // Run on worker thread, so we can Sleep! @@ -288,7 +287,7 @@ namespace { // @Cleanup: this should never hang, but should we handle it? Sleep(16); } - const auto url = GuiUtils::WikiUrl(info->en_name.string().c_str()); + const auto url = GuiUtils::WikiUrl(info->en_name.string()); Resources::Download(url, OnWikiContentDownloaded, info, std::chrono::days(30)); } @@ -300,7 +299,7 @@ namespace { if (found == salvage_info_by_single_item_name.end() || found->second->failed) { if (found != salvage_info_by_single_item_name.end()) { - delete (found->second); + delete found->second; } // Need to fetch info for this item. auto salvage_info = new SalvageInfo(); @@ -308,7 +307,7 @@ namespace { salvage_info->en_name.reset(single_item_name); salvage_info_by_single_item_name[single_item_name] = salvage_info; salvage_info->loading = true; - Resources::EnqueueWorkerTask([salvage_info]() { + Resources::EnqueueWorkerTask([salvage_info] { FetchSalvageInfoFromGuildWarsWiki(salvage_info); }); @@ -389,7 +388,7 @@ void SalvageInfoModule::Initialize() ASSERT(GW::HookBase::CreateHook((void**)&GetItemDescription_Func, OnGetItemDescription, (void**)&GetItemDescription_Ret) == 0); GW::HookBase::EnableHooks(GetItemDescription_Func); } - GW::GameThread::Enqueue([]() { + GW::GameThread::Enqueue([] { materials = { new CraftingMaterial(GW::Constants::ItemID::Bone, GW::EncStrings::Bone), new CraftingMaterial(GW::Constants::ItemID::IronIngot, GW::EncStrings::IronIngot), diff --git a/GWToolboxdll/Utils/GuiUtils.cpp b/GWToolboxdll/Utils/GuiUtils.cpp index 20df4cb2e..1e6347dd4 100644 --- a/GWToolboxdll/Utils/GuiUtils.cpp +++ b/GWToolboxdll/Utils/GuiUtils.cpp @@ -963,7 +963,7 @@ namespace GuiUtils { { if (!decoded && !decoding && !encoded_ws.empty()) { decoding = true; - GW::GameThread::Enqueue([&]() { + GW::GameThread::Enqueue([&] { GW::UI::AsyncDecodeStr(encoded_ws.c_str(), OnStringDecoded, this, language_id); }); diff --git a/GWToolboxdll/Widgets/BondsWidget.cpp b/GWToolboxdll/Widgets/BondsWidget.cpp index 5f194147c..5a96d3691 100644 --- a/GWToolboxdll/Widgets/BondsWidget.cpp +++ b/GWToolboxdll/Widgets/BondsWidget.cpp @@ -128,7 +128,7 @@ namespace { } // capture by value! - GW::GameThread::Enqueue([slot, targetId]() -> void { + GW::GameThread::Enqueue([slot, targetId] { GW::SkillbarMgr::UseSkill(slot, targetId); }); } @@ -235,7 +235,7 @@ bool BondsWidget::UseBuff(GW::AgentID targetId, GW::Constants::SkillID skill_id) } // capture by value! - GW::GameThread::Enqueue([slot, targetId]() -> void { + GW::GameThread::Enqueue([slot, targetId] { GW::SkillbarMgr::UseSkill(slot, targetId); }); return true; @@ -251,7 +251,7 @@ bool BondsWidget::DropBuffs(GW::AgentID targetId, GW::Constants::SkillID skill_i if (!(targetId == (GW::AgentID)0 || buff.target_agent_id == targetId)) continue; const auto buff_id = buff.buff_id; - GW::GameThread::Enqueue([buff_id]() -> void { + GW::GameThread::Enqueue([buff_id] { GW::Effects::DropBuff(buff_id); }); } diff --git a/GWToolboxdll/Widgets/SkillMonitorWidget.cpp b/GWToolboxdll/Widgets/SkillMonitorWidget.cpp index bbf8a8620..7dfc8b092 100644 --- a/GWToolboxdll/Widgets/SkillMonitorWidget.cpp +++ b/GWToolboxdll/Widgets/SkillMonitorWidget.cpp @@ -315,7 +315,7 @@ void SkillMonitorWidget::Draw(IDirect3DDevice9*) ImGui::PushStyleColor(ImGuiCol_WindowBg, ImColor(background).Value); const float uiscale_multiply = GuiUtils::GetGWScaleMultiplier(); - const auto calculate_window_position = [uiscale_multiply]() -> auto { + const auto calculate_window_position = [uiscale_multiply] { // NB: Use case to define GW::Vec4f ? GW::Vec2f x = party_window_position->xAxis(); GW::Vec2f y = party_window_position->yAxis(); diff --git a/GWToolboxdll/Windows/Hotkeys.cpp b/GWToolboxdll/Windows/Hotkeys.cpp index 2996155e9..3b54bd10a 100644 --- a/GWToolboxdll/Windows/Hotkeys.cpp +++ b/GWToolboxdll/Windows/Hotkeys.cpp @@ -1304,7 +1304,7 @@ void HotkeyDropUseBuff::Execute() if (islot >= 0) { uint32_t slot = static_cast(islot); if (GW::SkillbarMgr::GetPlayerSkillbar()->skills[slot].recharge == 0) { - GW::GameThread::Enqueue([slot]() -> void { + GW::GameThread::Enqueue([slot] { GW::SkillbarMgr::UseSkill(slot); }); } diff --git a/GWToolboxdll/Windows/ObjectiveTimerWindow.cpp b/GWToolboxdll/Windows/ObjectiveTimerWindow.cpp index db078939b..4903a2a00 100644 --- a/GWToolboxdll/Windows/ObjectiveTimerWindow.cpp +++ b/GWToolboxdll/Windows/ObjectiveTimerWindow.cpp @@ -554,7 +554,7 @@ void ObjectiveTimerWindow::AddDoAObjectiveSet(const GW::Vec2f spawn) { constexpr int n_areas = 4; - const auto starting_area = [&]() -> int { + const auto starting_area = [&] { constexpr GW::Vec2f mallyx_spawn(-3931, -6214); constexpr GW::Vec2f area_spawns[] = { {-10514, 15231}, // foundry diff --git a/GWToolboxdll/Windows/ObserverExportWindow.cpp b/GWToolboxdll/Windows/ObserverExportWindow.cpp index 8fe3663aa..6c6879ef7 100644 --- a/GWToolboxdll/Windows/ObserverExportWindow.cpp +++ b/GWToolboxdll/Windows/ObserverExportWindow.cpp @@ -46,7 +46,7 @@ nlohmann::json ObserverExportWindow::ToJSON_V_0_1() json["parties"].push_back(nlohmann::json::value_t::null); continue; } - json["parties"].push_back([&]() -> nlohmann::json { + json["parties"].push_back([&] { // parties -> party nlohmann::json json_party; json_party["party_id"] = party->party_id; @@ -58,7 +58,7 @@ nlohmann::json ObserverExportWindow::ToJSON_V_0_1() json_party["members"].push_back(nlohmann::json::value_t::null); continue; } - json_party["members"].push_back([&]() -> nlohmann::json { + json_party["members"].push_back([&] { // parties -> party -> agents -> agent nlohmann::json json_agent; json_agent["display_name"] = agent->DisplayName(); diff --git a/GWToolboxdll/Windows/PacketLoggerWindow.cpp b/GWToolboxdll/Windows/PacketLoggerWindow.cpp index 1f4ce341c..e801b0cba 100644 --- a/GWToolboxdll/Windows/PacketLoggerWindow.cpp +++ b/GWToolboxdll/Windows/PacketLoggerWindow.cpp @@ -826,7 +826,7 @@ void PacketLoggerWindow::Draw(IDirect3DDevice9*) void PacketLoggerWindow::Initialize() { ToolboxWindow::Initialize(); - GW::GameThread::Enqueue([]() { + GW::GameThread::Enqueue([] { InitStoC(); }); if (logger_enabled) { diff --git a/GWToolboxdll/Windows/PathfindingWindow.cpp b/GWToolboxdll/Windows/PathfindingWindow.cpp index 213d64749..94d4a1501 100644 --- a/GWToolboxdll/Windows/PathfindingWindow.cpp +++ b/GWToolboxdll/Windows/PathfindingWindow.cpp @@ -81,7 +81,7 @@ namespace { return; delete astar; astar = nullptr; - Resources::EnqueueWorkerTask([from_cpy = from, to_cpy = to ]() { + Resources::EnqueueWorkerTask([from_cpy = from, to_cpy = to] { auto tmpAstar = new Pathing::AStar(GetMilepathForCurrentMap()); const auto res = tmpAstar->search(from_cpy, to_cpy); if (res != Pathing::Error::OK) { @@ -254,7 +254,7 @@ bool PathfindingWindow::CalculatePath(const GW::GamePos& from, const GW::GamePos pending_worker_task = true; - Resources::EnqueueWorkerTask([from_cpy, to_cpy, callback, args ]() { + Resources::EnqueueWorkerTask([from_cpy, to_cpy, callback, args ] { Pathing::MilePath* milepath = nullptr; Pathing::AStar* tmpAstar = nullptr; Pathing::Error res = Pathing::Error::OK; @@ -285,7 +285,7 @@ bool PathfindingWindow::CalculatePath(const GW::GamePos& from, const GW::GamePos delete tmpAstar; delete from_cpy; delete to_cpy; - Resources::EnqueueMainTask([waypoints, callback, args]() { + Resources::EnqueueMainTask([waypoints, callback, args] { callback(*waypoints,args); delete waypoints; diff --git a/GWToolboxdll/Windows/Pathing.cpp b/GWToolboxdll/Windows/Pathing.cpp index 17a3a837d..39f30d5bb 100644 --- a/GWToolboxdll/Windows/Pathing.cpp +++ b/GWToolboxdll/Windows/Pathing.cpp @@ -23,8 +23,8 @@ namespace { std::mutex mutex; auto res_pt = &res; // Enqueue - GW::GameThread::Enqueue([&block_pt, res_pt, &mutex]() { - const std::lock_guard lock(mutex); + GW::GameThread::Enqueue([&block_pt, res_pt, &mutex] { + const std::lock_guard lock(mutex); GW::MapContext* mapContext = GW::GetMapContext(); if (!mapContext) { *res_pt = Pathing::Error::InvalidMapContext; @@ -37,7 +37,7 @@ namespace { }); // Wait do { - const std::lock_guard lock(mutex); + const std::lock_guard lock(mutex); if (res != Pathing::Error::Unknown) break; } while (true); @@ -214,7 +214,7 @@ namespace Pathing { LoadMapSpecificData(); GenerateAABBs(); GenerateAABBGraph(); //not threaded because it relies on gw client Query altitude. - worker_thread = new std::thread([&]() { + worker_thread = new std::thread([&] { GeneratePoints(); GenerateVisibilityGraph(); GenerateTeleportGraph();