本文整理汇总了C++中Plane::GetAltitude方法的典型用法代码示例。如果您正苦于以下问题:C++ Plane::GetAltitude方法的具体用法?C++ Plane::GetAltitude怎么用?C++ Plane::GetAltitude使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plane
的用法示例。
在下文中一共展示了Plane::GetAltitude方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: At
bool Airport::At(Plane &plane)
{
int x, y;
plane.GetPosition(x, y);
if ( x == position.x && y == position.y)
if (plane.GetHeading() == (heading ^ 4))
if (plane.GetAltitude() == 0)
return true;
return false;
}
示例2: Timed
std::string Board::Timed()
{
std::string rv;
In();
for (std::set<Plane *>::iterator it = planesIn.begin(); it != planesIn.end();)
{
Plane *plane = *it;
int n = plane->GetDestination();
bool atFix;
if (n >= 10)
{
navAids[n-10]->At(*plane);
atFix = airports[n-10]->At(*plane);
if (atFix)
{
if (plane->GetHeading() == airports[n-10]->GetHeading() ^ 4)
{
it = planesIn.erase(it);
planesDone.insert(plane);
continue;
}
}
}
else
{
atFix = fixes[n]->At(*plane);
}
if (plane->GetAltitude() == 0)
{
bool at = false;
int x, y;
int x1, y1;
plane->GetPosition(x, y);
airports[0]->GetPosition(x1,y1);
if (x == x1 && y == y1)
at = true;
airports[1]->GetPosition(x1,y1);
if (x == x1 && y == y1)
at = true;
if (at)
{
rv = "Skimmed airport without landing!";
}
}
if (plane->Move(time))
{
if (atFix && plane->OffBoard())
{
it = planesIn.erase(it);
planesDone.insert(plane);
continue;
}
else if (plane->OffBoard())
{
// game over, exit in wrong place
if (plane->GetAltitude() < 5)
rv = std::string(plane->GetName()) + " left control area at wrong altitude";
else
{
if ((plane->GetDestination() < 10 && plane->GetHeading() != (fixes[plane->GetDestination()]->GetHeading() ^ 4)) ||
(plane->GetDestination() >9 && plane->GetHeading() != (airports[plane->GetDestination()-10]->GetHeading() ^ 4)))
rv = std::string(plane->GetName()) + " left control area at wrong heading";
else
rv = std::string(plane->GetName()) + " left control area at wrong place";
}
}
}
++it;
}
for (std::set<Plane *>::iterator it = planesDisplay.begin(); it != planesDisplay.end();)
{
Plane *plane = *it;
if (plane->GetStartTime() <= time)
{
it = planesDisplay.erase(it);
planesIn.insert(plane);
continue;
}
++it;
}
if (rv == "")
{
for (std::set<Plane *>::iterator it1 = planesIn.begin(); rv == "" && it1 != planesIn.end(); ++it1)
{
Plane *left = *it1;
for (std::set<Plane *>::iterator it2 = it1; rv == "" && it2 != planesIn.end(); ++it2)
{
Plane *right = *it2;
if (it1 != it2)
{
if (left->GetAltitude() == right->GetAltitude())
{
int x,y;
right->GetPosition(x, y);
if (left->dist(x, y) < 4)
rv = std::string("Conflict between ") + left->GetName() + " and " + right->GetName();
}
}
}
}
//.........这里部分代码省略.........