本文整理汇总了C++中Zone::inRange方法的典型用法代码示例。如果您正苦于以下问题:C++ Zone::inRange方法的具体用法?C++ Zone::inRange怎么用?C++ Zone::inRange使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zone
的用法示例。
在下文中一共展示了Zone::inRange方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: updateZone
void ZoneComponent::updateZone(SceneObject* sceneObject, bool lightUpdate, bool sendPackets) {
ManagedReference<SceneObject*> parent = sceneObject->getParent();
Zone* zone = sceneObject->getZone();
ManagedReference<SceneObject*> sceneObjectRootParent = sceneObject->getRootParent();
if (zone == NULL) {
if (sceneObjectRootParent == NULL)
return;
zone = sceneObjectRootParent->getZone();
}
if (parent != NULL && (parent->isVehicleObject() || parent->isMount()))
sceneObject->updateVehiclePosition(sendPackets);
Locker _locker(zone);
bool zoneUnlocked = false;
if (parent != NULL && parent->isCellObject()) {
//parent->removeObject(sceneObject, true);
//removeFromBuilding(sceneObject, dynamic_cast<BuildingObject*>(parent->getParent()));
zone = parent->getRootParent().get()->getZone();
zone->transferObject(sceneObject, -1, false);
zone->unlock();
} else {
if (sceneObject->getLocalZone() != NULL) {
zone->update(sceneObject);
zone->unlock();
zone->inRange(sceneObject, 192);
} else if (parent != NULL) {
zone->unlock();
updateInRangeObjectsOnMount(sceneObject);
}
}
zone->updateActiveAreas(sceneObject);
bool isInvis = false;
if (sceneObject->isCreatureObject()) {
CreatureObject* creo = cast<CreatureObject*>(sceneObject);
if(creo->isInvisible())
isInvis = true;
}
if (!isInvis && sendPackets && (parent == NULL || (!parent->isVehicleObject() && !parent->isMount()))) {
if (lightUpdate) {
LightUpdateTransformMessage* message = new LightUpdateTransformMessage(sceneObject);
sceneObject->broadcastMessage(message, false, true);
} else {
UpdateTransformMessage* message = new UpdateTransformMessage(sceneObject);
sceneObject->broadcastMessage(message, false, true);
}
}
try {
notifySelfPositionUpdate(sceneObject);
} catch (Exception& e) {
sceneObject->error("Exception caught while calling notifySelfPositionUpdate(sceneObject) in ZoneComponent::updateZone");
sceneObject->error(e.getMessage());
}
zone->wlock();
}