当前位置: 首页>>代码示例>>C++>>正文


C++ ManagedReference::get方法代码示例

本文整理汇总了C++中ManagedReference::get方法的典型用法代码示例。如果您正苦于以下问题:C++ ManagedReference::get方法的具体用法?C++ ManagedReference::get怎么用?C++ ManagedReference::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ManagedReference的用法示例。


在下文中一共展示了ManagedReference::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: findStimPack

StimPack* DroidStimpackModuleDataComponent::findStimPack() {
    StimPack* pack = NULL;
    float biggest = 0;
    DroidComponent* container = cast<DroidComponent*>(getParent());
    ManagedReference<SceneObject*> craftingComponents = container->getSlottedObject("crafted_components");
    if(craftingComponents != NULL) {
        SceneObject* satchel = craftingComponents->getContainerObject(0);
        for (int i = 0; i < satchel->getContainerObjectsSize(); ++i) {
            ManagedReference<SceneObject*> sceno = satchel->getContainerObject(i);
            ManagedReference<TangibleObject*> tano = cast<TangibleObject*>(sceno.get());

            if (tano != NULL ) {
                // is a stimpack
                if (tano->isPharmaceuticalObject()) {
                    PharmaceuticalObject* pharma = cast<PharmaceuticalObject*>( tano.get());
                    if (pharma->isStimPack() && !pharma->isPetStimPack() && !pharma->isDroidRepairKit()) {
                        StimPack* stim = cast<StimPack*>(pharma);
                        if (stim->getEffectiveness() > biggest) {
                            biggest = stim->getEffectiveness();
                            pack = stim;
                        }
                    }
                }
            }
        }
    }
    return pack;
}
开发者ID:angelsounds777,项目名称:Core3-CU,代码行数:28,代码来源:DroidStimpackModuleDataComponent.cpp

示例2: getInRangeObjects

int ZoneImplementation::getInRangeObjects(float x, float y, float range, SortedVector<ManagedReference<QuadTreeEntry*> >* objects, bool readLockZone) {
	//Locker locker(_this.getReferenceUnsafeStaticCast());

	bool readlock = readLockZone && !_this.getReferenceUnsafeStaticCast()->isLockedByCurrentThread();

	Vector<ManagedReference<QuadTreeEntry*> > buildingObjects;

//	_this.getReferenceUnsafeStaticCast()->rlock(readlock);

	try {
		_this.getReferenceUnsafeStaticCast()->rlock(readlock);
		
		quadTree->inRange(x, y, range, *objects);
		
		_this.getReferenceUnsafeStaticCast()->runlock(readlock);
	} catch (...) {
		_this.getReferenceUnsafeStaticCast()->runlock(readlock);
	}

		for (int i = 0; i < objects->size(); ++i) {
			SceneObject* sceneObject = cast<SceneObject*>(objects->get(i).get());
			BuildingObject* building = dynamic_cast<BuildingObject*>(sceneObject);

			if (building != NULL) {
				for (int j = 1; j <= building->getMapCellSize(); ++j) {
					CellObject* cell = building->getCell(j);

					if (cell != NULL) {
					try {
							ReadLocker rlocker(cell->getContainerLock());

							for (int h = 0; h < cell->getContainerObjectsSize(); ++h) {
								ManagedReference<SceneObject*> obj = cell->getContainerObject(h);
								
								if (obj != NULL)
									buildingObjects.add(obj.get());
								}
						
						} catch (...) {
					}
					}
				}
			} else if (sceneObject != NULL && (sceneObject->isVehicleObject() || sceneObject->isMount())) {
				ManagedReference<SceneObject*> rider = sceneObject->getSlottedObject("rider");

				if (rider != NULL)
					buildingObjects.add(rider.get());
			}
		}

	//_this.getReferenceUnsafeStaticCast()->runlock(readlock);

	for (int i = 0; i < buildingObjects.size(); ++i)
		objects->put(buildingObjects.get(i));

	return objects->size();
}
开发者ID:angelsounds777,项目名称:Core3-CU,代码行数:57,代码来源:ZoneImplementation.cpp

示例3: handleSlice

void SlicingSessionImplementation::handleSlice(SuiListBox* suiBox) {
	ManagedReference<CreatureObject*> player = this->player.get();
	ManagedReference<TangibleObject*> tangibleObject = this->tangibleObject.get();

	if (player == NULL || tangibleObject == NULL)
		return;

	Locker locker(player);
	Locker clocker(tangibleObject, player);

	PlayerManager* playerManager = player->getZoneServer()->getPlayerManager();

	suiBox->removeAllMenuItems();
	suiBox->setCancelButton(false,"@cancel");

	StringBuffer prompt;
	prompt << "@slicing/slicing:";
	prompt << getPrefix(tangibleObject) + "examine";
	suiBox->setPromptText(prompt.toString());

	player->getPlayerObject()->addSuiBox(suiBox);
	player->sendMessage(suiBox->generateMessage());

	if (tangibleObject->isContainerObject() || tangibleObject->getGameObjectType() == SceneObjectType::PLAYERLOOTCRATE) {
		handleContainerSlice();
		playerManager->awardExperience(player, "slicing", 125, true); // Container Slice XP
	} else	if (tangibleObject->isMissionTerminal()) {
		MissionTerminal* term = cast<MissionTerminal*>( tangibleObject.get());
		playerManager->awardExperience(player, "slicing", 250, true); // Terminal Slice XP
		term->addSlicer(player);
		player->sendSystemMessage("@slicing/slicing:terminal_success");
	} else if (tangibleObject->isWeaponObject()) {
		handleWeaponSlice();
		playerManager->awardExperience(player, "slicing", 500, true); // Weapon Slice XP
	} else if (tangibleObject->isArmorObject()) {
		handleArmorSlice();
		playerManager->awardExperience(player, "slicing", 1000, true); // Armor Slice XP
	} else if ( isBaseSlice()){
		playerManager->awardExperience(player,"slicing", 1000, true); // Base slicing

		Zone* zone = player->getZone();

		if(zone != NULL){
			GCWManager* gcwMan = zone->getGCWManager();

			if(gcwMan != NULL){
				SecuritySliceTask* task = new SecuritySliceTask(gcwMan, tangibleObject.get(), player);
				task->execute();
			}
		}

	}

	endSlicing();

}
开发者ID:Mesagoppinmypants,项目名称:mtgtestserver,代码行数:56,代码来源:SlicingSessionImplementation.cpp

示例4: broadcastMessage

void InstallationObjectImplementation::broadcastMessage(BasePacket* message, bool sendSelf) {
	Zone* zone = getZone();

	if (zone == NULL)
		return;

	Locker zoneLocker(zone);

	SortedVector<ManagedReference<QuadTreeEntry*> > closeSceneObjects;
	zone->getInRangeObjects(getPositionX(), getPositionY(), 512, &closeSceneObjects, false);

	for (int i = 0; i < closeSceneObjects.size(); ++i) {
		ManagedReference<SceneObject*> scno = cast<SceneObject*>( closeSceneObjects.get(i).get());

		if (!sendSelf && scno == _this.get())
			continue;

		if(!scno->isPlayerCreature())
			continue;

		CreatureObject* creo = cast<CreatureObject*>( scno.get());

		if(isOnAdminList(creo))
			scno->sendMessage(message->clone());
	}

	delete message;
}
开发者ID:Chilastra-Reborn,项目名称:Chilastra-source-code,代码行数:28,代码来源:InstallationObjectImplementation.cpp

示例5: setTrainingCommand

void PetControlDeviceImplementation::setTrainingCommand( unsigned int commandID ){

	ManagedReference<TangibleObject*> controlledObject = this->controlledObject.get();
	if (controlledObject == NULL || !controlledObject->isAiAgent())
		return;

	AiAgent* pet = cast<AiAgent*>(controlledObject.get());
	if( pet == NULL )
		return;

	// Check power on droids
	if( petType == PetManager::DROIDPET) {
		ManagedReference<DroidObject*> droid = this->controlledObject.get().castTo<DroidObject*>();
		if (droid == NULL)
			return;

		if( !droid->hasPower() ){
			droid->showFlyText("npc_reaction/flytext","low_power", 204, 0, 0);  // "*Low Power*"
			return;
		}
	}

	trainingCommand = commandID;
	pet->showFlyText("npc_reaction/flytext","alert", 204, 0, 0);  // "?"

}
开发者ID:KiritoShadowfang,项目名称:Core3,代码行数:26,代码来源:PetControlDeviceImplementation.cpp

示例6: getParent

ManagedWeakReference<SceneObject*> SceneObjectImplementation::getRootParent() {
	ManagedReference<SceneObject*> grandParent = getParent();
	ManagedReference<SceneObject*> tempParent = NULL;

	if (grandParent == NULL)
		return NULL;

#ifdef DEBUG_GETROOT_PARENT
	SortedVector<ManagedReference<SceneObject*> > parents;
	parents.setNoDuplicateInsertPlan();
#endif

	while ((tempParent = grandParent->getParent()) != NULL && grandParent != asSceneObject()) {
		grandParent = tempParent;

#ifdef DEBUG_GETROOT_PARENT
		if (parents.contains(grandParent))
			return NULL;
		else
			parents.put(grandParent);
#endif
	}

	if (grandParent == asSceneObject())
		return NULL;

	ManagedWeakReference<SceneObject*> weak = grandParent.get();

	return weak;
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:30,代码来源:SceneObjectImplementation.cpp

示例7: storeObject

void PetControlDeviceImplementation::storeObject(CreatureObject* player, bool force) {
	ManagedReference<TangibleObject*> controlledObject = this->controlledObject.get();

	if (controlledObject == NULL || !controlledObject->isAiAgent())
		return;

	ManagedReference<AiAgent*> pet = cast<AiAgent*>(controlledObject.get());

	assert(pet->isLockedByCurrentThread());

	if (!force && (pet->isInCombat() || player->isInCombat()))
		return;

	if (player->isRidingMount() && player->getParent() == pet) {

		if (!force && !player->checkCooldownRecovery("mount_dismount"))
			return;

		player->executeObjectControllerAction(STRING_HASHCODE("dismount"));

		if (player->isRidingMount())
			return;
	}

	if( player->getCooldownTimerMap() == NULL )
		return;

	// Check cooldown
	if( !player->getCooldownTimerMap()->isPast("petCallOrStoreCooldown") && !force ){
		player->sendSystemMessage("@pet/pet_menu:cant_store_1sec"); //"You cannot STORE for 1 second."
		return;
	}

	// Not training any commands
	trainingCommand = 0;

	Reference<StorePetTask*> task = new StorePetTask(player, pet);

	// Store non-faction pets immediately.  Store faction pets after 60sec delay.
	if( petType != PetManager::FACTIONPET || force || player->getPlayerObject()->isPrivileged()){
		task->execute();
	}
	else{
		if(pet->getPendingTask("store_pet") == NULL) {
			player->sendSystemMessage( "Storing pet in 60 seconds");
			pet->addPendingTask("store_pet", task, 60 * 1000);
		}
		else{
			Time nextExecution;
			Core::getTaskManager()->getNextExecutionTime(pet->getPendingTask("store_pet"), nextExecution);
			int timeLeft = (nextExecution.getMiliTime() / 1000) - System::getTime();
			player->sendSystemMessage( "Pet will store in " + String::valueOf(timeLeft) + " seconds." );
			return;
		}

	}

	// Set cooldown
	player->getCooldownTimerMap()->updateToCurrentAndAddMili("petCallOrStoreCooldown", 1000); // 1 sec
}
开发者ID:angelsounds777,项目名称:Core3-CU,代码行数:60,代码来源:PetControlDeviceImplementation.cpp

示例8: notifyInsertToZone

void JukeboxImplementation::notifyInsertToZone(Zone* zone) {
	ManagedReference<Jukebox*> jbox = _this.getReferenceUnsafeStaticCast();

	Locker _lock(jbox);

	createChildObjects();

	ManagedReference<JukeboxObserver*> observer = new JukeboxObserver(jbox);

	jbox->registerObserver(ObserverEventType::PARENTCHANGED, observer);

	ManagedReference<SceneObject*> obj = jbox->getRootParent().get();

	if (obj == NULL || !obj->isStructureObject())
		setRadius(100);
	else
		setRadius(30);

	SortedVector<ManagedReference<SceneObject*> >* children = jbox->getChildObjects();

	for (int i = 0; i < children->size(); ++i) {
		ManagedReference<SceneObject*> child = children->get(i);

		if (child != NULL && child->isActiveArea()) {
			ManagedReference<ActiveArea*> area = cast<ActiveArea*>(child.get());
			area->registerObserver(ObserverEventType::ENTEREDAREA, observer);
			area->registerObserver(ObserverEventType::EXITEDAREA, observer);
		}
	}
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:30,代码来源:JukeboxImplementation.cpp

示例9: handleObjectMenuSelect

int RingObjectMenuComponent::handleObjectMenuSelect(SceneObject* sceneObject, CreatureObject* player, byte selectedID) const {
	if (selectedID == 22) { // Propose Unity
		if (!sceneObject->isASubChildOf(player))
			return 0;

		ManagedReference<SceneObject*> target = player->getZoneServer()->getObject(player->getTargetID());

		if (target != NULL && target->isPlayerCreature()) {
			PlayerManager* playerManager = player->getZoneServer()->getPlayerManager();

			if (playerManager != NULL)
				playerManager->proposeUnity(player, cast<CreatureObject*>(target.get()), sceneObject);

			return 0;
		} else {
			player->sendSystemMessage("@unity:bad_target"); // "You must have a valid player target to Propose Unity."
			return 0;
		}

	} else if (selectedID == 234) { // Divorce
		if (!sceneObject->isASubChildOf(player))
			return 0;

		PlayerManager* playerManager = player->getZoneServer()->getPlayerManager();

		if (playerManager != NULL)
			playerManager->promptDivorce(player);

		return 0;
	}

	return TangibleObjectMenuComponent::handleObjectMenuSelect(sceneObject, player, selectedID);
}
开发者ID:ModTheGalaxy,项目名称:mtgserver,代码行数:33,代码来源:RingObjectMenuComponent.cpp

示例10: run

void DelegateSuiCallback::run(CreatureObject* creature, SuiBox* sui, uint32 eventIndex, Vector<UnicodeString>* args) {
	bool cancelPressed = (eventIndex == 1);

	if (!sui->isTransferBox() || cancelPressed)
		return;

	uint32 received = Integer::valueOf(args->get(0).toString());
	uint32 tipAmount = Integer::valueOf(args->get(1).toString());

	//printf("received %d transferred %d\n", received, transferred);

	if (tipAmount == 0)
		return;

	ManagedReference<SceneObject*> usingObject = sui->getUsingObject().get();

	if (usingObject == NULL || !usingObject->isPlayerCreature()) {
		return;
	}

	CreatureObject* targetPlayer = cast<CreatureObject*>(usingObject.get());

	if (targetPlayer == NULL)
		return;

	DelegateFactionPointsCommand::doDelegate(creature, targetPlayer, tipAmount);
}
开发者ID:ModTheGalaxy,项目名称:mtgserver,代码行数:27,代码来源:DelegateSuiCallback.cpp

示例11: addRegion

Region* CityRegionImplementation::addRegion(float x, float y, float radius, bool persistent) {
	if (zone == NULL) {
		return NULL;
	}

	static const String temp = "object/region_area.iff";
	ManagedReference<SceneObject*> obj = zone->getZoneServer()->createObject(temp.hashCode(), persistent ? 1 : 0);

	if (obj == NULL || !obj->isRegion()) {
		return NULL;
	}
	
	Locker clocker(obj, _this.getReferenceUnsafeStaticCast());

	ManagedReference<Region*> region = cast<Region*>(obj.get());
	region->setCityRegion(_this.getReferenceUnsafeStaticCast());
	region->setRadius(radius);
	region->initializePosition(x, 0, y);
	region->setObjectName(regionName, false);

	if (isClientRegion())
		region->setNoBuildArea(true);

	zone->transferObject(region, -1, false);

	regions.put(region);

	return region;
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:29,代码来源:CityRegionImplementation.cpp

示例12: addDamage

void ThreatMap::addDamage(CreatureObject* target, uint32 damage, String xp) {
	Locker locker(&lockMutex);

	ManagedReference<TangibleObject*> strongSelf = self.get();
	if (strongSelf == NULL || strongSelf.get() == target)
		return;

	int idx = find(target);
	String xpToAward = "";

	if (xp == "") {
		WeaponObject* weapon = target->getWeapon();
		xpToAward = weapon->getXpType();
	} else
		xpToAward = xp;

	if (idx == -1) {
		ThreatMapEntry entry;
		entry.addDamage(xpToAward, damage);
		entry.addAggro(1);

		put(target, entry);
		registerObserver(target);

	} else {
		ThreatMapEntry* entry = &elementAt(idx).getValue();
		entry->addDamage(xpToAward, damage);
		entry->addAggro(1);
	}
}
开发者ID:JigglyPoofSWG,项目名称:BSS,代码行数:30,代码来源:ThreatMap.cpp

示例13: hasPrecisionLaserKnife

bool SlicingSessionImplementation::hasPrecisionLaserKnife(bool removeItem) {
	ManagedReference<CreatureObject*> player = this->player.get();
	ManagedReference<TangibleObject*> tangibleObject = this->tangibleObject.get();

	if (player == NULL)
		return 0;

	ManagedReference<SceneObject*> inventory = player->getSlottedObject("inventory");

	if (inventory == NULL)
		return false;

	Locker inventoryLocker(inventory);

	for (int i = 0; i < inventory->getContainerObjectsSize(); ++i) {
		ManagedReference<SceneObject*> sceno = inventory->getContainerObject(i);

		uint32 objType = sceno->getGameObjectType();

		if (objType == SceneObjectType::LASERKNIFE) {
			PrecisionLaserKnife* knife = cast<PrecisionLaserKnife*>( sceno.get());
			if (removeItem) {
				Locker locker(knife);
				knife->useCharge(player);
			}
			return 1;
		}
	}

	return 0;

}
开发者ID:Mesagoppinmypants,项目名称:mtgtestserver,代码行数:32,代码来源:SlicingSessionImplementation.cpp

示例14:

Reference<SceneObject*> PlanetManagerImplementation::createTicket(const String& departurePoint, const String& arrivalPlanet, const String& arrivalPoint) {
	ManagedReference<SceneObject*> obj = server->getZoneServer()->createObject(STRING_HASHCODE("object/tangible/travel/travel_ticket/base/base_travel_ticket.iff"), 1);

	if (obj == NULL)
		return NULL;

	if (!obj->isTangibleObject()) {
		obj->destroyObjectFromDatabase(true);
		return NULL;
	}

	TangibleObject* tano = cast<TangibleObject*>( obj.get());

	if (!tano->isTicketObject()) {
		tano->destroyObjectFromDatabase(true);
		return NULL;
	}

	TicketObject* ticket = cast<TicketObject*>( tano);
	ticket->setDeparturePlanet(zone->getZoneName());
	ticket->setDeparturePoint(departurePoint);
	ticket->setArrivalPlanet(arrivalPlanet);
	ticket->setArrivalPoint(arrivalPoint);

	return ticket;
}
开发者ID:Mesagoppinmypants,项目名称:mtgtestserver,代码行数:26,代码来源:PlanetManagerImplementation.cpp

示例15: createCreature

CreatureObject* CreatureManagerImplementation::createCreature(uint32 templateCRC,  bool persistent, uint32 mobileTemplateCRC) {
	ManagedReference<SceneObject*> object = zoneServer->createObject(templateCRC, persistent);

	if (object == NULL) {
		StringBuffer errMsg;
		errMsg << "could not spawn creature... wrong template? 0x" << hex << templateCRC;

		error(errMsg.toString());

		return NULL;
	}

	if (!object->isCreatureObject()) {
		StringBuffer errMsg;
		errMsg << "server did not create a creature object wrong template? 0x" << hex << templateCRC;

		error(errMsg.toString());

		return NULL;
	}

	CreatureObject* creature = cast<CreatureObject*>( object.get());

	if (!createCreatureChildrenObjects(creature, templateCRC, creature->isPersistent(), mobileTemplateCRC)) {
		StringBuffer errMsg;
		errMsg << "could not create children objects for creature... 0x" << templateCRC;
		error(errMsg.toString());

		return NULL;
	}

	return creature;
}
开发者ID:SWGChoice,项目名称:Core3,代码行数:33,代码来源:CreatureManagerImplementation.cpp


注:本文中的ManagedReference::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。