From 42541795203c99bcc4c5d6a05e19a4167f291529 Mon Sep 17 00:00:00 2001 From: /dev/root Date: Fri, 25 Nov 2016 14:16:07 +0100 Subject: [PATCH] [Cache] Refactored Cache::GetUrl - renamed GetUrl() to GetStaticUrl() --- src/Components/Modules/Maps.cpp | 16 ++++++++-------- src/Utils/Cache.cpp | 4 ++-- src/Utils/Cache.hpp | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Components/Modules/Maps.cpp b/src/Components/Modules/Maps.cpp index 3fefbf9e..c65ec2d7 100644 --- a/src/Components/Modules/Maps.cpp +++ b/src/Components/Modules/Maps.cpp @@ -492,14 +492,14 @@ namespace Components { Dvar::Register("isDlcInstalled_All", false, Game::DVAR_FLAG_USERCREATED | Game::DVAR_FLAG_WRITEPROTECTED, ""); - Maps::AddDlc({ 1, Utils::Cache::GetUrl("/dlc/IW4.DLC.1.Stimulus.Package.zip"), { "mp_complex", "mp_compact", "mp_storm", "mp_overgrown", "mp_crash" } }); - Maps::AddDlc({ 2, Utils::Cache::GetUrl("/dlc/IW4.DLC.2.Resurgence.Pack.zip"), { "mp_abandon", "mp_vacant", "mp_trailerpark", "mp_strike", "mp_fuel2" } }); - Maps::AddDlc({ 3, Utils::Cache::GetUrl("/dlc/IW4.DLC.3.Nuketown.zip"), { "mp_nuked" } }); - Maps::AddDlc({ 4, Utils::Cache::GetUrl("/dlc/IW4.DLC.4.Classics.1.zip"), { "mp_cross_fire", "mp_cargoship", "mp_bloc" } }); - Maps::AddDlc({ 5, Utils::Cache::GetUrl("/dlc/IW4.DLC.5.Classics.2.zip"), { "mp_killhouse", "mp_bog_sh" } }); - Maps::AddDlc({ 6, Utils::Cache::GetUrl("/dlc/IW4.DLC.6.Cargoship.Winter.zip"), { "mp_cargoship_sh" } }); - Maps::AddDlc({ 7, Utils::Cache::GetUrl("/dlc/IW4.DLC.7.Resurrection.Pack.zip"), { "mp_shipment_long", "mp_rust_long", "mp_firingrange" } }); - Maps::AddDlc({ 8, ""/*Utils::Cache::GetUrl("/dlc/")*/,{ /*"mp_bloc_sh", "mp_crash_tropical", "mp_estate_tropical", "mp_fav_tropical", "mp_storm_spring"*/ } }); + Maps::AddDlc({ 1, Utils::Cache::GetStaticUrl("/dlc/IW4.DLC.1.Stimulus.Package.zip"), { "mp_complex", "mp_compact", "mp_storm", "mp_overgrown", "mp_crash" } }); + Maps::AddDlc({ 2, Utils::Cache::GetStaticUrl("/dlc/IW4.DLC.2.Resurgence.Pack.zip"), { "mp_abandon", "mp_vacant", "mp_trailerpark", "mp_strike", "mp_fuel2" } }); + Maps::AddDlc({ 3, Utils::Cache::GetStaticUrl("/dlc/IW4.DLC.3.Nuketown.zip"), { "mp_nuked" } }); + Maps::AddDlc({ 4, Utils::Cache::GetStaticUrl("/dlc/IW4.DLC.4.Classics.1.zip"), { "mp_cross_fire", "mp_cargoship", "mp_bloc" } }); + Maps::AddDlc({ 5, Utils::Cache::GetStaticUrl("/dlc/IW4.DLC.5.Classics.2.zip"), { "mp_killhouse", "mp_bog_sh" } }); + Maps::AddDlc({ 6, Utils::Cache::GetStaticUrl("/dlc/IW4.DLC.6.Cargoship.Winter.zip"), { "mp_cargoship_sh" } }); + Maps::AddDlc({ 7, Utils::Cache::GetStaticUrl("/dlc/IW4.DLC.7.Resurrection.Pack.zip"), { "mp_shipment_long", "mp_rust_long", "mp_firingrange" } }); + Maps::AddDlc({ 8, ""/*Utils::Cache::GetStaticUrl("/dlc/")*/,{ /*"mp_bloc_sh", "mp_crash_tropical", "mp_estate_tropical", "mp_fav_tropical", "mp_storm_spring"*/ } }); Maps::UpdateDlcStatus(); diff --git a/src/Utils/Cache.cpp b/src/Utils/Cache.cpp index 717efe48..ba23474a 100644 --- a/src/Utils/Cache.cpp +++ b/src/Utils/Cache.cpp @@ -12,9 +12,9 @@ namespace Utils std::string Cache::ValidUrl; std::mutex Cache::CacheMutex; - std::string Cache::GetUrl(std::string path) + std::string Cache::GetStaticUrl(std::string path) { - return Cache::Urls[ARRAY_SIZE(Cache::Urls) - 1] + path; + return Cache::Urls[0] + path; } std::string Cache::GetUrl(std::string url, std::string path) diff --git a/src/Utils/Cache.hpp b/src/Utils/Cache.hpp index 0d97fe3e..320a9c30 100644 --- a/src/Utils/Cache.hpp +++ b/src/Utils/Cache.hpp @@ -3,7 +3,7 @@ namespace Utils class Cache { public: - static std::string GetUrl(std::string path); + static std::string GetStaticUrl(std::string path); static std::string GetFile(std::string path, int timeout = 5000, std::string useragent = "IW4x"); private: