本文整理汇总了C++中CALL_MEMBER_FN函数的典型用法代码示例。如果您正苦于以下问题:C++ CALL_MEMBER_FN函数的具体用法?C++ CALL_MEMBER_FN怎么用?C++ CALL_MEMBER_FN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CALL_MEMBER_FN函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DYNAMIC_CAST
void TESObjectARMA::GetNodeName(char * dstBuff, TESObjectREFR * refr, TESObjectARMO * armor, float weightOverride)
{
float weight = 100.0;
TESNPC * npc = DYNAMIC_CAST(refr->baseForm, TESForm, TESNPC);
if(npc && npc->nextTemplate) {
TESNPC * temp = npc->GetRootTemplate();
if(temp) {
weight = temp->weight;
}
}
else
weight = CALL_MEMBER_FN(refr, GetWeight)();
weight /= 100.0;
if(weightOverride >= 0.0) // Determines whether to factor weight into the name, -1 true, 1 false
weight = weightOverride;
weight *= 100.0;
UInt32 sex = npc ? CALL_MEMBER_FN(npc, GetSex)() : 0;
/*sprintf_s(dstBuff, MAX_PATH, "%s (%08X)[%d]/%s (%08X) [%2.0f%%]",
this->Unk_32(), // I really have no idea why they used a string here for a boolean value, probably legacy code
this->formID,
sex,
armor->Unk_32(),
armor->formID,
weight);*/
sprintf_s(dstBuff, MAX_PATH, " (%08X)[%d]/ (%08X) [%2.0f%%]",
this->formID,
sex,
armor->formID,
weight);
}
示例2: CALL_MEMBER_FN
void CPWToolBar::SetupImageList(const GuiRecord *guiInfo,
GuiRecordGetter GetBM, GuiRecordGetter GetDisBM,
const int numBMs, const int nImageList)
{
// See http://www.parashift.com/c++-faq/macro-for-ptr-to-memfn.html
#define CALL_MEMBER_FN(object,ptrToMember) ((object).*(ptrToMember))
const COLORREF crCOLOR_3DFACE = GetSysColor(COLOR_3DFACE);
CBitmap bmNormal, bmDisabled;
for (int i = 0; i < numBMs; i++) {
UINT bmID = CALL_MEMBER_FN(guiInfo[i], GetBM)();
if (bmID == 0)
continue; // skip over separator
BOOL brc = bmNormal.Attach(::LoadImage(::AfxFindResourceHandle(MAKEINTRESOURCE(bmID), RT_BITMAP),
MAKEINTRESOURCE(bmID), IMAGE_BITMAP, 0, 0,
(LR_DEFAULTSIZE | LR_CREATEDIBSECTION)));
ASSERT(brc);
SetBitmapBackground(bmNormal, crCOLOR_3DFACE);
m_ImageLists[nImageList].Add(&bmNormal, crCOLOR_3DFACE);
bmNormal.DeleteObject();
if (nImageList != 0) {
bmID = CALL_MEMBER_FN(guiInfo[i], GetDisBM)();
bmDisabled.Attach(::LoadImage(::AfxFindResourceHandle(MAKEINTRESOURCE(bmID), RT_BITMAP),
MAKEINTRESOURCE(bmID), IMAGE_BITMAP, 0, 0,
(LR_DEFAULTSIZE | LR_CREATEDIBSECTION)));
SetBitmapBackground(bmDisabled, crCOLOR_3DFACE);
m_DisabledImageLists[nImageList - 1].Add(&bmDisabled, crCOLOR_3DFACE);
bmDisabled.DeleteObject();
}
}
}
示例3: UpdateItemAbility
void UpdateItemAbility(Actor * actor, TESForm* baseForm, BaseExtraList * extraData, bool bLeftHand)
{
if(actor && baseForm) {
if(baseForm->formType == TESObjectWEAP::kTypeID)
CALL_MEMBER_FN(actor, UpdateWeaponAbility)(baseForm, extraData, bLeftHand);
else if(baseForm->formType == TESObjectARMO::kTypeID)
CALL_MEMBER_FN(actor, UpdateArmorAbility)(baseForm, extraData);
}
}
示例4: CALL_MEMBER_FN
void Script::RunScriptLine(const char * text, TESObjectREFR * object)
{
ConsoleManager * consoleManager = ConsoleManager::GetSingleton();
UInt8 scriptBuf[sizeof(Script)];
Script * script = (Script *)scriptBuf;
CALL_MEMBER_FN(script, Constructor)();
CALL_MEMBER_FN(script, MarkAsTemporary)();
CALL_MEMBER_FN(script, SetText)(text);
CALL_MEMBER_FN(script, Run)(consoleManager->scriptContext, true, object);
CALL_MEMBER_FN(script, Destructor)();
}
示例5: CreateEnchantment
void CreateEnchantment(TESForm* baseForm, BaseExtraList * extraData, float maxCharge, VMArray<EffectSetting*> effects, VMArray<float> magnitudes, VMArray<UInt32> areas, VMArray<UInt32> durations)
{
if(baseForm && (baseForm->formType == TESObjectWEAP::kTypeID || baseForm->formType == TESObjectARMO::kTypeID)) {
EnchantmentItem * enchantment = NULL;
if(effects.Length() > 0 && magnitudes.Length() == effects.Length() && areas.Length() == effects.Length() && durations.Length() == effects.Length()) {
tArray<MagicItem::EffectItem> effectItems;
effectItems.Allocate(effects.Length());
UInt32 j = 0;
for(UInt32 i = 0; i < effects.Length(); i++) {
EffectSetting * magicEffect = NULL;
effects.Get(&magicEffect, i);
if(magicEffect) { // Only add effects that actually exist
magnitudes.Get(&effectItems[j].magnitude, i);
areas.Get(&effectItems[j].area, i);
durations.Get(&effectItems[j].duration, i);
effectItems[j].mgef = magicEffect;
j++;
}
}
effectItems.count = j; // Set count to existing count
if(baseForm->formType == TESObjectWEAP::kTypeID)
enchantment = CALL_MEMBER_FN(PersistentFormManager::GetSingleton(), CreateOffensiveEnchantment)(&effectItems);
else
enchantment = CALL_MEMBER_FN(PersistentFormManager::GetSingleton(), CreateDefensiveEnchantment)(&effectItems);
FormHeap_Free(effectItems.arr.entries);
}
if(enchantment) {
if(maxCharge > 0xFFFF) // Charge exceeds uint16 clip it
maxCharge = 0xFFFF;
ExtraEnchantment* extraEnchant = static_cast<ExtraEnchantment*>(extraData->GetByType(kExtraData_Enchantment));
if(extraEnchant) {
PersistentFormManager::GetSingleton()->DecRefEnchantment(extraEnchant->enchant);
extraEnchant->enchant = enchantment;
PersistentFormManager::GetSingleton()->IncRefEnchantment(extraEnchant->enchant);
extraEnchant->maxCharge = (UInt16)maxCharge;
} else {
ExtraEnchantment* extraEnchant = ExtraEnchantment::Create();
extraEnchant->enchant = enchantment;
extraEnchant->maxCharge = (UInt16)maxCharge;
extraData->Add(kExtraData_Enchantment, extraEnchant);
}
}
}
}
示例6: UpdateItem3D
void UpdateItem3D(const FxDelegateArgs & params)
{
if(params.menu) {
UInt32 formId = (UInt32)params.args->GetNumber();
if(formId) {
TESForm * form = LookupFormByID(formId);
if(form) {
CALL_MEMBER_FN(Inventory3DManager::GetSingleton(), UpdateMagic3D)(form, 0);
}
} else {
CALL_MEMBER_FN(Inventory3DManager::GetSingleton(), Clear3D)();
}
}
}
示例7: CreateFormInstance
TESForm * TESForm::CloneForm(bool persist) const
{
TESForm * result = CreateFormInstance(typeID);
if(result)
{
result->CopyFrom(this);
CALL_MEMBER_FN(DataHandler::Get(), DoAddForm)(result);
if(persist)
{
CALL_MEMBER_FN(TESSaveLoadGame::Get(), AddCreatedForm)(result);
}
}
return result;
}
示例8: out
void
slice_set::write_general(const string& file, const string& title,
print_fn fun, vm::all *all) const
{
ofstream out(file.c_str(), ios_base::out | ios_base::trunc);
write_header(out, title, all);
vector<iter> iters(all->NUM_THREADS, iter());
assert(slices.size() == all->NUM_THREADS);
for(size_t i(0); i < all->NUM_THREADS; ++i) {
assert(num_slices == slices[i].size());
iters[i] = slices[i].begin();
}
for(size_t slice(0); slice < num_slices; ++slice) {
csv_line line;
line << to_string<unsigned long>(slice * SLICE_PERIOD);
for(size_t proc(0); proc < all->NUM_THREADS; ++proc) {
assert(iters[proc] != slices[proc].end());
const statistics::slice& sl(*iters[proc]);
CALL_MEMBER_FN(sl, fun)(line);
iters[proc]++;
}
line.print(out);
}
}
示例9: Cmd_SetCellResetHours_Execute
static bool Cmd_SetCellResetHours_Execute(COMMAND_ARGS)
{
// specifies # of hours from now until cell reset
*result = 0;
TESObjectCELL* cell = NULL;
UInt32 numHours = -1;
if (ExtractArgs(PASS_EXTRACT_ARGS, &cell, &numHours) && cell && numHours != -1)
{
if (cell->IsInterior() && cell != (*g_thePlayer)->parentCell)
{
SInt32 iHoursToRespawn = TimeGlobals::HoursToRespawnCell();
SInt32 iHoursPassed = TimeGlobals::GameHoursPassed();
SInt32 detachTime = iHoursPassed + numHours - iHoursToRespawn;
if (detachTime < iHoursPassed)
{
*result = 1;
CALL_MEMBER_FN(cell, SetDetachTime)(detachTime);
if (IsConsoleMode())
Console_Print("Current hours passed :%d Detach time: %d", iHoursPassed, detachTime);
}
else if (IsConsoleMode())
Console_Print("Detach time %d cannot be greater than current hours passed %d", detachTime, iHoursPassed);
}
}
return true;
}
示例10: _MESSAGE
bool BGSSaveLoadManager::LoadGame_Hook(const char * saveName, bool unk1)
{
#ifdef DEBUG
_MESSAGE("Executing BGSSaveLoadManager::LoadGame_Hook. saveName: %s", saveName);
#endif
FriendLink::PreLoadGame();
g_loadGameLock.Enter();
Serialization::SetSaveName(saveName);
PluginManager::Dispatch_Message(0, SKSEMessagingInterface::kMessage_PreLoadGame, (void*)saveName, strlen(saveName), NULL);
bool result = CALL_MEMBER_FN(this, LoadGame_HookTarget)(saveName, unk1);
PluginManager::Dispatch_Message(0, SKSEMessagingInterface::kMessage_PostLoadGame, (void*)result, 1, NULL);
Serialization::SetSaveName(NULL);
g_loadGameLock.Leave();
// Clear invalid handles in OnUpdate event registration list
UInt32 enableClearRegs = 0;
if (GetConfigOption_UInt32("General", "ClearInvalidRegistrations", &enableClearRegs))
{
if (enableClearRegs)
{
UInt32 count = (*g_skyrimVM)->ClearInvalidRegistrations();
if (count > 0)
_MESSAGE("ClearInvalidRegistrations: Removed %d invalid OnUpdate registration(s)", count);
}
}
#ifdef DEBUG
_MESSAGE("Executed BGSSaveLoadManager::LoadGame_Hook.");
#endif
return result;
}
示例11: QueueNiNodeUpdate
void QueueNiNodeUpdate(Actor* thisActor)
{
Character * pChar = DYNAMIC_CAST(thisActor, Actor, Character);
if(pChar) {
CALL_MEMBER_FN(pChar, QueueNiNodeUpdate)(false); // False makes this allow weapons to not be auto holstered apparently
}
}
示例12: CALL_MEMBER_FN
std::vector<float> physics::K1(float t, const std::vector<float>& x)
{
if(!RKfunc)
throw std::logic_error("physics::K1(float, const std::vector<float>&): RKfunc is NULL");
return CALL_MEMBER_FN(*this,RKfunc)(t,x);
}
示例13: CALL_MEMBER_FN
void CustomMenu::Render()
{
if(view) {
view->Render();
CALL_MEMBER_FN(Inventory3DManager::GetSingleton(), Render)();
}
}
示例14: CALL_MEMBER_FN
void TESForm::DoAddForm(TESForm* newForm, bool persist, bool record) const
{
CALL_MEMBER_FN(DataHandler::Get(), DoAddForm)(newForm);
if(persist)
{
// Only some forms can be safely saved as SaveForm. ie TESPackage at the moment.
bool canSave = false;
TESPackage* package = DYNAMIC_CAST(newForm, TESForm, TESPackage);
if (package)
canSave = true;
// ... more ?
if (canSave)
CALL_MEMBER_FN(TESSaveLoadGame::Get(), AddCreatedForm)(newForm);
}
}
示例15: ThisStdCall
TESObjectREFR* TESObjectREFR::Create(bool bTemp)
{
TESObjectREFR* refr = (TESObjectREFR*)FormHeap_Allocate(sizeof(TESObjectREFR));
ThisStdCall(s_TESObject_REFR_init, refr);
if (bTemp)
CALL_MEMBER_FN(refr, MarkAsTemporary);
return refr;
}