[General] Use unordered_map where it makes sense
This commit is contained in:
parent
5ef1c17e56
commit
241915d37b
@ -409,7 +409,7 @@ namespace Components
|
|||||||
|
|
||||||
AssetHandler::~AssetHandler()
|
AssetHandler::~AssetHandler()
|
||||||
{
|
{
|
||||||
ClearTemporaryAssets();
|
AssetHandler::ClearTemporaryAssets();
|
||||||
|
|
||||||
for (auto i = AssetHandler::AssetInterfaces.begin(); i != AssetHandler::AssetInterfaces.end(); ++i)
|
for (auto i = AssetHandler::AssetInterfaces.begin(); i != AssetHandler::AssetInterfaces.end(); ++i)
|
||||||
{
|
{
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
Utils::Memory::Allocator Command::MemAllocator;
|
Utils::Memory::Allocator Command::MemAllocator;
|
||||||
std::map<std::string, wink::slot<Command::Callback>> Command::FunctionMap;
|
std::unordered_map<std::string, wink::slot<Command::Callback>> Command::FunctionMap;
|
||||||
std::map<std::string, wink::slot<Command::Callback>> Command::FunctionMapSV;
|
std::unordered_map<std::string, wink::slot<Command::Callback>> Command::FunctionMapSV;
|
||||||
|
|
||||||
std::string Command::Params::join(size_t startIndex)
|
std::string Command::Params::join(size_t startIndex)
|
||||||
{
|
{
|
||||||
|
@ -64,8 +64,8 @@ namespace Components
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static Utils::Memory::Allocator MemAllocator;
|
static Utils::Memory::Allocator MemAllocator;
|
||||||
static std::map<std::string, wink::slot<Callback>> FunctionMap;
|
static std::unordered_map<std::string, wink::slot<Callback>> FunctionMap;
|
||||||
static std::map<std::string, wink::slot<Callback>> FunctionMapSV;
|
static std::unordered_map<std::string, wink::slot<Callback>> FunctionMapSV;
|
||||||
|
|
||||||
static void MainCallback();
|
static void MainCallback();
|
||||||
static void MainCallbackSV();
|
static void MainCallbackSV();
|
||||||
|
@ -5,8 +5,8 @@ namespace Components
|
|||||||
std::mutex Localization::LocalizeMutex;
|
std::mutex Localization::LocalizeMutex;
|
||||||
Dvar::Var Localization::UseLocalization;
|
Dvar::Var Localization::UseLocalization;
|
||||||
Utils::Memory::Allocator Localization::MemAllocator;
|
Utils::Memory::Allocator Localization::MemAllocator;
|
||||||
std::map<std::string, Game::LocalizedEntry*> Localization::LocalizeMap;
|
std::unordered_map<std::string, Game::LocalizedEntry*> Localization::LocalizeMap;
|
||||||
std::map<std::string, Game::LocalizedEntry*> Localization::TempLocalizeMap;
|
std::unordered_map<std::string, Game::LocalizedEntry*> Localization::TempLocalizeMap;
|
||||||
|
|
||||||
void Localization::Set(std::string key, std::string value)
|
void Localization::Set(std::string key, std::string value)
|
||||||
{
|
{
|
||||||
|
@ -19,8 +19,8 @@ namespace Components
|
|||||||
private:
|
private:
|
||||||
static std::mutex LocalizeMutex;
|
static std::mutex LocalizeMutex;
|
||||||
static Utils::Memory::Allocator MemAllocator;
|
static Utils::Memory::Allocator MemAllocator;
|
||||||
static std::map<std::string, Game::LocalizedEntry*> LocalizeMap;
|
static std::unordered_map<std::string, Game::LocalizedEntry*> LocalizeMap;
|
||||||
static std::map<std::string, Game::LocalizedEntry*> TempLocalizeMap;
|
static std::unordered_map<std::string, Game::LocalizedEntry*> TempLocalizeMap;
|
||||||
static Dvar::Var UseLocalization;
|
static Dvar::Var UseLocalization;
|
||||||
|
|
||||||
static void __stdcall SetStringStub(const char* key, const char* value, bool isEnglish);
|
static void __stdcall SetStringStub(const char* key, const char* value, bool isEnglish);
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
std::vector<std::string> Menus::CustomMenus;
|
std::vector<std::string> Menus::CustomMenus;
|
||||||
std::map<std::string, Game::menuDef_t*> Menus::MenuList;
|
std::unordered_map<std::string, Game::menuDef_t*> Menus::MenuList;
|
||||||
std::map<std::string, Game::MenuList*> Menus::MenuListList;
|
std::unordered_map<std::string, Game::MenuList*> Menus::MenuListList;
|
||||||
|
|
||||||
int Menus::ReserveSourceHandle()
|
int Menus::ReserveSourceHandle()
|
||||||
{
|
{
|
||||||
|
@ -18,8 +18,8 @@ namespace Components
|
|||||||
static void Add(std::string menu);
|
static void Add(std::string menu);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::map<std::string, Game::menuDef_t*> MenuList;
|
static std::unordered_map<std::string, Game::menuDef_t*> MenuList;
|
||||||
static std::map<std::string, Game::MenuList*> MenuListList;
|
static std::unordered_map<std::string, Game::MenuList*> MenuListList;
|
||||||
static std::vector<std::string> CustomMenus;
|
static std::vector<std::string> CustomMenus;
|
||||||
|
|
||||||
static Game::XAssetHeader MenuLoad(Game::XAssetType type, std::string filename);
|
static Game::XAssetHeader MenuLoad(Game::XAssetType type, std::string filename);
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
std::map<void*, IUnknown*> ModelSurfs::BufferMap;
|
std::unordered_map<void*, IUnknown*> ModelSurfs::BufferMap;
|
||||||
std::map<std::string, Game::CModelAllocData*> ModelSurfs::AllocMap;
|
std::unordered_map<std::string, Game::CModelAllocData*> ModelSurfs::AllocMap;
|
||||||
|
|
||||||
IUnknown* ModelSurfs::GetBuffer(void* buffer)
|
IUnknown* ModelSurfs::GetBuffer(void* buffer)
|
||||||
{
|
{
|
||||||
|
@ -11,8 +11,8 @@ namespace Components
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::map<void*, IUnknown*> BufferMap;
|
static std::unordered_map<void*, IUnknown*> BufferMap;
|
||||||
static std::map<std::string, Game::CModelAllocData*> AllocMap;
|
static std::unordered_map<std::string, Game::CModelAllocData*> AllocMap;
|
||||||
|
|
||||||
static void ReleaseModelSurf(Game::XAssetHeader header);
|
static void ReleaseModelSurf(Game::XAssetHeader header);
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
std::map<std::string, const char*> MusicalTalent::SoundAliasList;
|
std::unordered_map<std::string, const char*> MusicalTalent::SoundAliasList;
|
||||||
|
|
||||||
void MusicalTalent::Replace(std::string sound, const char* file)
|
void MusicalTalent::Replace(std::string sound, const char* file)
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ namespace Components
|
|||||||
static void Replace(std::string sound, const char* file);
|
static void Replace(std::string sound, const char* file);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static std::map<std::string, const char*> SoundAliasList;
|
static std::unordered_map<std::string, const char*> SoundAliasList;
|
||||||
static Game::XAssetHeader ModifyAliases(Game::XAssetType type, std::string filename);
|
static Game::XAssetHeader ModifyAliases(Game::XAssetType type, std::string filename);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ namespace Components
|
|||||||
{
|
{
|
||||||
std::string Playlist::CurrentPlaylistBuffer;
|
std::string Playlist::CurrentPlaylistBuffer;
|
||||||
std::string Playlist::ReceivedPlaylistBuffer;
|
std::string Playlist::ReceivedPlaylistBuffer;
|
||||||
std::map<const void*, std::string> Playlist::MapRelocation;
|
std::unordered_map<const void*, std::string> Playlist::MapRelocation;
|
||||||
|
|
||||||
void Playlist::LoadPlaylist()
|
void Playlist::LoadPlaylist()
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,7 @@ namespace Components
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static std::string CurrentPlaylistBuffer;
|
static std::string CurrentPlaylistBuffer;
|
||||||
static std::map<const void*, std::string> MapRelocation;
|
static std::unordered_map<const void*, std::string> MapRelocation;
|
||||||
|
|
||||||
static DWORD StorePlaylistStub(const char** buffer);
|
static DWORD StorePlaylistStub(const char** buffer);
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
Utils::Memory::Allocator StringTable::MemAllocator;
|
Utils::Memory::Allocator StringTable::MemAllocator;
|
||||||
std::map<std::string, Game::StringTable*> StringTable::StringTableMap;
|
std::unordered_map<std::string, Game::StringTable*> StringTable::StringTableMap;
|
||||||
|
|
||||||
int StringTable::Hash(const char* data)
|
int StringTable::Hash(const char* data)
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@ namespace Components
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static Utils::Memory::Allocator MemAllocator;
|
static Utils::Memory::Allocator MemAllocator;
|
||||||
static std::map<std::string, Game::StringTable*> StringTableMap;
|
static std::unordered_map<std::string, Game::StringTable*> StringTableMap;
|
||||||
|
|
||||||
static int Hash(const char* data);
|
static int Hash(const char* data);
|
||||||
static Game::StringTable* LoadObject(std::string filename);
|
static Game::StringTable* LoadObject(std::string filename);
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
UIFeeder::Container UIFeeder::Current;
|
UIFeeder::Container UIFeeder::Current;
|
||||||
std::map<float, UIFeeder::Callbacks> UIFeeder::Feeders;
|
std::unordered_map<float, UIFeeder::Callbacks> UIFeeder::Feeders;
|
||||||
|
|
||||||
void UIFeeder::Add(float feeder, UIFeeder::GetItemCount_t itemCountCb, UIFeeder::GetItemText_t itemTextCb, UIFeeder::Select_t selectCb)
|
void UIFeeder::Add(float feeder, UIFeeder::GetItemCount_t itemCountCb, UIFeeder::GetItemText_t itemTextCb, UIFeeder::Select_t selectCb)
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@ namespace Components
|
|||||||
static void HandleKeyStub();
|
static void HandleKeyStub();
|
||||||
static void PlaySoundStub();
|
static void PlaySoundStub();
|
||||||
|
|
||||||
static std::map<float, Callbacks> Feeders;
|
static std::unordered_map<float, Callbacks> Feeders;
|
||||||
|
|
||||||
static void ApplyMapFeeder(Game::dvar_t* dvar, int num);
|
static void ApplyMapFeeder(Game::dvar_t* dvar, int num);
|
||||||
};
|
};
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
namespace Components
|
namespace Components
|
||||||
{
|
{
|
||||||
std::map<std::string, wink::slot<UIScript::Callback>> UIScript::UIScripts;
|
std::unordered_map<std::string, wink::slot<UIScript::Callback>> UIScript::UIScripts;
|
||||||
std::map<int, wink::slot<UIScript::CallbackRaw>> UIScript::UIOwnerDraws;
|
std::unordered_map<int, wink::slot<UIScript::CallbackRaw>> UIScript::UIOwnerDraws;
|
||||||
|
|
||||||
template<> int UIScript::Token::get()
|
template<> int UIScript::Token::get()
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@ namespace Components
|
|||||||
static bool RunMenuScript(const char* name, const char** args);
|
static bool RunMenuScript(const char* name, const char** args);
|
||||||
static void RunMenuScriptStub();
|
static void RunMenuScriptStub();
|
||||||
|
|
||||||
static std::map<std::string, wink::slot<Callback>> UIScripts;
|
static std::unordered_map<std::string, wink::slot<Callback>> UIScripts;
|
||||||
static std::map<int, wink::slot<CallbackRaw>> UIOwnerDraws;
|
static std::unordered_map<int, wink::slot<CallbackRaw>> UIOwnerDraws;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
//#include <chrono>
|
//#include <chrono>
|
||||||
#include <future>
|
#include <future>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
// Experimental C++17 features
|
// Experimental C++17 features
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
Loading…
Reference in New Issue
Block a user