diff --git a/src/utils/mp_balancer/entry_point.cpp b/src/utils/mp_balancer/entry_point.cpp index bd05916cc7b..8d320cefd71 100644 --- a/src/utils/mp_balancer/entry_point.cpp +++ b/src/utils/mp_balancer/entry_point.cpp @@ -4,7 +4,8 @@ void main(int argc, char* argv[]) { - Core._initialize("mp_ballancer", NULL, TRUE, "fsgame4mpu.ltx"); + xrDebug::Initialize(false); + Core.Initialize("mp_ballancer", NULL, TRUE, "fsgame.ltx"); SetConsoleOutputCP(1251); diff --git a/src/utils/mp_balancer/mp_balancer.vcxproj b/src/utils/mp_balancer/mp_balancer.vcxproj index a01e8e74bc5..ea6d078cc77 100644 --- a/src/utils/mp_balancer/mp_balancer.vcxproj +++ b/src/utils/mp_balancer/mp_balancer.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -19,13 +19,13 @@ Application - v120 + v141 MultiByte true Application - v120 + v141 MultiByte @@ -39,66 +39,20 @@ - - - <_ProjectFileVersion>12.0.30501.0 - - - $(xrBinDir) - $(xrIntDir)$(ProjectName)\ - true - - - $(xrBinDir) - $(xrIntDir)$(ProjectName)\ - false - - Disabled - $(xrSdkDir)include;%(AdditionalIncludeDirectories) - WIN32;DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - true - EnableFastChecks - true - MultiThreadedDLL - true - Fast - Use pch.h - Level4 - EditAndContinue - $(xrSdkDir)libraries;$(xrLibDir);%(AdditionalLibraryDirectories) - true Console - MachineX86 - $(xrSdkDir)include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - MultiThreadedDLL - false - StreamingSIMDExtensions - Fast - Use pch.h - Level4 - ProgramDatabase - $(xrSdkDir)libraries;$(xrLibDir);%(AdditionalLibraryDirectories) - true Console - true - true - MachineX86 @@ -108,18 +62,8 @@ Create Create - - - - - - - - - - - - + + @@ -130,6 +74,14 @@ + + + {a0f7d1fb-59a7-4717-a7e4-96f37e91998e} + + + {c964d17a-05a8-4bfa-b0a8-7af5c6b627ec} + + diff --git a/src/utils/mp_balancer/pch.h b/src/utils/mp_balancer/pch.h index 492e1bf22f4..900d1326a06 100644 --- a/src/utils/mp_balancer/pch.h +++ b/src/utils/mp_balancer/pch.h @@ -1,16 +1,15 @@ #ifndef PCH_H_INCLUDED #define PCH_H_INCLUDED -#include "../../xrCore/xrCore.h" +#include "Common/Platform.hpp" +#include "Common/Common.hpp" +#include "Common/object_broker.h" +#include "xrCore/xrCore.h" +#include "xrCore/Containers/AssociativeVector.hpp" + #include "xr_ini_ex.h" -#include +#include #include -#include "iostreams_proxy.h" -#include "tools.hpp" -#include "../../xrServerEntities/object_broker.h" -#include "../../xrServerEntities/associative_vector.h" - -#include #endif // #define PCH_H_INCLUDED diff --git a/src/utils/mp_balancer/statistics_collector.cpp b/src/utils/mp_balancer/statistics_collector.cpp index 0efee966e5d..07d3229c885 100644 --- a/src/utils/mp_balancer/statistics_collector.cpp +++ b/src/utils/mp_balancer/statistics_collector.cpp @@ -1,5 +1,7 @@ +#include "pch.h" #include "statistics_collector.hpp" #include "wpn_collection.hpp" +#include "tools.hpp" statistics_collector::statistics_collector(weapon_collection* wpn_collection) { m_wpn_collection = wpn_collection; } statistics_collector::~statistics_collector() { delete_data(m_all_params); } @@ -14,7 +16,7 @@ void statistics_collector::load_settings() if (m_wpn_collection->settings->r_line(CSV_SETTINGS, i, &key, &value) && key) { csv_files::iterator new_file_iter = - m_all_params.insert(std::make_pair(shared_str(key), xr_new())).first; + m_all_params.insert(std::make_pair(shared_str(key), new params_collection())).first; if (value) { get_string_collection(value, *new_file_iter->second); @@ -25,8 +27,10 @@ void statistics_collector::load_settings() void statistics_collector::save_files() { - std::for_each(m_all_params.begin(), m_all_params.end(), - std::bind1st(std::mem_fun(&statistics_collector::save_file), this)); + //std::for_each(m_all_params.begin(), m_all_params.end(), + // std::bind1st(std::mem_fun(&statistics_collector::save_file), this)); + for (auto &it : m_all_params) + save_file(it); } statistics_collector::csv_files::const_iterator statistics_collector::get_most_acceptable_group( diff --git a/src/utils/mp_balancer/statistics_collector.hpp b/src/utils/mp_balancer/statistics_collector.hpp index 52c94d3cd75..1f8586d1226 100644 --- a/src/utils/mp_balancer/statistics_collector.hpp +++ b/src/utils/mp_balancer/statistics_collector.hpp @@ -1,8 +1,6 @@ #ifndef STATISTICS_COLLECTOR #define STATISTICS_COLLECTOR -#include "pch.h" - class weapon_collection; class statistics_collector @@ -10,7 +8,7 @@ class statistics_collector private: weapon_collection* m_wpn_collection; typedef xr_vector params_collection; - typedef associative_vector csv_files; + typedef AssociativeVector csv_files; csv_files m_all_params; void save_file(csv_files::value_type const& val); csv_files::const_iterator get_most_acceptable_group(shared_str const& section); diff --git a/src/utils/mp_balancer/wpn_collection.cpp b/src/utils/mp_balancer/wpn_collection.cpp index f01fce3fcaf..f068ca4c050 100644 --- a/src/utils/mp_balancer/wpn_collection.cpp +++ b/src/utils/mp_balancer/wpn_collection.cpp @@ -1,3 +1,4 @@ +#include "pch.h" #include "wpn_collection.hpp" weapon_collection::weapon_collection() {} @@ -21,10 +22,10 @@ void weapon_collection::load_all_mp_weapons() string_path path_ltx; FS.update_path(path_ltx, "$patch_config$", "system.ltx"); - patch_config = xr_new(path_ltx, TRUE, TRUE, FALSE); + patch_config = new CInifileEx(path_ltx, TRUE, TRUE, FALSE); FS.update_path(path_ltx, "$game_config$", "system.ltx"); - priquel_config = xr_new(path_ltx, TRUE, TRUE, FALSE); + priquel_config = new CInifileEx(path_ltx, TRUE, TRUE, FALSE); /*FS.update_path (path_ltx, "$game_config$", "mp\\weapons_mp\\weapons_mp_for_work.ltx"); work_mp_weapons = xr_new(path_ltx, TRUE, TRUE, FALSE); @@ -39,7 +40,7 @@ void weapon_collection::load_all_mp_weapons() work_mp_outfits = xr_new(path_ltx, TRUE, TRUE, FALSE);*/ FS.update_path(path_ltx, "$app_data_root$", "export_settings.ltx"); - settings = xr_new(path_ltx, TRUE, TRUE, FALSE); + settings = new CInifileEx(path_ltx, TRUE, TRUE, FALSE); load_settings(); /*new_mp_weapons = xr_new("new_weapons_mp.ltx", FALSE, FALSE, FALSE); @@ -89,7 +90,7 @@ void weapon_collection::load_settings() const char* larg = NULL; settings->r_line(EXPORT_SETTINGS_SECT, param, &line, &larg); R_ASSERT(line); - extract_list.push_back(xr_new()); + extract_list.push_back(new tentity_extract_keys()); extract_list.back()->first = line; new_config.insert(std::make_pair(shared_str(line), xr_vector())); if (larg) diff --git a/src/utils/mp_balancer/xr_ini_ex.cpp b/src/utils/mp_balancer/xr_ini_ex.cpp index 86658a1f421..f5b26277ad6 100644 --- a/src/utils/mp_balancer/xr_ini_ex.cpp +++ b/src/utils/mp_balancer/xr_ini_ex.cpp @@ -8,7 +8,7 @@ CInifileEx* pSettingsEx = NULL; CInifileEx* CInifileEx::Create(const char* szFileName, BOOL ReadOnly) { - return xr_new(szFileName, ReadOnly); + return new CInifileEx(szFileName, ReadOnly); } void CInifileEx::Destroy(CInifileEx* ini) { xr_delete(ini); } @@ -244,10 +244,10 @@ void CInifileEx::Load(IReader* F, LPCSTR path) // store previous section RootIt I = std::lower_bound(DATA.begin(), DATA.end(), *Current->Name, sect_pred); if ((I != DATA.end()) && ((*I)->Name == Current->Name)) - Debug.fatal(DEBUG_INFO, "Duplicate section '%s' found.", *Current->Name); + FATAL(make_string("Duplicate section '%s' found.", *Current->Name.c_str()).c_str()); DATA.insert(I, Current); } - Current = xr_new(); + Current = new Sect(); Current->Name = 0; // start new section R_ASSERT3(strchr(str, ']'), "Bad ini section found: ", str); @@ -343,7 +343,7 @@ void CInifileEx::Load(IReader* F, LPCSTR path) { RootIt I = std::lower_bound(DATA.begin(), DATA.end(), *Current->Name, sect_pred); if ((I != DATA.end()) && ((*I)->Name == Current->Name)) - Debug.fatal(DEBUG_INFO, "Duplicate section '%s' found.", *Current->Name); + FATAL(make_string("Duplicate section '%s' found.", *Current->Name.c_str()).c_str()); DATA.insert(I, Current); } } @@ -467,7 +467,7 @@ CInifileEx::Sect& CInifileEx::r_section(LPCSTR S) strlwr(section); RootIt I = std::lower_bound(DATA.begin(), DATA.end(), section, sect_pred); if (!(I != DATA.end() && xr_strcmp(*(*I)->Name, section) == 0)) - Debug.fatal(DEBUG_INFO, "Can't open section '%s'", S); + FATAL(make_string("Can't open section '%s'", S).c_str()); return **I; } @@ -478,7 +478,7 @@ LPCSTR CInifileEx::r_string(LPCSTR S, LPCSTR L) if (A != I.Data.end() && xr_strcmp(*A->first, L) == 0) return *A->second; else - Debug.fatal(DEBUG_INFO, "Can't find variable %s in [%s]", L, S); + FATAL(make_string("Can't find variable %s in [%s]", L, S).c_str()); return 0; } @@ -661,7 +661,7 @@ void CInifileEx::w_string(LPCSTR S, LPCSTR L, LPCSTR V, LPCSTR comment) if (!section_exist(sect)) { // create _new_ section - Sect* NEW = xr_new(); + Sect* NEW = new Sect(); NEW->Name = sect; RootIt I = std::lower_bound(DATA.begin(), DATA.end(), sect, sect_pred); DATA.insert(I, NEW);