CvDllDatabaseUtility::orderHotkeyInfo(int **, int *, int)
- Defined in
- CvDllDatabaseUtility.cpp, line 1067
- Class
- CvDllDatabaseUtility
- Hook name
CivHooks::CvDllDatabaseUtility_orderHotkeyInfo
Hooks
static bool BeforeCvDllDatabaseUtility_orderHotkeyInfo(CvDllDatabaseUtility* self, int** ppiSortedIndex, int* pHotkeyIndex, int iLength);static void AfterCvDllDatabaseUtility_orderHotkeyInfo(CvDllDatabaseUtility* self, int** ppiSortedIndex, int* pHotkeyIndex, int iLength);static void ReplaceCvDllDatabaseUtility_orderHotkeyInfo(void (*original)(CvDllDatabaseUtility*, int**, int*, int), CvDllDatabaseUtility* self, int** ppiSortedIndex, int* pHotkeyIndex, int iLength);// CivHooks.h gives this hook point no types, so nothing checks these hooks' parameters.host->RegisterHook(host->pluginIndex, CivHooks::CvDllDatabaseUtility_orderHotkeyInfo::ID, CIV_HOOK_BEFORE, (void*)&BeforeCvDllDatabaseUtility_orderHotkeyInfo);host->RegisterHook(host->pluginIndex, CivHooks::CvDllDatabaseUtility_orderHotkeyInfo::ID, CIV_HOOK_AFTER, (void*)&AfterCvDllDatabaseUtility_orderHotkeyInfo);host->RegisterHook(host->pluginIndex, CivHooks::CvDllDatabaseUtility_orderHotkeyInfo::ID, CIV_HOOK_REPLACE, (void*)&ReplaceCvDllDatabaseUtility_orderHotkeyInfo);
Code
1067void CvDllDatabaseUtility::orderHotkeyInfo(int** ppiSortedIndex, int* pHotkeyIndex, int iLength)1068{1069 int iI;1070 int* piSortedIndex;1071 std::vector<OrderIndex> viOrderPriority;10721073 viOrderPriority.resize(iLength);1074 piSortedIndex = *ppiSortedIndex;10751076 // set up vector1077 for(iI=0; iI<iLength; iI++)1078 {1079 viOrderPriority[iI].m_iPriority = pHotkeyIndex[iI];1080 viOrderPriority[iI].m_iIndex = iI;1081 }10821083 // sort the array1084 std::sort(viOrderPriority.begin(), viOrderPriority.end(), sortHotkeyPriority);10851086 // insert new order into the array to return1087 for(iI=0; iI<iLength; iI++)1088 {1089 piSortedIndex[iI] = viOrderPriority[iI].m_iIndex;1090 }1091}
Calls
- sortHotkeyPriority(const OrderIndex &, const OrderIndex &)
std::sortstd::vector::beginstd::vector::endstd::vector::operator[]std::vector::resizestd::vector::vector