added amb1425, added description buffers to find concommand natives

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401899
This commit is contained in:
Borja Ferrer 2008-02-23 12:25:27 +00:00
parent 7bf9cfc2e8
commit 0e547df447
2 changed files with 20 additions and 2 deletions

View File

@ -1136,6 +1136,7 @@ static cell_t FindFirstConCommand(IPluginContext *pContext, const cell_t *params
ConCmdIter *pIter;
cell_t *pIsCmd, *pFlags;
const ConCommandBase *pConCmd;
const char *desc;
pContext->LocalToPhysAddr(params[3], &pIsCmd);
pContext->LocalToPhysAddr(params[4], &pFlags);
@ -1151,6 +1152,12 @@ static cell_t FindFirstConCommand(IPluginContext *pContext, const cell_t *params
*pIsCmd = pConCmd->IsCommand() ? 1 : 0;
*pFlags = pConCmd->GetFlags();
if (params[6])
{
desc = pConCmd->GetHelpText();
pContext->StringToLocalUTF8(params[5], params[6], (desc && desc[0]) ? desc : "", NULL);
}
pIter = new ConCmdIter;
pIter->pLast = pConCmd;
@ -1169,6 +1176,7 @@ static cell_t FindNextConCommand(IPluginContext *pContext, const cell_t *params)
HandleError err;
ConCmdIter *pIter;
cell_t *pIsCmd, *pFlags;
const char *desc;
HandleSecurity sec(pContext->GetIdentity(), g_pCoreIdent);
if ((err = g_HandleSys.ReadHandle(params[1], htConCmdIter, &sec, (void **)&pIter)) != HandleError_None)
@ -1193,6 +1201,12 @@ static cell_t FindNextConCommand(IPluginContext *pContext, const cell_t *params)
*pIsCmd = pIter->pLast->IsCommand() ? 1 : 0;
*pFlags = pIter->pLast->GetFlags();
if (params[7])
{
desc = pIter->pLast->GetHelpText();
pContext->StringToLocalUTF8(params[6], params[7], (desc && desc[0]) ? desc : "", NULL);
}
return 1;
}

View File

@ -729,6 +729,8 @@ native bool:SetCommandFlags(const String:name[], flags);
* @param isCommand Variable to store whether the entry is a command.
* If it is not a command, it is a ConVar.
* @param flags Variable to store entry flags.
* @param description Buffer to store the description, empty if no description present.
* @param descrmax_size Maximum size of the description buffer.
* @return On success, a ConCmdIter Handle is returned, which
* can be read via FindNextConCommand(), and must be
* closed via CloseHandle(). Additionally, the output
@ -737,7 +739,7 @@ native bool:SetCommandFlags(const String:name[], flags);
* On failure, INVALID_HANDLE is returned, and the
* contents of outputs is undefined.
*/
native Handle:FindFirstConCommand(String:buffer[], max_size, &bool:isCommand, &flags=0);
native Handle:FindFirstConCommand(String:buffer[], max_size, &bool:isCommand, &flags=0, String:description[]="", descrmax_size=0);
/**
* Reads the next entry in a ConCommandBase iterator.
@ -748,12 +750,14 @@ native Handle:FindFirstConCommand(String:buffer[], max_size, &bool:isCommand, &f
* @param isCommand Variable to store whether the entry is a command.
* If it is not a command, it is a ConVar.
* @param flags Variable to store entry flags.
* @param description Buffer to store the description, empty if no description present.
* @param descrmax_size Maximum size of the description buffer.
* @return On success, the outputs are filled, the iterator is
* advanced to the next entry, and true is returned.
* If no more entries exist, false is returned, and the
* contents of outputs is undefined.
*/
native bool:FindNextConCommand(Handle:search, String:buffer[], max_size, &bool:isCommand, &flags=0);
native bool:FindNextConCommand(Handle:search, String:buffer[], max_size, &bool:isCommand, &flags=0, String:description[]="", descrmax_size=0);
/**
* Replicates a convar value to a specific client. This does not change the actual convar value.