本文整理汇总了C++中CInstance类的典型用法代码示例。如果您正苦于以下问题:C++ CInstance类的具体用法?C++ CInstance怎么用?C++ CInstance使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CInstance类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: visit
virtual void visit(CInstance &inst)
{
if (inst.getDisplayerVisual())
{
inst.getDisplayerVisual()->updateWorldPos();
}
}
示例2: getGroupingCandidate
//***************************************************************
void CAutoGroup::update(const CVector &testPos, const std::string &paletteEntry, bool valid)
{
//H_AUTO(R2_CAutoGroup_update)
_TestPos = testPos;
_PaletteEntry = paletteEntry;
_AutoGroupEnabled = valid;
CInstance *candidate = getGroupingCandidate();
if (!candidate && _AutoGroup.isAddedToWorldMap())
{
clear();
}
else if (candidate)
{
// update the display
if (!_AutoGroup.isAddedToWorldMap())
{
CGroupMap *gm = CTool::getWorldMap();
if (gm)
{
gm->addDeco(&_AutoGroup);
}
}
CDisplayerVisual *dv = candidate->getDisplayerVisual();
nlassert(dv); // should not be null because getGrou^pingCandidate succeeded
_PrimRenderVertices.resize(2);
CVector pos = dv->isCompound() ? dv->getSon(0)->getWorldPos() : dv->getWorldPos();
_PrimRenderVertices[0] = pos;
_PrimRenderVertices[1] = _TestPos;
_AutoGroup.setVertices(_PrimRenderVertices);
_AutoGroup.addDecalsToRenderList();
}
}
示例3: cancelAction
// ***************************************************************
void CToolSelectRotate::cancelAction(CInstance &instance)
{
//H_AUTO(R2_CToolSelectRotate_cancelAction)
CEntityCL *entity = instance.getEntity();
nlassert(entity);
getEditor().requestRollbackLocalNode(instance.getId(), "Angle");
setRotateInProgress(false, instance);
}
示例4: commitAction
// ***************************************************************
void CToolSelectRotate::commitAction(CInstance &instance)
{
//H_AUTO(R2_CToolSelectRotate_commitAction)
getDMC().newAction(CI18N::get("uiR2EDRotateAction") + instance.getDisplayName());
// nothing to do, entity already has good angle
getEditor().requestCommitLocalNode(instance.getId(), "Angle");
setRotateInProgress(false, instance);
}
示例5: checkMonsterInList
bool CInstanceHandler::checkMonsterInList(CMobEntity* PMob)
{
CInstance* PInstance = m_Instances[0];
if(PInstance->isMonsterInList(PMob))
return true;
else
return false;
}
示例6: dynamisMessage
int CInstanceHandler::dynamisMessage(uint16 Param1, uint16 Param2) {
CInstance* PInstance = m_Instances[0];
PInstance->addTimeLimit(Param2*60);
PInstance->pushMessageToAllInBcnm(Param1,Param2);
return 1;
}
示例7: convertValueToNPVariant
// Variant value must be released with NPReleaseVariantValue()
void convertValueToNPVariant (KJS::ExecState *exec, const KJS::Value &value, NPVariant *result)
{
Type type = value.type();
if (type == StringType) {
UString ustring = value.toString(exec);
CString cstring = ustring.UTF8String();
NPString string = { (const NPUTF8 *)cstring.c_str(), cstring.size() };
NPN_InitializeVariantWithStringCopy (result, &string );
}
else if (type == NumberType) {
NPN_InitializeVariantWithDouble (result, value.toNumber(exec));
}
else if (type == BooleanType) {
NPN_InitializeVariantWithBool (result, value.toBoolean(exec));
}
else if (type == UnspecifiedType) {
NPN_InitializeVariantAsUndefined(result);
}
else if (type == NullType) {
NPN_InitializeVariantAsNull(result);
}
else if (type == ObjectType) {
KJS::ObjectImp *objectImp = static_cast<KJS::ObjectImp*>(value.imp());
if (objectImp->classInfo() == &KJS::RuntimeObjectImp::info) {
KJS::RuntimeObjectImp *imp = static_cast<KJS::RuntimeObjectImp *>(value.imp());
CInstance *instance = static_cast<CInstance*>(imp->getInternalInstance());
NPN_InitializeVariantWithObject (result, instance->getObject());
}
else {
KJS::Interpreter *originInterpreter = exec->interpreter();
const Bindings::RootObject *originExecutionContext = rootForInterpreter(originInterpreter);
KJS::Interpreter *interpreter = 0;
if (originInterpreter->isGlobalObject(value)) {
interpreter = originInterpreter->interpreterForGlobalObject (value.imp());
}
if (!interpreter)
interpreter = originInterpreter;
const Bindings::RootObject *executionContext = rootForInterpreter(interpreter);
if (!executionContext) {
Bindings::RootObject *newExecutionContext = new KJS::Bindings::RootObject(0);
newExecutionContext->setInterpreter (interpreter);
executionContext = newExecutionContext;
}
NPObject *obj = (NPObject *)exec->interpreter()->createLanguageInstanceForValue (exec, Instance::CLanguage, value.toObject(exec), originExecutionContext, executionContext);
NPN_InitializeVariantWithObject (result, obj);
_NPN_ReleaseObject (obj);
}
}
else
NPN_InitializeVariantAsUndefined(result);
}
示例8: insertMonsterInList
void CInstanceHandler::insertMonsterInList(CMobEntity* PMob)
{
CInstance* PInstance = m_Instances[0];
if(PInstance->isMonsterInList(PMob) == false)
{
PInstance->addMonsterInList(PMob);
}
}
示例9: openTreasureChest
void CInstanceHandler::openTreasureChest(CCharEntity* PChar) {
for(int i=0; i<m_MaxInstances; i++) {
if(m_Instances[i] != NULL) {
if(m_Instances[i]->isValidPlayerForBcnm(PChar)) {
CInstance* PInstance = m_Instances[i];
PInstance->OpenChestinBcnm();
}
}
}
}
示例10: getMousePos
// **********************************************
void CToolPick::updateAfterRender()
{
//H_AUTO(R2_CToolPick_updateAfterRender)
// See if the mouse is over a valid position
_ValidPos = false;
sint32 mouseX, mouseY;
getMousePos(mouseX, mouseY);
if (!isInScreen(mouseX, mouseY))
{
getEditor().setFocusedInstance(NULL);
setMouseCursor(_CursCannotPickPos);
return;
}
_CandidateInstance = NULL;
CInstance *instanceUnder = checkInstanceUnderMouse();
bool ignoreInstanceUnder = false;
if(instanceUnder && _IgnoreInstances.size()>0)
{
for(uint i=0; i<_IgnoreInstances.size(); i++)
{
if(instanceUnder->isKindOf(_IgnoreInstances[i]))
{
ignoreInstanceUnder = true;
break;
}
}
}
if (!instanceUnder || ignoreInstanceUnder)
{
if (isMouseOnUI() && !isMouseOnContainer())
{
setMouseCursor(DEFAULT_CURSOR);
}
else
{
CTool::CWorldViewRay worldViewRay;
computeWorldViewRay(mouseX, mouseY, worldViewRay);
CVector inter;
_ValidPos = (ValidPacsPos == computeLandscapeRayIntersection(worldViewRay, _Intersection));
setMouseCursor(_ValidPos ? _CursCanPickPos : _CursCannotPickPos);
getEditor().setFocusedInstance(NULL);
}
return;
}
getEditor().setFocusedInstance(instanceUnder);
if (canPick(*instanceUnder))
{
_CandidateInstance = instanceUnder;
setMouseCursor(_CursCanPickInstance);
}
else
{
setMouseCursor(_CursCannotPickInstance);
}
}
示例11: getDisplayedInstance
//*********************************************************************************************************
CDisplayerVisual *CDisplayerVisualActivitySequence::getParentDV() const
{
//H_AUTO(R2_CDisplayerVisualActivitySequence_getParentDV)
CInstance *currParent = getDisplayedInstance()->getParent();
CDisplayerVisual *prevDV = NULL;
while (currParent)
{
prevDV = currParent->getDisplayerVisual();
if (prevDV) break;
currParent = currParent->getParent();
}
return prevDV;
}
示例12: convertValueToNPVariant
// Variant value must be released with NPReleaseVariantValue()
void convertValueToNPVariant(ExecState *exec, JSValue *value, NPVariant *result)
{
JSLock lock;
JSType type = value->type();
VOID_TO_NPVARIANT(*result);
if (type == StringType) {
UString ustring = value->toString(exec);
CString cstring = ustring.UTF8String();
NPString string = { (const NPUTF8 *)cstring.c_str(), static_cast<uint32_t>(cstring.size()) };
NPN_InitializeVariantWithStringCopy(result, &string);
} else if (type == NumberType) {
DOUBLE_TO_NPVARIANT(value->toNumber(exec), *result);
} else if (type == BooleanType) {
BOOLEAN_TO_NPVARIANT(value->toBoolean(exec), *result);
} else if (type == UnspecifiedType) {
VOID_TO_NPVARIANT(*result);
} else if (type == NullType) {
NULL_TO_NPVARIANT(*result);
} else if (type == ObjectType) {
JSObject* object = static_cast<JSObject*>(value);
if (object->classInfo() == &RuntimeObjectImp::info) {
RuntimeObjectImp* imp = static_cast<RuntimeObjectImp *>(value);
CInstance* instance = static_cast<CInstance*>(imp->getInternalInstance());
if (instance) {
NPObject* obj = instance->getObject();
_NPN_RetainObject(obj);
OBJECT_TO_NPVARIANT(obj, *result);
}
} else {
Interpreter* originInterpreter = exec->dynamicInterpreter();
RootObject* originRootObject = findRootObject(originInterpreter);
Interpreter* interpreter = 0;
if (originInterpreter->isGlobalObject(value)) {
interpreter = originInterpreter->interpreterForGlobalObject(value);
}
if (!interpreter)
interpreter = originInterpreter;
RootObject* rootObject = findRootObject(interpreter);
if (rootObject) {
NPObject* npObject = _NPN_CreateScriptObject(0, object, originRootObject, rootObject);
OBJECT_TO_NPVARIANT(npObject, *result);
}
}
}
}
示例13: DecreaseZoneCounter
void CZoneInstance::DecreaseZoneCounter(CCharEntity* PChar)
{
CInstance* instance = PChar->PInstance;
if (instance)
{
instance->DecreaseZoneCounter(PChar);
instance->DespawnPC(PChar);
CharZoneOut(PChar);
PChar->StatusEffectContainer->DelStatusEffectSilent(EFFECT_LEVEL_RESTRICTION);
PChar->PInstance = nullptr;
if (instance->CharListEmpty())
{
if (instance->Failed() || instance->Completed())
{
instanceList.erase(std::find(instanceList.begin(), instanceList.end(), instance));
delete instance;
}
else
{
instance->SetWipeTime(instance->GetElapsedTime(gettick()));
}
}
}
}
示例14: registerDynamis
int CInstanceHandler::registerDynamis(uint16 id, CCharEntity* PChar) {
if(!hasFreeInstance()) {
return -1;
}
CInstance* PInstance = instanceutils::loadInstance(this,id);
if(PInstance==NULL) {
return -1;
}
for(int i=0; i<m_MaxInstances; i++) {
if(m_Instances[i]==NULL) {
PInstance->setInstanceNumber(i+1);
break;
}
}
if(PInstance->addPlayerToDynamis(PChar)) {
ShowDebug("InstanceHandler ::1 Added %s to the valid players list for Dynamis %i Instance %i \n",
PChar->GetName(),id,PInstance->getInstanceNumber());
}
m_Instances[PInstance->getInstanceNumber()-1] = PInstance;
PInstance->init();
PInstance->setDynaUniqueID();
luautils::OnBcnmRegister(PChar,PInstance);
return PInstance->getInstanceNumber();
}
示例15: DecreaseZoneCounter
void CZoneInstance::DecreaseZoneCounter(CCharEntity* PChar)
{
CInstance* instance = PChar->PInstance;
if (instance)
{
instance->DecreaseZoneCounter(PChar);
instance->DespawnPC(PChar);
CharZoneOut(PChar);
PChar->PInstance = NULL;
if (instance->CharListEmpty())
{
if (instance->Failed() || instance->Completed())
{
instanceList.erase(std::find(instanceList.begin(), instanceList.end(), instance));
delete instance;
}
else
{
instance->SetWipeTime(instance->GetElapsedTime(gettick()));
}
}
}
}