MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / SetThunk

Method SetThunk

CryCommon/_ScriptableEx.h:254–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

252 return (pThis->*(pThis->m_vFuncs[m_pFunctionHandler->GetFunctionID()]))(m_pFunctionHandler);
253 }
254 static int SetThunk(HSCRIPT h) {
255 m_pFunctionHandler->__Attach(h);
256 T *pThis=(T *)m_pFunctionHandler->GetThis();
257 const char *sIndex;
258 if(pThis && m_pFunctionHandler->GetParam(1,sIndex))
259 {
260 int nCookie;
261 USER_DATA nP;
262 if(_ScriptableEx<T>::m_pPropertiesTable->GetUDValue(sIndex,nP,nCookie)/*pThis->m_pProperties->GetUDValue(sIndex,nP,nCookie)*/)
263 {
264 Property *prop=((Property*)nP);
265 if(nCookie!=-1)
266 CryError("Scriptable EX:Set Thunk");
267 assert(pThis->m_nBase);
268 void *val=(void *)(pThis->m_nBase+prop->val);
269 switch(prop->nType)
270 {
271 case PROPERTY_TYPE_INT:
272 m_pFunctionHandler->GetParam(2,(*((int *)val)));
273 return 0;
274 break;
275 case PROPERTY_TYPE_FLOAT:
276 m_pFunctionHandler->GetParam(2,(*((float *)val)));
277 return 0;
278 break;
279 case PROPERTY_TYPE_CHAR:
280 {
281 const char *sTemp=NULL;
282 m_pFunctionHandler->GetParam(2,sTemp);
283 if(!sTemp)
284 return -1;
285 strcpy(((char *)val),sTemp);
286 }
287 return 0;
288 break;
289 case PROPERTY_TYPE_STRING:
290 {
291 const char *sTemp=NULL;
292 m_pFunctionHandler->GetParam(2,sTemp);
293 if(!sTemp)
294 return -1;
295 (*((string *)val))=sTemp;
296 }
297 return 0;
298 break;
299 case PROPERTY_TYPE_BOOL:
300 m_pFunctionHandler->GetParam(2,(*((bool *)val)));
301 return 0;
302 break;
303 case PROPERTY_TYPE_OBJECT:
304 m_pFunctionHandler->GetParam(2,((IScriptObject *)val));
305 return 0;
306 break;
307 default:
308 return -1;
309 break;
310 }
311

Callers

nothing calls this directly

Calls 5

CryErrorFunction · 0.85
__AttachMethod · 0.80
GetThisMethod · 0.80
GetParamMethod · 0.45
GetUDValueMethod · 0.45

Tested by

no test coverage detected