sourcehook/sourcehook.h
changeset 101 7d93aa4d2bf3
parent 99 bfbb04d6683f
child 111 aec58c99dafc
     1.1 --- a/sourcehook/sourcehook.h	Tue Sep 13 16:47:42 2005 +0000
     1.2 +++ b/sourcehook/sourcehook.h	Tue Sep 13 16:47:42 2005 +0000
     1.3 @@ -70,7 +70,7 @@
     1.4  #include "sh_memory.h"
     1.5  #include "sh_list.h"
     1.6  #include "sh_vector.h"
     1.7 -#include <map>
     1.8 +#include "sh_tinyhash.h"
     1.9  
    1.10  // Good old metamod!
    1.11  
    1.12 @@ -219,7 +219,7 @@
    1.13  	};
    1.14  
    1.15  	typedef SourceHook::CVector<void*> OrigFuncs;
    1.16 -	typedef std::map<int, OrigFuncs> OrigVTables;
    1.17 +	typedef SourceHook::THash<int, OrigFuncs> OrigVTables;
    1.18  
    1.19  	template<class B> struct CallClass
    1.20  	{
    1.21 @@ -1497,8 +1497,8 @@
    1.22  	using namespace ::SourceHook; \
    1.23  	MemFuncInfo mfi; \
    1.24  	GetFuncInfo(m_CC->ptr, m_MFP, mfi); \
    1.25 -	OrigVTables::const_iterator iter = m_CC->vt.find(mfi.thisptroffs + mfi.vtbloffs); \
    1.26 -	if (iter == m_CC->vt.end() || mfi.vtblindex >= (int)iter->second.size() || iter->second[mfi.vtblindex] == NULL) \
    1.27 +	OrigVTables::iterator iter = m_CC->vt.find(mfi.thisptroffs + mfi.vtbloffs); \
    1.28 +	if (iter == m_CC->vt.end() || mfi.vtblindex >= (int)iter->val.size() || iter->val[mfi.vtblindex] == NULL) \
    1.29  		return (m_CC->ptr->*m_MFP)call; \
    1.30  	\
    1.31  	/* It's hooked. Call the original function. */ \
    1.32 @@ -1507,7 +1507,7 @@
    1.33  		RetType(EmptyClass::*mfpnew)prms; \
    1.34  		void *addr; \
    1.35  	} u; \
    1.36 -	u.addr = iter->second[mfi.vtblindex]; \
    1.37 +	u.addr = iter->val[mfi.vtblindex]; \
    1.38  	\
    1.39  	void *adjustedthisptr = reinterpret_cast<void*>(reinterpret_cast<char*>(m_CC->ptr) + mfi.thisptroffs); \
    1.40  	return (reinterpret_cast<EmptyClass*>(adjustedthisptr)->*u.mfpnew)call; \
    1.41 @@ -1520,8 +1520,8 @@
    1.42  	using namespace ::SourceHook; \
    1.43  	MemFuncInfo mfi; \
    1.44  	GetFuncInfo(m_CC->ptr, m_MFP, mfi); \
    1.45 -	OrigVTables::const_iterator iter = m_CC->vt.find(mfi.thisptroffs + mfi.vtbloffs); \
    1.46 -	if (iter == m_CC->vt.end() || mfi.vtblindex >= (int)iter->second.size() || iter->second[mfi.vtblindex] == NULL) \
    1.47 +	OrigVTables::iterator iter = m_CC->vt.find(mfi.thisptroffs + mfi.vtbloffs); \
    1.48 +	if (iter == m_CC->vt.end() || mfi.vtblindex >= (int)iter->val.size() || iter->val[mfi.vtblindex] == NULL) \
    1.49  		return (m_CC->ptr->*m_MFP)call; \
    1.50  	\
    1.51  	/* It's hooked. Call the original function. */ \
    1.52 @@ -1534,7 +1534,7 @@
    1.53  			intptr_t adjustor; \
    1.54  		} s; \
    1.55  	} u; \
    1.56 -	u.s.addr = iter->second[mfi.vtblindex]; \
    1.57 +	u.s.addr = iter->val[mfi.vtblindex]; \
    1.58  	u.s.adjustor = mfi.thisptroffs; \
    1.59  	\
    1.60  	return (reinterpret_cast<EmptyClass*>(m_CC->ptr)->*u.mfpnew)call; \