| 263 | } |
| 264 | |
| 265 | void CScriptMgr::CallOnMessage(asIScriptObject *object, CScriptHandle &msg, CGameObj *caller) |
| 266 | { |
| 267 | // Find the cached onMessage method id |
| 268 | SController *ctrl = reinterpret_cast<SController*>(object->GetObjectType()->GetUserData()); |
| 269 | |
| 270 | // Call the method using the shared context |
| 271 | if( ctrl->onMessageMethod != 0 ) |
| 272 | { |
| 273 | asIScriptContext *ctx = PrepareContextFromPool(ctrl->onMessageMethod); |
| 274 | ctx->SetObject(object); |
| 275 | ctx->SetArgObject(0, &msg); |
| 276 | ctx->SetArgObject(1, caller); |
| 277 | ExecuteCall(ctx); |
| 278 | ReturnContextToPool(ctx); |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | int CScriptMgr::ExecuteCall(asIScriptContext *ctx) |
| 283 | { |
no test coverage detected