MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / getCommand

Method getCommand

Engine/source/sim/actionMap.cpp:776–804  ·  view source on GitHub ↗

------------------------------------------------------------------------------ This function is for the use of the control remapper. The intent of this function is to determine if the given event descriptor is already bound in this action map. If so, this function returns the command it is bound to. If not, it returns NULL.

Source from the content-addressed store, hash-verified

774// If not, it returns NULL.
775//
776const char* ActionMap::getCommand( const char* device, const char* action )
777{
778 U32 deviceType;
779 U32 deviceInst;
780 if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) )
781 {
782 EventDescriptor eventDescriptor;
783 if ( createEventDescriptor( action, &eventDescriptor ) )
784 {
785 const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode );
786 if ( mapNode )
787 {
788 if ( mapNode->flags & Node::BindCmd )
789 {
790 S32 bufferLen = dStrlen( mapNode->makeConsoleCommand ) + dStrlen( mapNode->breakConsoleCommand ) + 2;
791 char* returnString = Con::getReturnBuffer( bufferLen );
792 dSprintf( returnString, bufferLen, "%s\t%s",
793 ( mapNode->makeConsoleCommand ? mapNode->makeConsoleCommand : "" ),
794 ( mapNode->breakConsoleCommand ? mapNode->breakConsoleCommand : "" ) );
795 return( returnString );
796 }
797 else
798 return( mapNode->consoleFunction );
799 }
800 }
801 }
802
803 return( "" );
804}
805
806//------------------------------------------------------------------------------
807// This function returns whether or not the mapping specified is inverted.

Callers 1

actionMap.cppFile · 0.80

Calls 3

getReturnBufferFunction · 0.85
dSprintfFunction · 0.85
dStrlenFunction · 0.50

Tested by

no test coverage detected