GM command: cometome

I tried several times to apply the gm-command cometome to a selected NPC and failed.
Looking into the code I have seen why:

[FONT=‘courier new’] /*
ComeToMe command REQUIRED for 3rd party scripting library to have access to PointMovementGenerator
Without this function 3rd party scripting library will get linking errors (unresolved external)
when attempting to use the PointMovementGenerator
/
static bool HandleComeToMeCommand(ChatHandler
handler, char const* args)
{
char const* newFlagStr = strtok((char*)args, " ");
if (!newFlagStr)
return false;[/FONT]

[FONT=‘courier new’] Creature* caster = handler->getSelectedCreature();
if (!caster)
{
handler->SendSysMessage(LANG_SELECT_CREATURE);
handler->SetSentErrorMessage(true);
return false;
}[/FONT]

[FONT=‘courier new’] Player* player = handler->GetSession()->GetPlayer();[/FONT]

[FONT=‘courier new’] caster->GetMotionMaster()->MovePoint(0, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());[/FONT]

[FONT=‘courier new’] return true;
}[/FONT]

The command needs an argument (ANY argument will fit!). This is saved in newFlagStr but never used.

Why is there an argument needed ? Because of this ‘3rd party scripting library’ that is in the comment ?

If you use the command like .cometome blah it is working fine :slight_smile:

You could simply remove the 3 lines of code

char const* newFlagStr = strtok((char*)args, " "); if (!newFlagStr) return false;

If the argument isn’t necessary than it’s a kind of an issue, isn’t ?

Should I report it ?

Additionally we could change than:

[FONT=‘courier new’]static bool HandleComeToMeCommand(ChatHandler* handler, char const* /args/)[/FONT]

And the text in the command table and in the wiki.

I thought this was some piece of custom code but it’s actually TC’s.

git blame points to code that was there before TC (2 Oct 2008).

The comment and argument make no sense at all, I will remove them from the source.

Fixed in https://github.com/TrinityCore/TrinityCore/commit/1100fe60572b186eee98b6b7cbdccf5a2d67b7e1