本文整理汇总了C++中simulation::Player::getPilot方法的典型用法代码示例。如果您正苦于以下问题:C++ Player::getPilot方法的具体用法?C++ Player::getPilot怎么用?C++ Player::getPilot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simulation::Player
的用法示例。
在下文中一共展示了Player::getPilot方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: buttonEvent
// ----------------------------------------------------------------------------
// buttonEvent() - called when a button is pressed
// ----------------------------------------------------------------------------
void MapDisplay::buttonEvent(const int b)
{
// cmdRange up, down
MapPage* page = static_cast<MapPage*>(subpage());
// cmdAirspeed, cmdAltitude, cmdHeading up, down
Simulation::Player* pA = getOwnship();
Simulation::Autopilot* ap = 0;
if (pA != 0) {
ap = static_cast<Simulation::Autopilot*>(pA->getPilot());
}
if (page != 0 && ap != 0) {
if (b == DEC_RANGE) {
if (page->getRange() > 5) {
page->setRange(page->getRange() - 5);
}
}
else if (b == INC_RANGE) {
if (page->getRange() < 320) {
page->setRange(page->getRange() + 5);
}
}
else if (b == DEC_CMD_AS) {
double cmdAirspeed = ap->getCommandedVelocityKts();
if (cmdAirspeed > 100) {
cmdAirspeed -= 10;
ap->setCommandedVelocityKts(cmdAirspeed);
}
}
else if (b == INC_CMD_AS) {
double cmdAirspeed = ap->getCommandedVelocityKts();
if (cmdAirspeed < 400) {
cmdAirspeed += 10;
ap->setCommandedVelocityKts(cmdAirspeed);
}
}
else if (b == DEC_CMD_ALT) {
double cmdAltitude = ap->getCommandedAltitudeFt();
if (cmdAltitude > 1000) {
cmdAltitude -= 500;
ap->setCommandedAltitudeFt(cmdAltitude);
}
}
else if (b == INC_CMD_ALT) {
double cmdAltitude = ap->getCommandedAltitudeFt();
if (cmdAltitude < 40000) {
cmdAltitude += 500;
ap->setCommandedAltitudeFt(cmdAltitude);
}
}
else if (b == DEC_CMD_HDG) {
double cmdHeading = ap->getCommandedHeadingD();
cmdHeading -= 10;
if (cmdHeading < -180.0) cmdHeading += 360;
ap->setCommandedHeadingD(cmdHeading);
}
else if (b == INC_CMD_HDG) {
double cmdHeading = ap->getCommandedHeadingD();
cmdHeading += 10;
if (cmdHeading > 180.0) cmdHeading -= 360;
ap->setCommandedHeadingD(cmdHeading);
}
else if (b == INC_CMD_AS_NPS) {
double maxAccel = ap->getMaxVelAcc();
if (maxAccel < 20) maxAccel++;
ap->setMaxVelAccNps(maxAccel);
}
else if (b == DEC_CMD_AS_NPS) {
double maxAccel = ap->getMaxVelAcc();
if (maxAccel > 1) maxAccel--;
ap->setMaxVelAccNps(maxAccel);
}
// Climb rate in meters per second
else if (b == INC_CMD_ALT_MPS) {
double maxClimb = ap->getMaxClimbRate();
if (maxClimb < 100) maxClimb += 5;
ap->setMaxClimbRateMps(maxClimb);
}
else if (b == DEC_CMD_ALT_MPS) {
double maxClimb = ap->getMaxClimbRate();
if (maxClimb > 5) maxClimb -= 5;
ap->setMaxClimbRateMps(maxClimb);
}
// Turn rate in degrees per second
else if (b == INC_CMD_HDG_ROT) {
double maxTR = ap->getMaxTurnRate();
if (maxTR < 25) maxTR++;
ap->setMaxTurnRateDps(maxTR);
}
else if (b == DEC_CMD_HDG_ROT) {
double maxTR = ap->getMaxTurnRate();
if (maxTR > 0) maxTR--;
ap->setMaxTurnRateDps(maxTR);
}
// Max bank (degrees)
else if (b == INC_CMD_HDG_BNK) {
double maxBank = ap->getMaxBankAngle();
//.........这里部分代码省略.........