mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2024-11-08 08:47:17 +01:00
Fix bug in command system when identifiying where the command name ends.
Also add a quick helper function to retrieve the number of existing commands.
This commit is contained in:
parent
acaf826498
commit
98b2ddfda6
@ -268,7 +268,7 @@ Int32 CmdManager::Run(Int32 invoker, CCStr command)
|
|||||||
// Where the name ends and argument begins
|
// Where the name ends and argument begins
|
||||||
CCStr split = command;
|
CCStr split = command;
|
||||||
// Find where the command name ends
|
// Find where the command name ends
|
||||||
while (isspace(*split)) ++split;
|
while (!isspace(*split)) ++split;
|
||||||
// Are there any arguments specified?
|
// Are there any arguments specified?
|
||||||
if (split != nullptr)
|
if (split != nullptr)
|
||||||
{
|
{
|
||||||
@ -1570,6 +1570,12 @@ static void Cmd_Sort()
|
|||||||
_Cmd->Sort();
|
_Cmd->Sort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------------------------
|
||||||
|
static Uint32 Cmd_Count()
|
||||||
|
{
|
||||||
|
return _Cmd->Count();
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------------------
|
||||||
static const Object & Cmd_FindByName(CSStr name)
|
static const Object & Cmd_FindByName(CSStr name)
|
||||||
{
|
{
|
||||||
@ -1697,6 +1703,7 @@ void Register_Command(HSQUIRRELVM vm)
|
|||||||
);
|
);
|
||||||
|
|
||||||
cmdns.Func(_SC("Sort"), &Cmd_Sort);
|
cmdns.Func(_SC("Sort"), &Cmd_Sort);
|
||||||
|
cmdns.Func(_SC("Count"), &Cmd_Count);
|
||||||
cmdns.Func(_SC("FindByName"), &Cmd_FindByName);
|
cmdns.Func(_SC("FindByName"), &Cmd_FindByName);
|
||||||
cmdns.Func(_SC("GetOnError"), &Cmd_GetOnError);
|
cmdns.Func(_SC("GetOnError"), &Cmd_GetOnError);
|
||||||
cmdns.Func(_SC("SetOnError"), &Cmd_SetOnError);
|
cmdns.Func(_SC("SetOnError"), &Cmd_SetOnError);
|
||||||
|
@ -160,6 +160,14 @@ public:
|
|||||||
*/
|
*/
|
||||||
void Sort();
|
void Sort();
|
||||||
|
|
||||||
|
/* --------------------------------------------------------------------------------------------
|
||||||
|
* Retrieve the number of commands.
|
||||||
|
*/
|
||||||
|
Uint32 Count() const
|
||||||
|
{
|
||||||
|
return static_cast< Uint32 >(m_Commands.size());
|
||||||
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------------------------
|
||||||
* Sort the command list in an ascending order.
|
* Sort the command list in an ascending order.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user