Bazaar developer reference

CvGame::IsAction(int, bool, bool, bool)

Defined in
CvGame.cpp, line 10449
Class
CvGame
Hook name
CivHooks::CvGame_IsAction

Hooks

static bool BeforeCvGame_IsAction(CvGame* self, int iKeyStroke, bool bAlt, bool bShift, bool bCtrl, int& result);static void AfterCvGame_IsAction(CvGame* self, int iKeyStroke, bool bAlt, bool bShift, bool bCtrl, int& result);static int ReplaceCvGame_IsAction(int (*original)(CvGame*, int, bool, bool, bool), CvGame* self, int iKeyStroke, bool bAlt, bool bShift, bool bCtrl);CivRegisterBefore<CivHooks::CvGame_IsAction>(host, &BeforeCvGame_IsAction);CivRegisterAfter<CivHooks::CvGame_IsAction>(host, &AfterCvGame_IsAction);CivRegisterReplace<CivHooks::CvGame_IsAction>(host, &ReplaceCvGame_IsAction);

Code

10446/// Get the action associated with the supplied key.10447/// This will NOT test to see if the action can actually be done.10448/// Returns: the action info index or -1.10449int CvGame::IsAction(int iKeyStroke, bool bAlt, bool bShift, bool bCtrl)10450{10451	int i;10452	int iActionIndex = -1;10453	int iPriority = -1;104541045510456	for(i=0; i<GC.getNumActionInfos(); i++)10457	{10458		CvActionInfo& thisActionInfo = *GC.getActionInfo(i);10459		if((((thisActionInfo.getHotKeyVal() == iKeyStroke) &&10460			(thisActionInfo.getHotKeyPriority() > iPriority) &&10461			(bAlt == thisActionInfo.isAltDown()) &&10462			(bShift == thisActionInfo.isShiftDown()) &&10463			(bCtrl == thisActionInfo.isCtrlDown())10464			)10465			||10466			((thisActionInfo.getHotKeyValAlt() == iKeyStroke) &&10467			(thisActionInfo.getHotKeyPriorityAlt() > iPriority) &&10468			(bAlt == thisActionInfo.isAltDownAlt()) &&10469			(bShift == thisActionInfo.isShiftDownAlt()) &&10470			(bCtrl == thisActionInfo.isCtrlDownAlt())10471			)10472			)			10473			)10474		{10475			iPriority = thisActionInfo.getHotKeyPriority();10476			iActionIndex = i;10477		}10478	}1047910480	return iActionIndex;10481}

Calls

Called by