|
From: <ha...@us...> - 2002-10-08 19:35:02
|
Update of /cvsroot/decaldev/source/DecalFilters
In directory usw-pr-cvs1:/tmp/cvs-serv10993
Modified Files:
World.cpp World.h
Log Message:
some WF cleanup with hooks
Index: World.cpp
===================================================================
RCS file: /cvsroot/decaldev/source/DecalFilters/World.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** World.cpp 3 Oct 2002 07:46:32 -0000 1.42
--- World.cpp 8 Oct 2002 19:34:59 -0000 1.43
***************
*** 137,143 ****
_DebugLog("\n\nLogin") ;
! if (!m_HookIsSet) {
SetHook() ;
- }
return S_OK;
--- 137,143 ----
_DebugLog("\n\nLogin") ;
!
! if( !m_HookIsSet )
SetHook() ;
return S_OK;
***************
*** 147,180 ****
void cWorld::SetHook()
{
! CComPtr< IDecal > pDecal;
! HRESULT hr = m_pService->get_Decal( &pDecal );
! if (SUCCEEDED(hr)) {
_DebugLog("\nGotDecal") ;
- CComPtr< IInjectService > pInject;
- HRESULT hr = pDecal->get_Object ( _bstr_t ( _T( "services\\DecalPlugins.InjectService" ) ),
- __uuidof ( IInjectService ), reinterpret_cast< LPVOID * > ( &pInject ) );
! if (SUCCEEDED(hr)) {
! _DebugLog("\nGot Inject") ;
! pInject->get_Site(&m_pPluginSite);
! if (SUCCEEDED(hr)) {
! _DebugLog("\nGot PluginSite") ;
! hr = m_pPluginSite->get_Hooks(&m_pHooks) ;
! if (SUCCEEDED(hr)) {
! _DebugLog("\nGot Hooks") ;
! IACHooksEventsImpl<HookDestroyObj, cWorld>::advise(m_pHooks) ;
! m_HookIsSet = true ;
! } else {
! _DebugLog("\nFailed Get Hooks %x", hr) ;
! }
! } else {
! _DebugLog("\nFailed to get PluginSite %x", hr) ;
! }
! } else {
! _DebugLog("\nFailed to get Inject %x", hr) ;
}
! } else {
! _DebugLog("\nFailed to get Decal %x", hr) ;
}
}
--- 147,171 ----
void cWorld::SetHook()
{
! HRESULT hr = m_pService->get_Decal( &m_pDecal );
!
! if( SUCCEEDED( hr ) )
! {
_DebugLog("\nGotDecal") ;
! hr = m_pDecal->get_Hooks(&m_pHooks) ;
!
! if( SUCCEEDED( hr ) )
! {
! _DebugLog("\nGot Hooks") ;
! IACHooksEventsImpl<HookDestroyObj, cWorld>::advise(m_pHooks) ;
! m_HookIsSet = true ;
}
!
! else
! _DebugLog("\nFailed Get Hooks %x", hr) ;
}
+
+ else
+ _DebugLog("\nFailed to get Decal %x", hr) ;
}
***************
*** 184,199 ****
_DebugLog("OnTerminate") ;
_DebugLog("CLOSEFILE") ;
! if (m_HookIsSet) {
! IACHooksEventsImpl<HookDestroyObj, cWorld>::unadvise(m_pPluginSite) ;
! if (m_pHooks!=NULL) {
m_pHooks.Release() ;
m_pHooks = NULL ;
}
! if (m_pPluginSite!=NULL) {
! m_pPluginSite.Release() ;
! m_pPluginSite = NULL ;
! }
m_HookIsSet = false ;
}
return S_OK;
}
--- 175,197 ----
_DebugLog("OnTerminate") ;
_DebugLog("CLOSEFILE") ;
! if( m_HookIsSet )
! {
! IACHooksEventsImpl<HookDestroyObj, cWorld>::unadvise(m_pHooks) ;
!
! if( m_pHooks != NULL )
! {
m_pHooks.Release() ;
m_pHooks = NULL ;
}
!
m_HookIsSet = false ;
}
+
+ if( m_pDecal != NULL )
+ {
+ m_pDecal.Release() ;
+ m_pDecal = NULL ;
+ }
+
return S_OK;
}
***************
*** 213,229 ****
// Gouru: reset the player so next login the player gets updated...
m_objects.player(0) ;
-
- if (m_HookIsSet) {
- IACHooksEventsImpl<HookDestroyObj, cWorld>::unadvise(m_pPluginSite) ;
- if (m_pHooks!=NULL) {
- m_pHooks.Release() ;
- m_pHooks = NULL ;
- }
- if (m_pPluginSite!=NULL) {
- m_pPluginSite.Release() ;
- m_pPluginSite = NULL ;
- }
- m_HookIsSet = false ;
- }
}
--- 211,214 ----
Index: World.h
===================================================================
RCS file: /cvsroot/decaldev/source/DecalFilters/World.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** World.h 16 Sep 2002 19:17:05 -0000 1.30
--- World.h 8 Oct 2002 19:34:59 -0000 1.31
***************
*** 247,251 ****
long m_nNextTime;
bool m_HookIsSet ;
! CComPtr<IPluginSite> m_pPluginSite ;
CComPtr< IACHooks > m_pHooks ;
--- 247,251 ----
long m_nNextTime;
bool m_HookIsSet ;
! CComPtr< IDecal > m_pDecal ;
CComPtr< IACHooks > m_pHooks ;
|