本文整理汇总了C++中CvPromotionEntry::CreateHotKeyFromDescription方法的典型用法代码示例。如果您正苦于以下问题:C++ CvPromotionEntry::CreateHotKeyFromDescription方法的具体用法?C++ CvPromotionEntry::CreateHotKeyFromDescription怎么用?C++ CvPromotionEntry::CreateHotKeyFromDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvPromotionEntry
的用法示例。
在下文中一共展示了CvPromotionEntry::CreateHotKeyFromDescription方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetGlobalActionInfo
//.........这里部分代码省略.........
if(controlInfo)
{
piIndexList[iTotalActionInfoCount] = i;
piPriorityList[iTotalActionInfoCount] = controlInfo->getOrderPriority();
piActionInfoTypeList[iTotalActionInfoCount] = ACTIONSUBTYPE_CONTROL;
iTotalActionInfoCount++;
}
}
for(i=0; i<GC.getNumAutomateInfos(); i++)
{
CvAutomateInfo* automateInfo = GC.getAutomateInfo(i);
if(automateInfo)
{
piIndexList[iTotalActionInfoCount] = i;
piPriorityList[iTotalActionInfoCount] = automateInfo->getOrderPriority();
piActionInfoTypeList[iTotalActionInfoCount] = ACTIONSUBTYPE_AUTOMATE;
iTotalActionInfoCount++;
}
}
for(i=0; i<iNumMissionTypes; i++)
{
CvMissionInfo* missionInfo = GC.getMissionInfo((MissionTypes)i);
if(missionInfo)
{
piIndexList[iTotalActionInfoCount] = i;
piPriorityList[iTotalActionInfoCount] = missionInfo->getOrderPriority();
piActionInfoTypeList[iTotalActionInfoCount] = ACTIONSUBTYPE_MISSION;
iTotalActionInfoCount++;
}
}
//Preallocate
actionInfos.reserve(iTotalActionInfoCount);
//Sort and add action infos.
orderHotkeyInfo(&piOrderedIndex, piPriorityList, iTotalActionInfoCount);
for(i = 0; i < iTotalActionInfoCount; i++)
{
CvActionInfo* pActionInfo = FNEW(CvActionInfo, c_eCiv5GameplayDLL, 0);
CvAssert(piIndexList[piOrderedIndex[i]] != -1);
pActionInfo->setOriginalIndex(piIndexList[piOrderedIndex[i]]);
pActionInfo->setSubType((ActionSubTypes)piActionInfoTypeList[piOrderedIndex[i]]);
if((ActionSubTypes)piActionInfoTypeList[piOrderedIndex[i]] == ACTIONSUBTYPE_COMMAND)
{
GC.getCommandInfo((CommandTypes)piIndexList[piOrderedIndex[i]])->setActionInfoIndex(i);
}
else if((ActionSubTypes)piActionInfoTypeList[piOrderedIndex[i]] == ACTIONSUBTYPE_INTERFACEMODE)
{
GC.getInterfaceModeInfo((InterfaceModeTypes)piIndexList[piOrderedIndex[i]])->setActionInfoIndex(i);
}
else if((ActionSubTypes)piActionInfoTypeList[piOrderedIndex[i]] == ACTIONSUBTYPE_BUILD)
{
GC.getBuildInfo((BuildTypes)piIndexList[piOrderedIndex[i]])->setMissionType(GC.getInfoTypeForString("MISSION_BUILD"));
GC.getBuildInfo((BuildTypes)piIndexList[piOrderedIndex[i]])->setActionInfoIndex(i);
}
else if((ActionSubTypes)piActionInfoTypeList[piOrderedIndex[i]] == ACTIONSUBTYPE_PROMOTION)
{
CvPromotionEntry* pkEntry = GC.getPromotionInfo((PromotionTypes)piIndexList[piOrderedIndex[i]]);
pkEntry->SetCommandType(GC.getInfoTypeForString("COMMAND_PROMOTION"));
pkEntry->setActionInfoIndex(i);
CvString strHotKey = pkEntry->CreateHotKeyFromDescription(pkEntry->getHotKey(), pkEntry->isShiftDown(), pkEntry->isAltDown(), pkEntry->isCtrlDown());
pkEntry->setHotKeyDescription(pkEntry->GetDescription(), GC.getCommandInfo((CommandTypes)(pkEntry->GetCommandType()))->GetDescription(), strHotKey);
}
else if((ActionSubTypes)piActionInfoTypeList[piOrderedIndex[i]] == ACTIONSUBTYPE_SPECIALIST)
{
CvSpecialistInfo* pkSpecialist = GC.getSpecialistInfo((SpecialistTypes)piIndexList[piOrderedIndex[i]]);
pkSpecialist->setMissionType(GC.getInfoTypeForString("MISSION_JOIN"));
pkSpecialist->setActionInfoIndex(i);
CvString strHotKey = pkSpecialist->CreateHotKeyFromDescription(pkSpecialist->getHotKey(), pkSpecialist->isShiftDown(), pkSpecialist->isAltDown(), pkSpecialist->isCtrlDown());
pkSpecialist->setHotKeyDescription(pkSpecialist->GetDescription(), GC.getMissionInfo((MissionTypes)(pkSpecialist->getMissionType()))->GetDescription(), strHotKey);
}
else if((ActionSubTypes)piActionInfoTypeList[piOrderedIndex[i]] == ACTIONSUBTYPE_CONTROL)
{
GC.getControlInfo((ControlTypes)piIndexList[piOrderedIndex[i]])->setActionInfoIndex(i);
}
else if((ActionSubTypes)piActionInfoTypeList[piOrderedIndex[i]] == ACTIONSUBTYPE_AUTOMATE)
{
GC.getAutomateInfo(piIndexList[piOrderedIndex[i]])->setActionInfoIndex(i);
}
else if((ActionSubTypes)piActionInfoTypeList[piOrderedIndex[i]] == ACTIONSUBTYPE_MISSION)
{
GC.getMissionInfo((MissionTypes)piIndexList[piOrderedIndex[i]])->setActionInfoIndex(i);
}
GC.getActionInfo().push_back(pActionInfo);
}
SAFE_DELETE_ARRAY(piBuffer);
// SAFE_DELETE_ARRAY(piOrderedIndex);
// SAFE_DELETE_ARRAY(piIndexList);
// SAFE_DELETE_ARRAY(piPriorityList);
// SAFE_DELETE_ARRAY(piActionInfoTypeList);
return true;
}