本文整理汇总了C++中PlayerObject::getSubZoneId方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerObject::getSubZoneId方法的具体用法?C++ PlayerObject::getSubZoneId怎么用?C++ PlayerObject::getSubZoneId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerObject
的用法示例。
在下文中一共展示了PlayerObject::getSubZoneId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _findInRangeObjectsOutside
void ObjectController::_findInRangeObjectsOutside(bool updateAll)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
//scale down viewing range when busy
float viewingRange = _GetMessageHeapLoadViewingRange();
// gLogger->logMsg("... _findInRangeObjectsOutside.");
// query the rtree for non moving objects/objects in buildings
// ObjectSet inRangeObjects;
// mSI->getObjectsInRange(player,&inRangeObjects,(ObjType_Player | ObjType_Tangible | ObjType_Creature | ObjType_NPC | ObjType_Building),viewingRange);
// Using intersectsWithQuery(..)
// NOTE: THIS USEAGE OF intersectsWithQuery(..) MUST BE CHECKED, SINCE IT SEEMS THAT WE GET TO MUCH / TO MANY OBJECTS !!!
// mSI->getObjectsInRangeEx(player,&inRangeObjects,(ObjType_Player | ObjType_Tangible | ObjType_Creature | ObjType_NPC | ObjType_Building),viewingRange);
// Make Set ready,
mInRangeObjects.clear();
mObjectSetIt = mInRangeObjects.begin(); // Will point to end of Set
if(player->getSubZoneId())
{
if(QTRegion* region = gWorldManager->getQTRegion(player->getSubZoneId()))
{
// gLogger->logMsg("... in a region.");
Anh_Math::Rectangle qRect = Anh_Math::Rectangle(player->mPosition.x - viewingRange,player->mPosition.z - viewingRange,viewingRange * 2,viewingRange * 2);
// We need to find moving creatures also...
region->mTree->getObjectsInRange(player,&mInRangeObjects,ObjType_Player | ObjType_NPC | ObjType_Creature | ObjType_Lair , &qRect);
}
}
if (updateAll)
{
// gLogger->logMsg("UpdateAll.");
// Doing this because we need the players from inside buildings too.
mSI->getObjectsInRangeEx(player,&mInRangeObjects,(ObjType_Player | ObjType_NPC | ObjType_Creature), viewingRange);
// This may be good when we standstill.
mSI->getObjectsInRange(player,&mInRangeObjects,(ObjType_Tangible | ObjType_Building | ObjType_Lair | ObjType_Structure), viewingRange);
}
/*
{
// This may be good when we are moving around outside.
mSI->getObjectsInRange(player,&mInRangeObjects,(ObjType_Player | ObjType_NPC | ObjType_Creature | ObjType_Tangible | ObjType_Building), viewingRange);
}
*/
// Update the iterator to start of Set.
mObjectSetIt = mInRangeObjects.begin();
}
示例2: handleDataTransform
//.........这里部分代码省略.........
if(QTRegion* newRegion = mSI->getQTRegion((double)pos.x,(double)pos.z))
{
player->setSubZoneId((uint32)newRegion->getId());
newRegion->mTree->addObject(player);
}
else
{
// we should never get here !
gLogger->logMsg("ObjController::handleDataTransform: could not find zone region in map");
gLogger->logMsg("ObjController:: probably a bot : %i64u",static_cast<int>(player->getId()));
// hammertime !
//muglies botter sometimes sends us weird positions
//however other 3rd party tools might do the same
gWorldManager->addDisconnectedPlayer(player);
return;
}
// Inform tutorial about cell change.
if (gWorldConfig->isTutorial())
{
player->getTutorial()->setCellId(0);
}
}
else //we are not in a building
{
// we should be in a qt at this point
// get the qt of the new position
if(QTRegion* newRegion = mSI->getQTRegion((double)pos.x,(double)pos.z))
{
// we didnt change so update the old one
if((uint32)newRegion->getId() == player->getSubZoneId())
{
// this also updates the players position
newRegion->mTree->updateObject(player,pos);
//If our player is mounted lets update his mount aswell
if(player->checkIfMounted() && player->getMount())
{
newRegion->mTree->updateObject(player->getMount(),pos);
}
}
else
{
updateAll = true;
gLogger->logMsg("ObjController::DataTransform: Changing subzone");
// remove from old
if(QTRegion* oldRegion = gWorldManager->getQTRegion(player->getSubZoneId()))
{
oldRegion->mTree->removeObject(player);
//If our player is mounted lets update his mount aswell
if(player->checkIfMounted() && player->getMount())
{
oldRegion->mTree->removeObject(player->getMount());
}
}
// update players position
player->mPosition = pos;
//If our player is mounted lets update his mount aswell
if(player->checkIfMounted() && player->getMount())
{
player->getMount()->mPosition = pos;
}
示例3: handleDataTransformWithParent
void ObjectController::handleDataTransformWithParent(Message* message,bool inRangeUpdate)
{
// FIXME: for now assume we only get messages from players
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
glm::vec3 pos;
glm::quat dir;
uint32 inMoveCount;
uint32 tickCount;
uint64 parentId;
float speed;
bool updateAll = false;
// get tick and move counters
tickCount = message->getUint32();
inMoveCount = message->getUint32();
// only process if its in sequence
if (player->getInMoveCount() <= inMoveCount)
{
uint64 oldParentId = player->getParentId();
//uint32 ticks = tickCount - player->getClientTickCount();
// update tick and move counters
player->setClientTickCount(tickCount);
player->setInMoveCount(inMoveCount);
// get new direction, position, parent and speed
parentId = message->getUint64();
dir.x = message->getFloat();
dir.y = message->getFloat();
dir.z = message->getFloat();
dir.w = message->getFloat();
pos.x = message->getFloat();
pos.y = message->getFloat();
pos.z = message->getFloat();
speed = message->getFloat();
// gLogger->logMsgF("Position inside = %f, %f, %f",MSG_NORMAL, pos.x, pos.y, pos.z);
// gLogger->logMsgF("Direction = %f, %f, %f, %f",MSG_NORMAL, dir.x, dir.y, dir.z, dir.w);
// stop entertaining, if we were
if(player->getPerformingState() != PlayerPerformance_None && player->getPosture() != CreaturePosture_SkillAnimating)
{
gEntertainerManager->stopEntertaining(player);
}
// if we changed cell
if (oldParentId != parentId)
{
CellObject* cell = NULL;
// gLogger->logMsgF("We changed cell from (%"PRIu64") to (%"PRIu64")",MSG_NORMAL, oldParentId, parentId);
// Remove us from whatever we where in before.
// (4 for add and 0 for remove)
gMessageLib->broadcastContainmentMessage(player->getId(),oldParentId,0,player);
// only remove us from si, if we just entered the building
if (oldParentId != 0)
{
if((cell = dynamic_cast<CellObject*>(gWorldManager->getObjectById(oldParentId))))
{
cell->removeObject(player);
// Done above.. gMessageLib->broadcastContainmentMessage(player->getId(),parentId,4,player);
}
else
{
gLogger->logMsgF("Error removing %"PRIu64" from cell(%"PRIu64")",MSG_NORMAL,player->getId(),oldParentId);
}
}
else
{
updateAll = true; // We just entered the building.
// remove us from qt
if(player->getSubZoneId())
{
if(QTRegion* region = gWorldManager->getQTRegion(player->getSubZoneId()))
{
player->setSubZoneId(0);
region->mTree->removeObject(player);
//If our player is mounted lets update his mount aswell
if(player->checkIfMounted() && player->getMount())
{
player->getMount()->setSubZoneId(0);
region->mTree->removeObject(player->getMount());
//Can't ride into a building with a mount! :-p
//However, its easy to do so we have handling incase the client is tricked.
// the vehicle is the INTANGIBLE Datapad Controller
// the *vehicle* itself is the BODY
if(Vehicle* datapad_pet = dynamic_cast<Vehicle*>(gWorldManager->getObjectById(player->getMount()->getPetController())))
{
//.........这里部分代码省略.........