From 3d335231a27086c0713f5b5a1636d9bb099145e1 Mon Sep 17 00:00:00 2001 From: NovaRain Date: Fri, 10 Jan 2020 21:33:32 +0800 Subject: [PATCH] Replaced with --- sfall/AI.cpp | 8 ++++---- sfall/Arrays.cpp | 6 +++--- sfall/ScriptExtender.cpp | 22 +++++++++++----------- sfall/TalkingHeads.cpp | 8 ++++---- sfall/stdafx.h | 1 - 5 files changed, 22 insertions(+), 23 deletions(-) diff --git a/sfall/AI.cpp b/sfall/AI.cpp index 440dc07f..eba82228 100644 --- a/sfall/AI.cpp +++ b/sfall/AI.cpp @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -#include +#include #include "main.h" @@ -24,10 +24,10 @@ #include "FalloutEngine.h" #include "SafeWrite.h" -typedef stdext::hash_map::const_iterator iter; +typedef std::tr1::unordered_map::const_iterator iter; -static stdext::hash_map targets; -static stdext::hash_map sources; +static std::tr1::unordered_map targets; +static std::tr1::unordered_map sources; static void __declspec(naked) ai_try_attack_hook_FleeFix() { __asm { diff --git a/sfall/Arrays.cpp b/sfall/Arrays.cpp index 661e7a6e..64e29234 100644 --- a/sfall/Arrays.cpp +++ b/sfall/Arrays.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include "Arrays.h" @@ -13,7 +13,7 @@ DWORD arraysBehavior = 1; // 0 - backward compatible with pre-3.4, 1 - permanent // arrays map: arrayId => arrayVar ArraysMap arrays; // temp arrays: set of arrayId -std::set temporaryArrays; +std::tr1::unordered_set temporaryArrays; // saved arrays: arrayKey => arrayId ArrayKeysMap savedArrays; @@ -454,7 +454,7 @@ void _stdcall FreeArray(DWORD id) { void DeleteAllTempArrays() { if (!temporaryArrays.empty()) { - for (std::set::iterator it = temporaryArrays.begin(); it != temporaryArrays.end(); ++it) { + for (std::tr1::unordered_set::iterator it = temporaryArrays.begin(); it != temporaryArrays.end(); ++it) { FreeArray(*it); } temporaryArrays.clear(); diff --git a/sfall/ScriptExtender.cpp b/sfall/ScriptExtender.cpp index f937cf4e..37270c05 100644 --- a/sfall/ScriptExtender.cpp +++ b/sfall/ScriptExtender.cpp @@ -16,8 +16,8 @@ * along with this program. If not, see . */ -#include -//#include +//#include +#include #include "main.h" #include "FalloutEngine.h" @@ -471,8 +471,8 @@ struct sGlobalScript { }; struct sExportedVar { - DWORD type; // in scripting engine terms, eg. VAR_TYPE_* - DWORD val; + int type; // in scripting engine terms, eg. VAR_TYPE_* + int val; sExportedVar() : val(0), type(VAR_TYPE_INT) {} }; @@ -502,19 +502,19 @@ static std::vector checkedScripts; static std::vector globalScripts; // a map of all sfall programs (global and hook scripts) by thier scriptPtr -typedef stdext::hash_map SfallProgsMap; +typedef std::tr1::unordered_map SfallProgsMap; static SfallProgsMap sfallProgsMap; // a map scriptPtr => self_obj to override self_obj for all script types using set_self -stdext::hash_map selfOverrideMap; +std::tr1::unordered_map selfOverrideMap; typedef std::tr1::unordered_map ExportedVarsMap; static ExportedVarsMap globalExportedVars; DWORD isGlobalScriptLoading = 0; -stdext::hash_map<__int64, int> globalVars; -typedef stdext::hash_map<__int64, int> :: iterator glob_itr; -typedef stdext::hash_map<__int64, int> :: const_iterator glob_citr; +std::tr1::unordered_map<__int64, int> globalVars; +typedef std::tr1::unordered_map<__int64, int> :: iterator glob_itr; +typedef std::tr1::unordered_map<__int64, int> :: const_iterator glob_citr; typedef std::pair<__int64, int> glob_pair; static void* opcodes[0x300]; @@ -800,7 +800,7 @@ static void __declspec(naked) InitHook() { } static void __fastcall SetSelfObject(DWORD script, TGameObj* obj) { - stdext::hash_map::iterator it = selfOverrideMap.find(script); + std::tr1::unordered_map::iterator it = selfOverrideMap.find(script); bool isFind = (it != selfOverrideMap.end()); if (obj) { if (isFind) { @@ -931,7 +931,7 @@ long __stdcall GetResetScriptReturnValue() { } static DWORD __stdcall FindSid(DWORD script) { - stdext::hash_map::iterator overrideIt = selfOverrideMap.find(script); + std::tr1::unordered_map::iterator overrideIt = selfOverrideMap.find(script); if (overrideIt != selfOverrideMap.end()) { DWORD scriptId = overrideIt->second.object->scriptID; // script OverrideScriptStruct.script_id = scriptId; diff --git a/sfall/TalkingHeads.cpp b/sfall/TalkingHeads.cpp index bb85ab9d..499234e9 100644 --- a/sfall/TalkingHeads.cpp +++ b/sfall/TalkingHeads.cpp @@ -17,7 +17,7 @@ */ #include -#include +#include #include "main.h" #include "FalloutEngine.h" @@ -66,10 +66,10 @@ struct TextureData { : textures(tex), showHighlights(show), bakedBackground(baked), frames(frames) {} }; -typedef stdext::hash_map<__int64, TextureData> :: iterator tex_itr; -typedef stdext::hash_map<__int64, TextureData> :: const_iterator tex_citr; +typedef std::tr1::unordered_map<__int64, TextureData> :: iterator tex_itr; +typedef std::tr1::unordered_map<__int64, TextureData> :: const_iterator tex_citr; -static stdext::hash_map<__int64, TextureData> texMap; +static std::tr1::unordered_map<__int64, TextureData> texMap; static const char* headSuffix[] = { "gv", "gf", "gn", "ng", "nf", "nb", "bn", "bf", "bv", "gp", "np", "bp" }; diff --git a/sfall/stdafx.h b/sfall/stdafx.h index b4912424..49fbd55f 100644 --- a/sfall/stdafx.h +++ b/sfall/stdafx.h @@ -2,7 +2,6 @@ #include #include -#include #include #include #include