Bazaar developer reference

CvGame::GetAction(int, bool, bool, bool)

Defined in
CvGame.cpp, line 10409
Class
CvGame
Hook name
CivHooks::CvGame_GetAction

Hooks

static bool BeforeCvGame_GetAction(CvGame* self, int iKeyStroke, bool bAlt, bool bShift, bool bCtrl, int& result);static void AfterCvGame_GetAction(CvGame* self, int iKeyStroke, bool bAlt, bool bShift, bool bCtrl, int& result);static int ReplaceCvGame_GetAction(int (*original)(CvGame*, int, bool, bool, bool), CvGame* self, int iKeyStroke, bool bAlt, bool bShift, bool bCtrl);CivRegisterBefore<CivHooks::CvGame_GetAction>(host, &BeforeCvGame_GetAction);CivRegisterAfter<CivHooks::CvGame_GetAction>(host, &AfterCvGame_GetAction);CivRegisterReplace<CivHooks::CvGame_GetAction>(host, &ReplaceCvGame_GetAction);

Code

10406/// Get the action associated with the supplied key.10407/// This will also test to see if the action can actually be done.10408/// Returns: the action info index or -1.10409int CvGame::GetAction(int iKeyStroke, bool bAlt, bool bShift, bool bCtrl)10410{10411	int i;10412	int iActionIndex = -1;10413	int iPriority = -1;104141041510416	for(i=0; i<GC.getNumActionInfos(); i++)10417	{10418		CvActionInfo& thisActionInfo = *GC.getActionInfo(i);10419		if((((thisActionInfo.getHotKeyVal() == iKeyStroke) &&10420		        (thisActionInfo.getHotKeyPriority() > iPriority) &&10421		        (bAlt == thisActionInfo.isAltDown()) &&10422		        (bShift == thisActionInfo.isShiftDown()) &&10423		        (bCtrl == thisActionInfo.isCtrlDown())10424		    )10425		        ||10426		        ((thisActionInfo.getHotKeyValAlt() == iKeyStroke) &&10427		         (thisActionInfo.getHotKeyPriorityAlt() > iPriority) &&10428		         (bAlt == thisActionInfo.isAltDownAlt()) &&10429		         (bShift == thisActionInfo.isShiftDownAlt()) &&10430		         (bCtrl == thisActionInfo.isCtrlDownAlt())10431		        )10432		   )10433		        &&10434		        (canHandleAction(i))10435		  )10436		{10437			iPriority = thisActionInfo.getHotKeyPriority();10438			iActionIndex = i;10439		}10440	}1044110442	return iActionIndex;10443}

Calls

Called by