Sources/CryGame C++/Solution1/CryGame/GameActionInput.cpp
//////////////////////////////////////////////////////////////////////////
// Binds a key (or other input) to a certain action (eg. JUMP) in all action-maps associated with this action

Binds a key (or other input) to a certain action  in all action-maps associated with this action
Binds a key ( or other input ) to a certain action in all action - maps associated with this action
void CXGame::BindActionMultipleMaps(const char *sAction,const char *sKeys, int iKeyPos)
{
	XBind Bind;
	Bind.nKey=m_pSystem->GetIInput()->GetKeyID(sKeys);
	ActionsEnumMapItor It=m_mapActionsEnum.find(sAction);
	if (It!=m_mapActionsEnum.end())
	{
		ActionInfo &Info=It->second;
		for (Vec2StrIt Itor=Info.vecSetToActionMap.begin();Itor!=Info.vecSetToActionMap.end();++Itor)
		{
			for (ActionsEnumMapItor RemIt=m_mapActionsEnum.begin();RemIt!=m_mapActionsEnum.end();++RemIt)
			{
				if (RemIt->second.nId!=Info.nId)
				{
					for (Vec2StrIt RemItor=RemIt->second.vecSetToActionMap.begin();RemItor!=RemIt->second.vecSetToActionMap.end();++RemItor)
					{
						if (strcmp((*RemItor).c_str(), (*Itor).c_str())==0)
						{
							for (Vec2StrIt RemItor=RemIt->second.vecSetToActionMap.begin();RemItor!=RemIt->second.vecSetToActionMap.end();++RemItor)
							{
								IActionMap *pMap=m_pIActionMapManager->GetActionMap((*RemItor).c_str());
								if (pMap)
									pMap->RemoveBind(RemIt->second.nId, Bind, RemIt->second.ActivationMode);
							}
							goto NextAction;
						}
					}
				}
NextAction:; 
			}
			BindAction(sAction, sKeys, (*Itor).c_str(), iKeyPos);
		}
	}
}
void CXGame :: BindActionMultipleMaps ( const char * sAction , const char * sKeys , int iKeyPos ) { XBind Bind ; Bind . nKey = m_pSystem -> GetIInput ( ) -> GetKeyID ( sKeys ) ; ActionsEnumMapItor It = m_mapActionsEnum . find ( sAction ) ; if ( It != m_mapActionsEnum . end ( ) ) { ActionInfo & Info = It -> second ; for ( Vec2StrIt Itor = Info . vecSetToActionMap . begin ( ) ; Itor != Info . vecSetToActionMap . end ( ) ; ++ Itor ) { for ( ActionsEnumMapItor RemIt = m_mapActionsEnum . begin ( ) ; RemIt != m_mapActionsEnum . end ( ) ; ++ RemIt ) { if ( RemIt -> second . nId != Info . nId ) { for ( Vec2StrIt RemItor = RemIt -> second . vecSetToActionMap . begin ( ) ; RemItor != RemIt -> second . vecSetToActionMap . end ( ) ; ++ RemItor ) { if ( strcmp ( ( * RemItor ) . c_str ( ) , ( * Itor ) . c_str ( ) ) == 0 ) { for ( Vec2StrIt RemItor = RemIt -> second . vecSetToActionMap . begin ( ) ; RemItor != RemIt -> second . vecSetToActionMap . end ( ) ; ++ RemItor ) { IActionMap * pMap = m_pIActionMapManager -> GetActionMap ( ( * RemItor ) . c_str ( ) ) ; if ( pMap ) pMap -> RemoveBind ( RemIt -> second . nId , Bind , RemIt -> second . ActivationMode ) ; } goto NextAction ; } } } NextAction : ; } BindAction ( sAction , sKeys , ( * Itor ) . c_str ( ) , iKeyPos ) ; } } }
Binds a key (or other input) to a certain action (eg.
Binds a key ( or other input ) to a certain action ( eg .
// find action
