3737#include ENGINE_INCLUDE_PATH(entities_datamaps_wrap.h)
3838
3939
40+ // ============================================================================
41+ // >> GLOBAL VARIABLES
42+ // ============================================================================
43+ static inputfunc_t g_pInputKillFunc = NULL ;
44+
45+
4046// ============================================================================
4147// >> CBaseEntityWrapper
4248// ============================================================================
@@ -125,17 +131,22 @@ IEntityFactory* CBaseEntityWrapper::get_factory()
125131
126132void CBaseEntityWrapper::remove ()
127133{
128- datamap_t * datamap = GetDataDescMap ();
129- if (!datamap)
130- BOOST_RAISE_EXCEPTION (PyExc_ValueError, " Failed to retrieve the datamap." )
134+ if (!g_pInputKillFunc)
135+ {
136+ datamap_t * datamap = GetDataDescMap ();
137+ if (!datamap)
138+ BOOST_RAISE_EXCEPTION (PyExc_ValueError, " Failed to retrieve the datamap." )
131139
132- typedescription_t *pTypeDesc = DataMapSharedExt::find (datamap, " InputKill" );
133- if (!pTypeDesc)
134- BOOST_RAISE_EXCEPTION (PyExc_ValueError, " Unable to find the 'InputKill' descriptor." );
140+ typedescription_t *pTypeDesc = DataMapSharedExt::find (datamap, " InputKill" );
141+ if (!pTypeDesc)
142+ BOOST_RAISE_EXCEPTION (PyExc_ValueError, " Unable to find the 'InputKill' descriptor." );
135143
136- inputfunc_t pInputFunc = pTypeDesc->inputFunc ;
137- if (!pInputFunc)
138- BOOST_RAISE_EXCEPTION (PyExc_ValueError, " Input function is NULL." );
144+ inputfunc_t pInputFunc = pTypeDesc->inputFunc ;
145+ if (!pInputFunc)
146+ BOOST_RAISE_EXCEPTION (PyExc_ValueError, " Input function is NULL." );
147+
148+ g_pInputKillFunc = pInputFunc;
149+ }
139150
140151 CBaseEntity *pEntity = GetThis ();
141152 inputdata_t data;
@@ -146,7 +157,7 @@ void CBaseEntityWrapper::remove()
146157 data.value = value;
147158 data.nOutputID = 0 ;
148159
149- (pEntity->*pInputFunc )(data);
160+ (pEntity->*g_pInputKillFunc )(data);
150161}
151162
152163int CBaseEntityWrapper::get_size ()
0 commit comments