本文整理汇总了C++中ManagedReference::containsChildObject方法的典型用法代码示例。如果您正苦于以下问题:C++ ManagedReference::containsChildObject方法的具体用法?C++ ManagedReference::containsChildObject怎么用?C++ ManagedReference::containsChildObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ManagedReference
的用法示例。
在下文中一共展示了ManagedReference::containsChildObject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: destroyAllPlayerItems
void CellObjectImplementation::destroyAllPlayerItems() {
ManagedReference<SceneObject*> strongParent = getParent().get();
if (strongParent == NULL)
return;
int containerSize = getContainerObjectsSize();
for (int j = containerSize - 1; j >= 0; --j) {
ReadLocker rlocker(getContainerLock());
ManagedReference<SceneObject*> containerObject = getContainerObject(j);
rlocker.release();
if (strongParent->containsChildObject(containerObject))
continue;
if (containerObject->isCreatureObject())
continue;
containerObject->destroyObjectFromWorld(true);
//containerObject->broadcastDestroy(containerObject, false);
//removeObject(containerObject, false);
containerObject->destroyObjectFromDatabase(true);
}
}
示例2: moveFirstItemTo
void StructureManager::moveFirstItemTo(CreatureObject* creature,
StructureObject* structure) {
if (!structure->isBuildingObject())
return;
ManagedReference<BuildingObject*> building =
cast<BuildingObject*>(structure);
Locker _lock(building, creature);
for (uint32 i = 1; i <= building->getTotalCellNumber(); ++i) {
ManagedReference<CellObject*> cell = building->getCell(i);
int size = cell->getContainerObjectsSize();
for (int j = 0; j < cell->getContainerObjectsSize(); ++j) {
ReadLocker rlocker(cell->getContainerLock());
ManagedReference<SceneObject*> childObject =
cell->getContainerObject(j);
rlocker.release();
if (childObject->isVendor())
continue;
//if (!building->containsChildObject(childObject) && !childObject->isCreatureObject()) {
if (creature->getParent() != NULL
&& !building->containsChildObject(childObject)
&& !childObject->isCreatureObject()) {
if (creature->getParent().get()->getParent().get()
== childObject->getParent().get()->getParent().get()) {
childObject->teleport(creature->getPositionX(),
creature->getPositionZ(), creature->getPositionY(),
creature->getParentID());
creature->sendSystemMessage(
"@player_structure:moved_first_item"); //The first item in your house has been moved to your location.
}
return;
}
}
}
}
示例3: getCurrentNumberOfPlayerItems
int CellObjectImplementation::getCurrentNumberOfPlayerItems() {
int count = 0;
ManagedReference<SceneObject*> strongParent = getParent().get();
if (strongParent != NULL) {
for (int j = 0; j < getContainerObjectsSize(); ++j) {
ReadLocker rlocker(getContainerLock());
ManagedReference<SceneObject*> containerObject = getContainerObject(j);
rlocker.release();
if (!strongParent->containsChildObject(containerObject) && !containerObject->isCreatureObject() && !containerObject->isVendor()) {
if (containerObject->isContainerObject())
count += containerObject->getCountableObjectsRecursive();
++count;
}
}
}
return count;
}
示例4: transferObject
bool ZoneContainerComponent::transferObject(SceneObject* sceneObject, SceneObject* object, int containmentType, bool notifyClient, bool allowOverflow, bool notifyRoot) {
Zone* newZone = dynamic_cast<Zone*>(sceneObject);
Zone* zone = object->getZone();
if (object->isActiveArea())
return insertActiveArea(newZone, dynamic_cast<ActiveArea*>(object));
Locker zoneLocker(newZone);
if (object->isInQuadTree() && newZone != zone) {
object->error("trying to insert to zone an object that is already in a different quadtree");
object->destroyObjectFromWorld(true);
return false;
//StackTrace::printStackTrace();
}
ManagedReference<SceneObject*> parent = object->getParent().get();
if (parent != NULL/* && parent->isCellObject()*/) {
uint64 parentID = object->getParentID();
if (containmentType == -2)
parent->removeObject(object, sceneObject, false);
else
parent->removeObject(object, sceneObject, true);
if (object->getParent() != NULL && parent->containsChildObject(object))
return false;
else
object->setParent(NULL);
if (parent->isCellObject()) {
ManagedReference<BuildingObject*> build = cast<BuildingObject*>(parent->getParent().get().get());
if (build != NULL) {
CreatureObject* creature = cast<CreatureObject*>(object);
if (creature != NULL)
build->onExit(creature, parentID);
}
}
} else {
object->setParent(NULL);
}
object->setZone(newZone);
zone = newZone;
zone->addSceneObject(object);
if (notifyClient)
object->sendToOwner(true);
if (parent == NULL)
object->initializePosition(object->getPositionX(), object->getPositionZ(), object->getPositionY());
zone->insert(object);
zone->inRange(object, ZoneServer::CLOSEOBJECTRANGE);
if (object->isTangibleObject()) {
TangibleObject* tano = cast<TangibleObject*>(object);
zone->updateActiveAreas(tano);
}
SharedBuildingObjectTemplate* objtemplate = dynamic_cast<SharedBuildingObjectTemplate*>(object->getObjectTemplate());
if (objtemplate != NULL) {
String modFile = objtemplate->getTerrainModificationFile();
if (!modFile.isEmpty()) {
newZone->getPlanetManager()->getTerrainManager()->addTerrainModification(object->getWorldPositionX(), object->getWorldPositionY(), modFile, object->getObjectID());
}
}
object->notifyInsertToZone(zone);
return true;
}