本文整理汇总了C++中NetIO::getSiteID方法的典型用法代码示例。如果您正苦于以下问题:C++ NetIO::getSiteID方法的具体用法?C++ NetIO::getSiteID怎么用?C++ NetIO::getSiteID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetIO
的用法示例。
在下文中一共展示了NetIO::getSiteID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IffManager
//------------------------------------------------------------------------------
// IffManager() -- (Output support) IFF manager
//------------------------------------------------------------------------------
bool Nib::IffManager(const double curExecTime)
{
NetIO* disIO = static_cast<NetIO*>(getNetIO());
const base::Pair* pair = getPlayer()->getRadioByType(typeid(models::Iff));
// OK if the player has an IFF transponder and we're the correct version.
bool ok = (disIO->getVersion() >= NetIO::VERSION_1278_1A) && (pair != nullptr);
if (ok) {
const models::Iff* iffSystem = static_cast<const models::Iff*>(pair->object());
if (isIffUpdateRequired(curExecTime, iffSystem)) {
// Standard header stuff
IffAtcNavaidsPDU pdu;
pdu.header.protocolVersion = disIO->getVersion();
pdu.header.exerciseIdentifier = disIO->getExerciseID();
pdu.header.PDUType = NetIO::PDU_IFF_ATC_NAVAIDS;
pdu.header.protocolFamily = NetIO::PDU_FAMILY_DIS_EMISSION_REG;
pdu.header.timeStamp = disIO->timeStamp();
pdu.header.length = sizeof(IffAtcNavaidsPDU);
// Entity ID
pdu.emittingEntityID.simulationID.siteIdentification = getSiteID();
pdu.emittingEntityID.simulationID.applicationIdentification = getApplicationID();
pdu.emittingEntityID.ID = getPlayerID();
// Location (default is center of parent entity)
pdu.location.component[0] = 0;
pdu.location.component[1] = 0;
pdu.location.component[2] = 0;
// System ID (for now just use a standard Mark X11; upgrade to type from IFF later)
pdu.systemID.systemType = 1; // Mark X11
pdu.systemID.systemName = 2; // Mark X11
pdu.systemID.systemMode = 0; // Other
pdu.systemID.options = iffOptions; // Option bits
// Functional operational data
pdu.operationalData.systemStatus = iffFunOpData->systemStatus;
pdu.operationalData.alternateParam4 = iffFunOpData->alternateParam4;
pdu.operationalData.informationLayers = iffFunOpData->informationLayers;
pdu.operationalData.modifier = iffFunOpData->modifier;
pdu.operationalData.param1 = iffFunOpData->param1;
pdu.operationalData.param2 = iffFunOpData->param2;
pdu.operationalData.param3 = iffFunOpData->param3;
pdu.operationalData.param4 = iffFunOpData->param4;
pdu.operationalData.param5 = iffFunOpData->param5;
pdu.operationalData.param6 = iffFunOpData->param6;
// Event ID
pdu.eventID.simulationID.siteIdentification = disIO->getSiteID();
pdu.eventID.simulationID.applicationIdentification = disIO->getApplicationID();
pdu.eventID.eventNumber = disIO->getNewIffEventID();
//pdu.dumpData();
if (base::NetHandler::isNotNetworkByteOrder()) pdu.swapBytes();
ok = disIO->sendData(reinterpret_cast<char*>(&pdu), sizeof(pdu));
iffLastExecTime = curExecTime;
}
}
return ok;
}
示例2: weaponFireMsgFactory
//------------------------------------------------------------------------------
// weaponFireMsgFactory() -- (Output support) Weapon fire message factory
//------------------------------------------------------------------------------
bool Nib::weaponFireMsgFactory(const LCreal)
{
bool ok = true;
//std::cout << "NetIO::weaponFireMsgFactory() HERE!!" << std::endl;
// Get our NetIO
NetIO* disIO = (NetIO*)(getNetIO());
//Simulation* sim = disIO->getSimulation();
// Set the NIB mode so that we don't do this again.
setMode(Simulation::Player::ACTIVE);
// Our NIB's player is a weapon that just became active
Simulation::Weapon* mPlayer = (Simulation::Weapon*)(getPlayer());
// Ok, we have the weapon, now get the firing and target players
Simulation::Player* tPlayer = mPlayer->getTargetPlayer();
Simulation::Player* fPlayer = mPlayer->getLaunchVehicle();
if (fPlayer == 0) return false;
// ---
// PDU header
// ---
FirePDU pdu;
pdu.header.protocolVersion = disIO->getVersion();
pdu.header.exerciseIdentifier = disIO->getExerciseID();
pdu.header.PDUType = NetIO::PDU_FIRE;
pdu.header.protocolFamily = NetIO::PDU_FAMILY_WARFARE;
pdu.header.timeStamp = disIO->timeStamp();
pdu.header.length = sizeof(FirePDU);
// ---
// Set the PDU data with the firing (launcher) player's id
// ---
pdu.firingEntityID.ID = fPlayer->getID();
pdu.firingEntityID.simulationID.siteIdentification = disIO->getSiteID();
pdu.firingEntityID.simulationID.applicationIdentification = disIO->getApplicationID();
// ---
// Set the PDU data with the munition's ID
// ---
pdu.munitionID.ID = mPlayer->getID();
pdu.munitionID.simulationID.siteIdentification = disIO->getSiteID();
pdu.munitionID.simulationID.applicationIdentification = disIO->getApplicationID();
// ---
// Set the PDU data with the target's ID
// ---
{
bool tOk = false;
if (tPlayer != 0) {
pdu.targetEntityID.ID = tPlayer->getID();
if (tPlayer->isLocalPlayer()) {
// Local player, use our site/app/exerc IDs
pdu.targetEntityID.simulationID.siteIdentification = disIO->getSiteID();
pdu.targetEntityID.simulationID.applicationIdentification = disIO->getApplicationID();
tOk = true;
}
else {
const Nib* fNIB = dynamic_cast<const Nib*>( tPlayer->getNib() );
if (fNIB != 0) {
// Networked player, use it's NIB's IDs
pdu.targetEntityID.simulationID.siteIdentification = fNIB->getSiteID();
pdu.targetEntityID.simulationID.applicationIdentification = fNIB->getApplicationID();
tOk = true;
}
}
}
if (!tOk) {
// Networked player, use it's NIB's IDs
pdu.targetEntityID.ID = 0;
pdu.targetEntityID.simulationID.siteIdentification = 0;
pdu.targetEntityID.simulationID.applicationIdentification = 0;
}
}
// ---
// Event ID
// ---
pdu.eventID.simulationID.siteIdentification = disIO->getSiteID();
pdu.eventID.simulationID.applicationIdentification = disIO->getApplicationID();
pdu.eventID.eventNumber = mPlayer->getReleaseEventID();
// ---
// Location & Velociy
// ---
// World Coordinates
osg::Vec3d geocPos = mPlayer->getGeocPosition();
pdu.location.X_coord = geocPos[Basic::Nav::IX];
pdu.location.Y_coord = geocPos[Basic::Nav::IY];
pdu.location.Z_coord = geocPos[Basic::Nav::IZ];
// Velocity
osg::Vec3d geocVel = mPlayer->getGeocVelocity();
pdu.velocity.component[0] = (float)geocVel[Basic::Nav::IX];
pdu.velocity.component[1] = (float)geocVel[Basic::Nav::IY];
//.........这里部分代码省略.........