Replaced <hash_map><set> with <unordered_map><unordered_set>

This commit is contained in:
NovaRain
2020-01-10 21:33:32 +08:00
parent d4eb1ee539
commit 3d335231a2
5 changed files with 22 additions and 23 deletions
+4 -4
View File
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <hash_map> #include <unordered_map>
#include "main.h" #include "main.h"
@@ -24,10 +24,10 @@
#include "FalloutEngine.h" #include "FalloutEngine.h"
#include "SafeWrite.h" #include "SafeWrite.h"
typedef stdext::hash_map<TGameObj*, TGameObj*>::const_iterator iter; typedef std::tr1::unordered_map<TGameObj*, TGameObj*>::const_iterator iter;
static stdext::hash_map<TGameObj*, TGameObj*> targets; static std::tr1::unordered_map<TGameObj*, TGameObj*> targets;
static stdext::hash_map<TGameObj*, TGameObj*> sources; static std::tr1::unordered_map<TGameObj*, TGameObj*> sources;
static void __declspec(naked) ai_try_attack_hook_FleeFix() { static void __declspec(naked) ai_try_attack_hook_FleeFix() {
__asm { __asm {
+3 -3
View File
@@ -1,4 +1,4 @@
#include <set> #include <unordered_set>
#include <algorithm> #include <algorithm>
#include "Arrays.h" #include "Arrays.h"
@@ -13,7 +13,7 @@ DWORD arraysBehavior = 1; // 0 - backward compatible with pre-3.4, 1 - permanent
// arrays map: arrayId => arrayVar // arrays map: arrayId => arrayVar
ArraysMap arrays; ArraysMap arrays;
// temp arrays: set of arrayId // temp arrays: set of arrayId
std::set<DWORD> temporaryArrays; std::tr1::unordered_set<DWORD> temporaryArrays;
// saved arrays: arrayKey => arrayId // saved arrays: arrayKey => arrayId
ArrayKeysMap savedArrays; ArrayKeysMap savedArrays;
@@ -454,7 +454,7 @@ void _stdcall FreeArray(DWORD id) {
void DeleteAllTempArrays() { void DeleteAllTempArrays() {
if (!temporaryArrays.empty()) { if (!temporaryArrays.empty()) {
for (std::set<DWORD>::iterator it = temporaryArrays.begin(); it != temporaryArrays.end(); ++it) { for (std::tr1::unordered_set<DWORD>::iterator it = temporaryArrays.begin(); it != temporaryArrays.end(); ++it) {
FreeArray(*it); FreeArray(*it);
} }
temporaryArrays.clear(); temporaryArrays.clear();
+11 -11
View File
@@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <hash_map> //#include <unordered_set>
//#include <set> #include <unordered_map>
#include "main.h" #include "main.h"
#include "FalloutEngine.h" #include "FalloutEngine.h"
@@ -471,8 +471,8 @@ struct sGlobalScript {
}; };
struct sExportedVar { struct sExportedVar {
DWORD type; // in scripting engine terms, eg. VAR_TYPE_* int type; // in scripting engine terms, eg. VAR_TYPE_*
DWORD val; int val;
sExportedVar() : val(0), type(VAR_TYPE_INT) {} sExportedVar() : val(0), type(VAR_TYPE_INT) {}
}; };
@@ -502,19 +502,19 @@ static std::vector<DWORD> checkedScripts;
static std::vector<sGlobalScript> globalScripts; static std::vector<sGlobalScript> globalScripts;
// a map of all sfall programs (global and hook scripts) by thier scriptPtr // a map of all sfall programs (global and hook scripts) by thier scriptPtr
typedef stdext::hash_map<DWORD, sScriptProgram> SfallProgsMap; typedef std::tr1::unordered_map<DWORD, sScriptProgram> SfallProgsMap;
static SfallProgsMap sfallProgsMap; static SfallProgsMap sfallProgsMap;
// a map scriptPtr => self_obj to override self_obj for all script types using set_self // a map scriptPtr => self_obj to override self_obj for all script types using set_self
stdext::hash_map<DWORD, SelfOverrideObj> selfOverrideMap; std::tr1::unordered_map<DWORD, SelfOverrideObj> selfOverrideMap;
typedef std::tr1::unordered_map<std::string, sExportedVar> ExportedVarsMap; typedef std::tr1::unordered_map<std::string, sExportedVar> ExportedVarsMap;
static ExportedVarsMap globalExportedVars; static ExportedVarsMap globalExportedVars;
DWORD isGlobalScriptLoading = 0; DWORD isGlobalScriptLoading = 0;
stdext::hash_map<__int64, int> globalVars; std::tr1::unordered_map<__int64, int> globalVars;
typedef stdext::hash_map<__int64, int> :: iterator glob_itr; typedef std::tr1::unordered_map<__int64, int> :: iterator glob_itr;
typedef stdext::hash_map<__int64, int> :: const_iterator glob_citr; typedef std::tr1::unordered_map<__int64, int> :: const_iterator glob_citr;
typedef std::pair<__int64, int> glob_pair; typedef std::pair<__int64, int> glob_pair;
static void* opcodes[0x300]; static void* opcodes[0x300];
@@ -800,7 +800,7 @@ static void __declspec(naked) InitHook() {
} }
static void __fastcall SetSelfObject(DWORD script, TGameObj* obj) { static void __fastcall SetSelfObject(DWORD script, TGameObj* obj) {
stdext::hash_map<DWORD, SelfOverrideObj>::iterator it = selfOverrideMap.find(script); std::tr1::unordered_map<DWORD, SelfOverrideObj>::iterator it = selfOverrideMap.find(script);
bool isFind = (it != selfOverrideMap.end()); bool isFind = (it != selfOverrideMap.end());
if (obj) { if (obj) {
if (isFind) { if (isFind) {
@@ -931,7 +931,7 @@ long __stdcall GetResetScriptReturnValue() {
} }
static DWORD __stdcall FindSid(DWORD script) { static DWORD __stdcall FindSid(DWORD script) {
stdext::hash_map<DWORD, SelfOverrideObj>::iterator overrideIt = selfOverrideMap.find(script); std::tr1::unordered_map<DWORD, SelfOverrideObj>::iterator overrideIt = selfOverrideMap.find(script);
if (overrideIt != selfOverrideMap.end()) { if (overrideIt != selfOverrideMap.end()) {
DWORD scriptId = overrideIt->second.object->scriptID; // script DWORD scriptId = overrideIt->second.object->scriptID; // script
OverrideScriptStruct.script_id = scriptId; OverrideScriptStruct.script_id = scriptId;
+4 -4
View File
@@ -17,7 +17,7 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <hash_map> #include <unordered_map>
#include "main.h" #include "main.h"
#include "FalloutEngine.h" #include "FalloutEngine.h"
@@ -66,10 +66,10 @@ struct TextureData {
: textures(tex), showHighlights(show), bakedBackground(baked), frames(frames) {} : textures(tex), showHighlights(show), bakedBackground(baked), frames(frames) {}
}; };
typedef stdext::hash_map<__int64, TextureData> :: iterator tex_itr; typedef std::tr1::unordered_map<__int64, TextureData> :: iterator tex_itr;
typedef stdext::hash_map<__int64, TextureData> :: const_iterator tex_citr; 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" }; static const char* headSuffix[] = { "gv", "gf", "gn", "ng", "nf", "nb", "bn", "bf", "bv", "gp", "np", "bp" };
-1
View File
@@ -2,7 +2,6 @@
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
#include <hash_map>
#include <vector> #include <vector>
#include <unordered_map> #include <unordered_map>
#include <string> #include <string>