本文整理汇总了C++中IPlugin::GetBaseContext方法的典型用法代码示例。如果您正苦于以下问题:C++ IPlugin::GetBaseContext方法的具体用法?C++ IPlugin::GetBaseContext怎么用?C++ IPlugin::GetBaseContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPlugin
的用法示例。
在下文中一共展示了IPlugin::GetBaseContext方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sm_CallStartFunction
static cell_t sm_CallStartFunction(IPluginContext *pContext, const cell_t *params)
{
Handle_t hndl;
HandleError err;
IPlugin *pPlugin;
ResetCall();
hndl = static_cast<Handle_t>(params[1]);
if (hndl == 0)
{
pPlugin = g_PluginSys.FindPluginByContext(pContext->GetContext());
} else {
pPlugin = g_PluginSys.PluginFromHandle(hndl, &err);
if (!pPlugin)
{
return pContext->ThrowNativeError("Plugin handle %x is invalid (error %d)", hndl, err);
}
}
s_pFunction = pPlugin->GetBaseContext()->GetFunctionById(params[2]);
if (!s_pFunction)
{
return pContext->ThrowNativeError("Invalid function id (%X)", params[2]);
}
s_pCallable = static_cast<ICallable *>(s_pFunction);
s_CallStarted = true;
return 1;
}
示例2: sm_RemoveFromForward
static cell_t sm_RemoveFromForward(IPluginContext *pContext, const cell_t *params)
{
Handle_t fwdHandle = static_cast<Handle_t>(params[1]);
Handle_t plHandle = static_cast<Handle_t>(params[2]);
HandleError err;
IChangeableForward *pForward;
IPlugin *pPlugin;
if ((err=g_HandleSys.ReadHandle(fwdHandle, g_PrivateFwdType, NULL, (void **)&pForward))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid private forward handle %x (error %d)", fwdHandle, err);
}
if (plHandle == 0)
{
pPlugin = g_PluginSys.FindPluginByContext(pContext->GetContext());
} else {
pPlugin = g_PluginSys.PluginFromHandle(plHandle, &err);
if (!pPlugin)
{
return pContext->ThrowNativeError("Plugin handle %x is invalid (error %d)", plHandle, err);
}
}
IPluginFunction *pFunction = pPlugin->GetBaseContext()->GetFunctionById(params[3]);
if (!pFunction)
{
return pContext->ThrowNativeError("Invalid function id (%X)", params[3]);
}
return pForward->RemoveFunction(pFunction);
}
示例3: sm_GetFunctionByName
static cell_t sm_GetFunctionByName(IPluginContext *pContext, const cell_t *params)
{
Handle_t hndl = static_cast<Handle_t>(params[1]);
HandleError err;
char *name;
uint32_t idx;
IPlugin *pPlugin;
if (hndl == 0)
{
pPlugin = g_PluginSys.FindPluginByContext(pContext->GetContext());
} else {
pPlugin = g_PluginSys.PluginFromHandle(hndl, &err);
if (!pPlugin)
{
return pContext->ThrowNativeError("Plugin handle %x is invalid (error %d)", hndl, err);
}
}
pContext->LocalToString(params[2], &name);
/* Get public function index */
if (pPlugin->GetBaseContext()->FindPublicByName(name, &idx) == SP_ERROR_NOT_FOUND)
{
/* Return INVALID_FUNCTION if not found */
return -1;
}
/* Return function ID */
return PublicIndexToFuncId(idx);
}
示例4: SM_ConfigsExecuted_Plugin
void SM_ConfigsExecuted_Plugin(unsigned int serial)
{
IPluginIterator *iter = scripts->GetPluginIterator();
while (iter->MorePlugins())
{
IPlugin *plugin = iter->GetPlugin();
if (plugin->GetSerial() == serial)
{
SM_DoSingleExecFwds(plugin->GetBaseContext());
break;
}
iter->NextPlugin();
}
iter->Release();
}
示例5: sm_AddFrameAction
static cell_t sm_AddFrameAction(IPluginContext *pContext, const cell_t *params)
{
IPlugin *pPlugin = pluginsys->FindPluginByContext(pContext->GetContext());
IPluginFunction *pFunction = pPlugin->GetBaseContext()->GetFunctionById(params[1]);
if (!pFunction)
{
return pContext->ThrowNativeError("Invalid function id (%X)", params[1]);
}
IChangeableForward *pForward = forwardsys->CreateForwardEx(NULL, ET_Ignore, 1, NULL, Param_Cell);
IdentityToken_t *pIdentity = pContext->GetIdentity();
Handle_t Handle = handlesys->CreateHandle(g_PrivateFwdType, pForward, pIdentity, g_pCoreIdent, NULL);
if (Handle == BAD_HANDLE)
{
forwardsys->ReleaseForward(pForward);
return 0;
}
pForward->AddFunction(pFunction);
SMFrameActionData *pData = new SMFrameActionData(Handle, pPlugin->GetMyHandle(), params[2]);
g_pSM->AddFrameAction(PawnFrameAction, pData);
return 1;
}
示例6: sm_AddToForward
static cell_t sm_AddToForward(IPluginContext *pContext, const cell_t *params)
{
Handle_t fwdHandle = static_cast<Handle_t>(params[1]);
Handle_t plHandle = static_cast<Handle_t>(params[2]);
HandleError err;
IChangeableForward *pForward;
IPlugin *pPlugin;
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
if ((err=handlesys->ReadHandle(fwdHandle, g_PrivateFwdType, &sec, (void **)&pForward))
!= HandleError_None)
{
return pContext->ThrowNativeError("Invalid private forward handle %x (error %d)", fwdHandle, err);
}
if (plHandle == 0)
{
pPlugin = pluginsys->FindPluginByContext(pContext->GetContext());
} else {
pPlugin = pluginsys->PluginFromHandle(plHandle, &err);
if (!pPlugin)
{
return pContext->ThrowNativeError("Plugin handle %x is invalid (error %d)", plHandle, err);
}
}
IPluginFunction *pFunction = pPlugin->GetBaseContext()->GetFunctionById(params[3]);
if (!pFunction)
{
return pContext->ThrowNativeError("Invalid function id (%X)", params[3]);
}
return pForward->AddFunction(pFunction);
}