本文整理汇总了C++中IPluginFunction::PushCell方法的典型用法代码示例。如果您正苦于以下问题:C++ IPluginFunction::PushCell方法的具体用法?C++ IPluginFunction::PushCell怎么用?C++ IPluginFunction::PushCell使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPluginFunction
的用法示例。
在下文中一共展示了IPluginFunction::PushCell方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnTimer
ResultType TimerNatives::OnTimer(ITimer *pTimer, void *pData)
{
TimerInfo *pInfo = reinterpret_cast<TimerInfo *>(pData);
IPluginFunction *pFunc = pInfo->Hook;
cell_t res = static_cast<ResultType>(Pl_Continue);
pFunc->PushCell(pInfo->TimerHandle);
pFunc->PushCell(pInfo->UserData);
pFunc->Execute(&res);
return static_cast<ResultType>(res);
}
示例2: OnMenuCancel
void CPanelHandler::OnMenuCancel(IBaseMenu *menu, int client, MenuCancelReason reason)
{
if (m_pFunc)
{
m_pFunc->PushCell(BAD_HANDLE);
m_pFunc->PushCell(MenuAction_Cancel);
m_pFunc->PushCell(client);
m_pFunc->PushCell(reason);
m_pFunc->Execute(NULL);
}
g_MenuHelpers.FreePanelHandler(this);
}
示例3: sort_adtarray_custom
int sort_adtarray_custom(const void *elem1, const void *elem2)
{
cell_t result = 0;
IPluginFunction *pf = g_SortInfoADT.pFunc;
pf->PushCell(((cell_t) ((cell_t *) elem1 - g_SortInfoADT.array_base)) / g_SortInfoADT.array_bsize);
pf->PushCell(((cell_t) ((cell_t *) elem2 - g_SortInfoADT.array_base)) / g_SortInfoADT.array_bsize);
pf->PushCell(g_SortInfoADT.array_hndl);
pf->PushCell(g_SortInfoADT.hndl);
pf->Execute(&result);
return result;
}
示例4: OnMenuSelect
void CPanelHandler::OnMenuSelect(IBaseMenu *menu, int client, unsigned int item)
{
if (m_pFunc)
{
unsigned int old_reply = g_ChatTriggers.SetReplyTo(SM_REPLY_CHAT);
m_pFunc->PushCell(BAD_HANDLE);
m_pFunc->PushCell(MenuAction_Select);
m_pFunc->PushCell(client);
m_pFunc->PushCell(item);
m_pFunc->Execute(NULL);
g_ChatTriggers.SetReplyTo(old_reply);
}
g_MenuHelpers.FreePanelHandler(this);
}
示例5: sort1d_amx_custom
int sort1d_amx_custom(const void *elem1, const void *elem2)
{
cell_t c1 = *(cell_t *)elem1;
cell_t c2 = *(cell_t *)elem2;
cell_t result = 0;
IPluginFunction *pf = g_SortInfo.pFunc;
pf->PushCell(c1);
pf->PushCell(c2);
pf->PushCell(g_SortInfo.array_addr);
pf->PushCell(g_SortInfo.hndl);
pf->Execute(&result);
return result;
}
示例6: OnQueryCvarValueFinished
void ConVarManager::OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *pPlayer, EQueryCvarValueStatus result, const char *cvarName, const char *cvarValue)
#endif // SE_DOTA
{
IPluginFunction *pCallback = NULL;
cell_t value = 0;
List<ConVarQuery>::iterator iter;
for (iter = m_ConVarQueries.begin(); iter != m_ConVarQueries.end(); iter++)
{
ConVarQuery &query = (*iter);
if (query.cookie == cookie)
{
pCallback = query.pCallback;
value = query.value;
break;
}
}
if (pCallback)
{
cell_t ret;
pCallback->PushCell(cookie);
#if SOURCE_ENGINE == SE_DOTA
pCallback->PushCell(player.Get());
#else
pCallback->PushCell(IndexOfEdict(pPlayer));
#endif
pCallback->PushCell(result);
pCallback->PushString(cvarName);
if (result == eQueryCvarValueStatus_ValueIntact)
{
pCallback->PushString(cvarValue);
}
else
{
pCallback->PushString("\0");
}
pCallback->PushCell(value);
pCallback->Execute(&ret);
m_ConVarQueries.erase(iter);
}
}
示例7: OnClientQueryFinished
void ConVarManager::OnClientQueryFinished(QueryCvarCookie_t cookie,
int client,
EQueryCvarValueStatus result,
const char *cvarName,
const char *cvarValue)
{
IPluginFunction *pCallback = NULL;
cell_t value = 0;
List<ConVarQuery>::iterator iter;
for (iter = m_ConVarQueries.begin(); iter != m_ConVarQueries.end(); iter++)
{
ConVarQuery &query = (*iter);
if (query.cookie == cookie)
{
pCallback = query.pCallback;
value = query.value;
break;
}
}
if (pCallback)
{
cell_t ret;
pCallback->PushCell(cookie);
pCallback->PushCell(client);
pCallback->PushCell(result);
pCallback->PushString(cvarName);
if (result == eQueryCvarValueStatus_ValueIntact)
{
pCallback->PushString(cvarValue);
}
else
{
pCallback->PushString("\0");
}
pCallback->PushCell(value);
pCallback->Execute(&ret);
m_ConVarQueries.erase(iter);
}
}
示例8: DoAction
cell_t CMenuHandler::DoAction(IBaseMenu *menu, MenuAction action, cell_t param1, cell_t param2, cell_t def_res)
{
#if defined MENU_DEBUG
g_Logger.LogMessage("[SM_MENU] CMenuHandler::DoAction() (menu %p/%08x) (action %d) (param1 %d) (param2 %d)",
menu,
menu->GetHandle(),
action,
param1,
param2);
#endif
cell_t res = def_res;
m_pBasic->PushCell(menu->GetHandle());
m_pBasic->PushCell((cell_t)action);
m_pBasic->PushCell(param1);
m_pBasic->PushCell(param2);
m_pBasic->Execute(&res);
return res;
}
示例9: OnGameFrameHit
// Frame hit
void OnGameFrameHit(bool simulating)
{
// Could lock?
if (m_locked)
{
return;
}
// Lock
m_locked = true;
// Item in vec?
if (!vecPawnReturn.empty())
{
// Get Last item
PawnFuncThreadReturn *pReturn = vecPawnReturn.back();
vecPawnReturn.pop_back();
// Call Forward
IPluginFunction *pFunc = pReturn->pFunc;
if (pFunc != NULL && pFunc->IsRunnable())
{
pFunc->PushCell(pReturn->result);
pFunc->PushCell(pReturn->error);
pFunc->Execute(NULL);
}
// Delete item
delete pReturn;
}
// Unlock
m_locked = false;
}
示例10: OnPlaybackTempEntity
void TempEntHooks::OnPlaybackTempEntity(IRecipientFilter &filter, float delay, const void *pSender, const SendTable *pST, int classID)
{
TEHookInfo *pInfo;
const char *name = g_TEManager.GetNameFromThisPtr(const_cast<void *>(pSender));
if (m_TEHooks->Retrieve(name, reinterpret_cast<void **>(&pInfo)))
{
SourceHook::List<IPluginFunction *>::iterator iter;
IPluginFunction *pFunc;
size_t size;
cell_t res = static_cast<ResultType>(Pl_Continue);
TempEntityInfo *oldinfo = g_CurrentTE;
g_CurrentTE = pInfo->te;
size = _FillInPlayers(g_TEPlayers, &filter);
for (iter=pInfo->lst.begin(); iter!=pInfo->lst.end(); iter++)
{
pFunc = (*iter);
pFunc->PushString(name);
pFunc->PushArray(g_TEPlayers, size);
pFunc->PushCell(size);
pFunc->PushFloat(delay);
pFunc->Execute(&res);
if (res != Pl_Continue)
{
g_CurrentTE = oldinfo;
RETURN_META(MRES_SUPERCEDE);
}
}
g_CurrentTE = oldinfo;
RETURN_META(MRES_IGNORED);
}
}
示例11: OnMenuVoteResults
//.........这里部分代码省略.........
}
unsigned int total_votes = results->num_votes;
unsigned int winning_votes = results->item_list[0].count;
DoAction(menu, MenuAction_VoteEnd, winning_item, (total_votes << 16) | (winning_votes & 0xFFFF));
} else {
IPluginContext *pContext = m_pVoteResults->GetParentContext();
bool no_call = false;
int err;
/* First array */
cell_t client_array_address = -1;
cell_t *client_array_base = NULL;
cell_t client_array_size = results->num_clients + (results->num_clients * 2);
if (client_array_size)
{
if ((err = pContext->HeapAlloc(client_array_size, &client_array_address, &client_array_base))
!= SP_ERROR_NONE)
{
logicore.GenerateError(pContext, m_fnVoteResult, err, "Menu callback could not allocate %d bytes for client list.", client_array_size * sizeof(cell_t));
no_call = true;
} else {
cell_t target_offs = sizeof(cell_t) * results->num_clients;
cell_t *cur_index = client_array_base;
cell_t *cur_array;
for (unsigned int i=0; i<results->num_clients; i++)
{
/* Copy the array index */
*cur_index = target_offs;
/* Get the current array address */
cur_array = (cell_t *)((char *)cur_index + target_offs);
/* Store information */
cur_array[0] = results->client_list[i].client;
cur_array[1] = results->client_list[i].item;
/* Adjust for the new target by subtracting one indirection
* and adding one array.
*/
target_offs += (sizeof(cell_t) * 2) - sizeof(cell_t);
cur_index++;
}
}
}
/* Second array */
cell_t item_array_address = -1;
cell_t *item_array_base = NULL;
cell_t item_array_size = results->num_items + (results->num_items * 2);
if (item_array_size)
{
if ((err = pContext->HeapAlloc(item_array_size, &item_array_address, &item_array_base))
!= SP_ERROR_NONE)
{
logicore.GenerateError(pContext, m_fnVoteResult, err, "Menu callback could not allocate %d bytes for item list.", item_array_size);
no_call = true;
} else {
cell_t target_offs = sizeof(cell_t) * results->num_items;
cell_t *cur_index = item_array_base;
cell_t *cur_array;
for (unsigned int i=0; i<results->num_items; i++)
{
/* Copy the array index */
*cur_index = target_offs;
/* Get the current array address */
cur_array = (cell_t *)((char *)cur_index + target_offs);
/* Store information */
cur_array[0] = results->item_list[i].item;
cur_array[1] = results->item_list[i].count;
/* Adjust for the new target by subtracting one indirection
* and adding one array.
*/
target_offs += (sizeof(cell_t) * 2) - sizeof(cell_t);
cur_index++;
}
}
}
/* Finally, push everything */
if (!no_call)
{
m_pVoteResults->PushCell(menu->GetHandle());
m_pVoteResults->PushCell(results->num_votes);
m_pVoteResults->PushCell(results->num_clients);
m_pVoteResults->PushCell(client_array_address);
m_pVoteResults->PushCell(results->num_items);
m_pVoteResults->PushCell(item_array_address);
m_pVoteResults->Execute(NULL);
}
/* Free what we allocated, in reverse order as required */
if (item_array_address != -1)
{
pContext->HeapPop(item_array_address);
}
if (client_array_address != -1)
{
pContext->HeapPop(client_array_address);
}
}
}
示例12: SQL_TConnect
static cell_t SQL_TConnect(IPluginContext *pContext, const cell_t *params)
{
IPluginFunction *pf = pContext->GetFunctionById(params[1]);
if (!pf)
{
return pContext->ThrowNativeError("Function id %x is invalid", params[1]);
}
char *conf;
pContext->LocalToString(params[2], &conf);
IDBDriver *driver = NULL;
const DatabaseInfo *pInfo = g_DBMan.FindDatabaseConf(conf);
char error[255];
if (pInfo != NULL)
{
if (pInfo->driver[0] == '\0')
{
driver = g_DBMan.GetDefaultDriver();
} else {
driver = g_DBMan.FindOrLoadDriver(pInfo->driver);
}
if (!driver)
{
UTIL_Format(error,
sizeof(error),
"Could not find driver \"%s\"",
pInfo->driver[0] == '\0' ? g_DBMan.GetDefaultDriverName() : pInfo->driver);
} else if (!driver->IsThreadSafe()) {
UTIL_Format(error,
sizeof(error),
"Driver \"%s\" is not thread safe!",
driver->GetIdentifier());
}
} else {
UTIL_Format(error, sizeof(error), "Could not find database conf \"%s\"", conf);
}
if (!pInfo || !driver)
{
pf->PushCell(BAD_HANDLE);
pf->PushCell(BAD_HANDLE);
pf->PushString(error);
pf->PushCell(0);
pf->Execute(NULL);
return 0;
}
/* HACK! Add us to the dependency list */
CExtension *pExt = g_Extensions.GetExtensionFromIdent(driver->GetIdentity());
if (pExt)
{
g_Extensions.BindChildPlugin(pExt, g_PluginSys.GetPluginByCtx(pContext->GetContext()));
}
/* Finally, add to the thread if we can */
TConnectOp *op = new TConnectOp(pf, driver, conf, params[3]);
CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
if (pPlugin->GetProperty("DisallowDBThreads", NULL)
|| !g_DBMan.AddToThreadQueue(op, PrioQueue_High))
{
/* Do everything right now */
op->RunThreadPart();
op->RunThinkPart();
op->Destroy();
}
return 1;
}