1.1 --- a/sourcehook/sourcehook.h Sun Aug 07 03:26:58 2005 +0000
1.2 +++ b/sourcehook/sourcehook.h Fri Aug 12 17:33:31 2005 +0000
1.3 @@ -68,10 +68,9 @@
1.4 #include "FastDelegate.h"
1.5 #include "sh_memfuncinfo.h"
1.6 #include "sh_memory.h"
1.7 -#include <list>
1.8 +#include "smm_list.h"
1.9 #include <vector>
1.10 #include <map>
1.11 -#include <algorithm>
1.12
1.13 // Good old metamod!
1.14
1.15 @@ -185,8 +184,8 @@
1.16 int thisptr_offs; //!< This pointer offset
1.17 };
1.18 void *ptr; //!< Pointer to the interface instance
1.19 - std::list<Hook> hooks_pre; //!< A list of pre-hooks
1.20 - std::list<Hook> hooks_post; //!< A list of post-hooks
1.21 + List<Hook> hooks_pre; //!< A list of pre-hooks
1.22 + List<Hook> hooks_post; //!< A list of post-hooks
1.23 bool operator ==(void *other) const
1.24 {
1.25 return ptr == other;
1.26 @@ -196,7 +195,7 @@
1.27 void *vfnptr; //!< Pointer to the function
1.28 void *orig_entry; //!< The original vtable entry
1.29
1.30 - typedef std::list<Iface> IfaceList;
1.31 + typedef List<Iface> IfaceList;
1.32 typedef IfaceList::iterator IfaceListIter;
1.33 IfaceList ifaces; //!< List of interface pointers
1.34
1.35 @@ -214,7 +213,7 @@
1.36
1.37 void *hookfunc_vfnptr; //!< Pointer to the hookfunc impl
1.38
1.39 - typedef std::list<VfnPtr> VfnPtrList;
1.40 + typedef List<VfnPtr> VfnPtrList;
1.41 typedef VfnPtrList::iterator VfnPtrListIter;
1.42 VfnPtrList vfnptrs; //!< List of hooked interfaces
1.43 };
1.44 @@ -467,8 +466,7 @@
1.45 void *ourvfnptr = reinterpret_cast<void*>( \
1.46 *reinterpret_cast<void***>(reinterpret_cast<char*>(this) + ms_HI->vtbl_offs) + ms_HI->vtbl_idx); \
1.47 \
1.48 - HookManagerInfo::VfnPtrListIter vfptriter = std::find(ms_HI->vfnptrs.begin(), \
1.49 - ms_HI->vfnptrs.end(), ourvfnptr); \
1.50 + HookManagerInfo::VfnPtrListIter vfptriter = ms_HI->vfnptrs.find(ourvfnptr); \
1.51 if (vfptriter == ms_HI->vfnptrs.end()) \
1.52 { \
1.53 /* Bleh? Should be impossible! */ \
1.54 @@ -476,7 +474,7 @@
1.55 } \
1.56 HookManagerInfo::VfnPtr &vfnptr = *vfptriter; \
1.57 /* 2) Find the iface */ \
1.58 - HookManagerInfo::VfnPtr::IfaceListIter ifiter = std::find(vfnptr.ifaces.begin(), vfnptr.ifaces.end(), this); \
1.59 + HookManagerInfo::VfnPtr::IfaceListIter ifiter = vfnptr.ifaces.find(this); \
1.60 if (ifiter == vfnptr.ifaces.end()) \
1.61 { \
1.62 /* The iface info was not found. Redirect the call to the original function. */ \
1.63 @@ -486,8 +484,8 @@
1.64 } \
1.65 HookManagerInfo::VfnPtr::Iface &ci = *ifiter; \
1.66 /* 2) Declare some vars and set it up */ \
1.67 - std::list<HookManagerInfo::VfnPtr::Iface::Hook> &prelist = ci.hooks_pre; \
1.68 - std::list<HookManagerInfo::VfnPtr::Iface::Hook> &postlist = ci.hooks_post; \
1.69 + List<HookManagerInfo::VfnPtr::Iface::Hook> &prelist = ci.hooks_pre; \
1.70 + List<HookManagerInfo::VfnPtr::Iface::Hook> &postlist = ci.hooks_post; \
1.71 rettype orig_ret; \
1.72 rettype override_ret; \
1.73 rettype plugin_ret; \
1.74 @@ -501,7 +499,7 @@
1.75
1.76 #define SH_CALL_HOOKS(post, params) \
1.77 prev_res = MRES_IGNORED; \
1.78 - for (std::list<HookManagerInfo::VfnPtr::Iface::Hook>::iterator hiter = post##list.begin(); hiter != post##list.end(); ++hiter) \
1.79 + for (List<HookManagerInfo::VfnPtr::Iface::Hook>::iterator hiter = post##list.begin(); hiter != post##list.end(); ++hiter) \
1.80 { \
1.81 if (hiter->paused) continue; \
1.82 cur_res = MRES_IGNORED; \
1.83 @@ -544,8 +542,7 @@
1.84 void *ourvfnptr = reinterpret_cast<void*>( \
1.85 *reinterpret_cast<void***>(reinterpret_cast<char*>(this) + ms_HI->vtbl_offs) + ms_HI->vtbl_idx); \
1.86 \
1.87 - HookManagerInfo::VfnPtrListIter vfptriter = std::find(ms_HI->vfnptrs.begin(), \
1.88 - ms_HI->vfnptrs.end(), ourvfnptr); \
1.89 + HookManagerInfo::VfnPtrListIter vfptriter = ms_HI->vfnptrs.find(ourvfnptr); \
1.90 if (vfptriter == ms_HI->vfnptrs.end()) \
1.91 { \
1.92 /* Bleh? Should be impossible! */ \
1.93 @@ -553,7 +550,7 @@
1.94 } \
1.95 HookManagerInfo::VfnPtr &vfnptr = *vfptriter; \
1.96 /* 2) Find the iface */ \
1.97 - HookManagerInfo::VfnPtr::IfaceListIter ifiter = std::find(vfnptr.ifaces.begin(), vfnptr.ifaces.end(), this); \
1.98 + HookManagerInfo::VfnPtr::IfaceListIter ifiter = vfnptr.ifaces.find(this); \
1.99 if (ifiter == vfnptr.ifaces.end()) \
1.100 { \
1.101 /* The iface info was not found. Redirect the call to the original function. */ \
1.102 @@ -564,8 +561,8 @@
1.103 } \
1.104 HookManagerInfo::VfnPtr::Iface &ci = *ifiter; \
1.105 /* 2) Declare some vars and set it up */ \
1.106 - std::list<HookManagerInfo::VfnPtr::Iface::Hook> &prelist = ci.hooks_pre; \
1.107 - std::list<HookManagerInfo::VfnPtr::Iface::Hook> &postlist = ci.hooks_post; \
1.108 + List<HookManagerInfo::VfnPtr::Iface::Hook> &prelist = ci.hooks_pre; \
1.109 + List<HookManagerInfo::VfnPtr::Iface::Hook> &postlist = ci.hooks_post; \
1.110 META_RES &cur_res = SH_GLOB_SHPTR->GetCurResRef(); \
1.111 META_RES &prev_res = SH_GLOB_SHPTR->GetPrevResRef(); \
1.112 META_RES &status = SH_GLOB_SHPTR->GetStatusRef(); \
1.113 @@ -575,7 +572,7 @@
1.114
1.115 #define SH_CALL_HOOKS_void(post, params) \
1.116 prev_res = MRES_IGNORED; \
1.117 - for (std::list<HookManagerInfo::VfnPtr::Iface::Hook>::iterator hiter = post##list.begin(); hiter != post##list.end(); ++hiter) \
1.118 + for (List<HookManagerInfo::VfnPtr::Iface::Hook>::iterator hiter = post##list.begin(); hiter != post##list.end(); ++hiter) \
1.119 { \
1.120 if (hiter->paused) continue; \
1.121 cur_res = MRES_IGNORED; \