[General] Use unordered_map where it makes sense

This commit is contained in:
momo5502 2016-12-18 13:24:04 +01:00
parent 5ef1c17e56
commit 241915d37b
20 changed files with 30 additions and 29 deletions

View File

@ -409,7 +409,7 @@ namespace Components
AssetHandler::~AssetHandler()
{
ClearTemporaryAssets();
AssetHandler::ClearTemporaryAssets();
for (auto i = AssetHandler::AssetInterfaces.begin(); i != AssetHandler::AssetInterfaces.end(); ++i)
{

View File

@ -3,8 +3,8 @@
namespace Components
{
Utils::Memory::Allocator Command::MemAllocator;
std::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::FunctionMap;
std::unordered_map<std::string, wink::slot<Command::Callback>> Command::FunctionMapSV;
std::string Command::Params::join(size_t startIndex)
{

View File

@ -64,8 +64,8 @@ namespace Components
private:
static Utils::Memory::Allocator MemAllocator;
static std::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>> FunctionMap;
static std::unordered_map<std::string, wink::slot<Callback>> FunctionMapSV;
static void MainCallback();
static void MainCallbackSV();

View File

@ -5,8 +5,8 @@ namespace Components
std::mutex Localization::LocalizeMutex;
Dvar::Var Localization::UseLocalization;
Utils::Memory::Allocator Localization::MemAllocator;
std::map<std::string, Game::LocalizedEntry*> Localization::LocalizeMap;
std::map<std::string, Game::LocalizedEntry*> Localization::TempLocalizeMap;
std::unordered_map<std::string, Game::LocalizedEntry*> Localization::LocalizeMap;
std::unordered_map<std::string, Game::LocalizedEntry*> Localization::TempLocalizeMap;
void Localization::Set(std::string key, std::string value)
{

View File

@ -19,8 +19,8 @@ namespace Components
private:
static std::mutex LocalizeMutex;
static Utils::Memory::Allocator MemAllocator;
static std::map<std::string, Game::LocalizedEntry*> LocalizeMap;
static std::map<std::string, Game::LocalizedEntry*> TempLocalizeMap;
static std::unordered_map<std::string, Game::LocalizedEntry*> LocalizeMap;
static std::unordered_map<std::string, Game::LocalizedEntry*> TempLocalizeMap;
static Dvar::Var UseLocalization;
static void __stdcall SetStringStub(const char* key, const char* value, bool isEnglish);

View File

@ -3,8 +3,8 @@
namespace Components
{
std::vector<std::string> Menus::CustomMenus;
std::map<std::string, Game::menuDef_t*> Menus::MenuList;
std::map<std::string, Game::MenuList*> Menus::MenuListList;
std::unordered_map<std::string, Game::menuDef_t*> Menus::MenuList;
std::unordered_map<std::string, Game::MenuList*> Menus::MenuListList;
int Menus::ReserveSourceHandle()
{

View File

@ -18,8 +18,8 @@ namespace Components
static void Add(std::string menu);
private:
static std::map<std::string, Game::menuDef_t*> MenuList;
static std::map<std::string, Game::MenuList*> MenuListList;
static std::unordered_map<std::string, Game::menuDef_t*> MenuList;
static std::unordered_map<std::string, Game::MenuList*> MenuListList;
static std::vector<std::string> CustomMenus;
static Game::XAssetHeader MenuLoad(Game::XAssetType type, std::string filename);

View File

@ -2,8 +2,8 @@
namespace Components
{
std::map<void*, IUnknown*> ModelSurfs::BufferMap;
std::map<std::string, Game::CModelAllocData*> ModelSurfs::AllocMap;
std::unordered_map<void*, IUnknown*> ModelSurfs::BufferMap;
std::unordered_map<std::string, Game::CModelAllocData*> ModelSurfs::AllocMap;
IUnknown* ModelSurfs::GetBuffer(void* buffer)
{

View File

@ -11,8 +11,8 @@ namespace Components
#endif
private:
static std::map<void*, IUnknown*> BufferMap;
static std::map<std::string, Game::CModelAllocData*> AllocMap;
static std::unordered_map<void*, IUnknown*> BufferMap;
static std::unordered_map<std::string, Game::CModelAllocData*> AllocMap;
static void ReleaseModelSurf(Game::XAssetHeader header);

View File

@ -2,7 +2,7 @@
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)
{

View File

@ -13,7 +13,7 @@ namespace Components
static void Replace(std::string sound, const char* file);
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);
};
}

View File

@ -4,7 +4,7 @@ namespace Components
{
std::string Playlist::CurrentPlaylistBuffer;
std::string Playlist::ReceivedPlaylistBuffer;
std::map<const void*, std::string> Playlist::MapRelocation;
std::unordered_map<const void*, std::string> Playlist::MapRelocation;
void Playlist::LoadPlaylist()
{

View File

@ -18,7 +18,7 @@ namespace Components
private:
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);

View File

@ -3,7 +3,7 @@
namespace Components
{
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)
{

View File

@ -12,7 +12,7 @@ namespace Components
private:
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 Game::StringTable* LoadObject(std::string filename);

View File

@ -3,7 +3,7 @@
namespace Components
{
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)
{

View File

@ -49,7 +49,7 @@ namespace Components
static void HandleKeyStub();
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);
};

View File

@ -2,8 +2,8 @@
namespace Components
{
std::map<std::string, wink::slot<UIScript::Callback>> UIScript::UIScripts;
std::map<int, wink::slot<UIScript::CallbackRaw>> UIScript::UIOwnerDraws;
std::unordered_map<std::string, wink::slot<UIScript::Callback>> UIScript::UIScripts;
std::unordered_map<int, wink::slot<UIScript::CallbackRaw>> UIScript::UIOwnerDraws;
template<> int UIScript::Token::get()
{

View File

@ -39,7 +39,7 @@ namespace Components
static bool RunMenuScript(const char* name, const char** args);
static void RunMenuScriptStub();
static std::map<std::string, wink::slot<Callback>> UIScripts;
static std::map<int, wink::slot<CallbackRaw>> UIOwnerDraws;
static std::unordered_map<std::string, wink::slot<Callback>> UIScripts;
static std::unordered_map<int, wink::slot<CallbackRaw>> UIOwnerDraws;
};
}

View File

@ -38,6 +38,7 @@
//#include <chrono>
#include <future>
#include <queue>
#include <unordered_map>
// Experimental C++17 features
#include <filesystem>