Performance optimization: empty() instead of size()>0
empty() is guaranteed to be constant complexity for both vectors and lists, while size() has linear complexity for lists.
This commit is contained in:
parent
296555f26b
commit
81cd33e2fa
22 changed files with 77 additions and 76 deletions
|
@ -65,7 +65,7 @@ time_t ActiveRunway::requestTimeSlot(time_t eta)
|
||||||
time_t newEta;
|
time_t newEta;
|
||||||
time_t separation = 90;
|
time_t separation = 90;
|
||||||
bool found = false;
|
bool found = false;
|
||||||
if (estimatedArrivalTimes.size() == 0) {
|
if (estimatedArrivalTimes.empty()) {
|
||||||
estimatedArrivalTimes.push_back(eta);
|
estimatedArrivalTimes.push_back(eta);
|
||||||
return eta;
|
return eta;
|
||||||
} else {
|
} else {
|
||||||
|
@ -191,7 +191,7 @@ void FGTrafficRecord::setPositionAndIntentions(int pos,
|
||||||
{
|
{
|
||||||
|
|
||||||
currentPos = pos;
|
currentPos = pos;
|
||||||
if (intentions.size()) {
|
if (! intentions.empty()) {
|
||||||
intVecIterator i = intentions.begin();
|
intVecIterator i = intentions.begin();
|
||||||
if ((*i) != pos) {
|
if ((*i) != pos) {
|
||||||
SG_LOG(SG_ATC, SG_ALERT,
|
SG_LOG(SG_ATC, SG_ALERT,
|
||||||
|
@ -223,7 +223,7 @@ bool FGTrafficRecord::checkPositionAndIntentions(FGTrafficRecord & other)
|
||||||
//cerr << callsign << ": Check Position and intentions: we are on the same taxiway" << other.callsign << "Index = " << currentPos << endl;
|
//cerr << callsign << ": Check Position and intentions: we are on the same taxiway" << other.callsign << "Index = " << currentPos << endl;
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
// else if (other.intentions.size())
|
// else if (! other.intentions.empty())
|
||||||
// {
|
// {
|
||||||
// cerr << "Start check 2" << endl;
|
// cerr << "Start check 2" << endl;
|
||||||
// intVecIterator i = other.intentions.begin();
|
// intVecIterator i = other.intentions.begin();
|
||||||
|
@ -233,7 +233,7 @@ bool FGTrafficRecord::checkPositionAndIntentions(FGTrafficRecord & other)
|
||||||
// cerr << "Check Position and intentions: current matches other.intentions" << endl;
|
// cerr << "Check Position and intentions: current matches other.intentions" << endl;
|
||||||
// result = true;
|
// result = true;
|
||||||
// }
|
// }
|
||||||
else if (intentions.size()) {
|
else if (! intentions.empty()) {
|
||||||
//cerr << "Start check 3" << endl;
|
//cerr << "Start check 3" << endl;
|
||||||
intVecIterator i = intentions.begin();
|
intVecIterator i = intentions.begin();
|
||||||
//while (!((i == intentions.end()) || ((*i) == other.currentPos)))
|
//while (!((i == intentions.end()) || ((*i) == other.currentPos)))
|
||||||
|
@ -277,7 +277,7 @@ int FGTrafficRecord::crosses(FGGroundNetwork * net,
|
||||||
otherTargetNode = net->findSegment(other.currentPos)->getEnd()->getIndex(); // OKAY,...
|
otherTargetNode = net->findSegment(other.currentPos)->getEnd()->getIndex(); // OKAY,...
|
||||||
if ((currentTargetNode == otherTargetNode) && currentTargetNode > 0)
|
if ((currentTargetNode == otherTargetNode) && currentTargetNode > 0)
|
||||||
return currentTargetNode;
|
return currentTargetNode;
|
||||||
if (intentions.size()) {
|
if (! intentions.empty()) {
|
||||||
for (i = intentions.begin(); i != intentions.end(); i++) {
|
for (i = intentions.begin(); i != intentions.end(); i++) {
|
||||||
if ((*i) > 0) {
|
if ((*i) > 0) {
|
||||||
if (currentTargetNode ==
|
if (currentTargetNode ==
|
||||||
|
@ -288,7 +288,7 @@ int FGTrafficRecord::crosses(FGGroundNetwork * net,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (other.intentions.size()) {
|
if (! other.intentions.empty()) {
|
||||||
for (i = other.intentions.begin(); i != other.intentions.end();
|
for (i = other.intentions.begin(); i != other.intentions.end();
|
||||||
i++) {
|
i++) {
|
||||||
if ((*i) > 0) {
|
if ((*i) > 0) {
|
||||||
|
@ -300,7 +300,7 @@ int FGTrafficRecord::crosses(FGGroundNetwork * net,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (intentions.size() && other.intentions.size()) {
|
if (! intentions.empty() && ! other.intentions.empty()) {
|
||||||
for (i = intentions.begin(); i != intentions.end(); i++) {
|
for (i = intentions.begin(); i != intentions.end(); i++) {
|
||||||
for (j = other.intentions.begin(); j != other.intentions.end();
|
for (j = other.intentions.begin(); j != other.intentions.end();
|
||||||
j++) {
|
j++) {
|
||||||
|
@ -332,7 +332,7 @@ bool FGTrafficRecord::onRoute(FGGroundNetwork * net,
|
||||||
net->findSegment(other.currentPos)->getEnd()->getIndex();
|
net->findSegment(other.currentPos)->getEnd()->getIndex();
|
||||||
if ((node == othernode) && (node != -1))
|
if ((node == othernode) && (node != -1))
|
||||||
return true;
|
return true;
|
||||||
if (other.intentions.size()) {
|
if (! other.intentions.empty()) {
|
||||||
for (intVecIterator i = other.intentions.begin();
|
for (intVecIterator i = other.intentions.begin();
|
||||||
i != other.intentions.end(); i++) {
|
i != other.intentions.end(); i++) {
|
||||||
if (*i > 0) {
|
if (*i > 0) {
|
||||||
|
@ -344,7 +344,7 @@ bool FGTrafficRecord::onRoute(FGGroundNetwork * net,
|
||||||
}
|
}
|
||||||
//if (other.currentPos > 0)
|
//if (other.currentPos > 0)
|
||||||
// othernode = net->findSegment(other.currentPos)->getEnd()->getIndex();
|
// othernode = net->findSegment(other.currentPos)->getEnd()->getIndex();
|
||||||
//if (intentions.size())
|
//if (! intentions.empty())
|
||||||
// {
|
// {
|
||||||
// for (intVecIterator i = intentions.begin(); i != intentions.end(); i++)
|
// for (intVecIterator i = intentions.begin(); i != intentions.end(); i++)
|
||||||
// {
|
// {
|
||||||
|
@ -388,7 +388,7 @@ bool FGTrafficRecord::isOpposing(FGGroundNetwork * net,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (other.intentions.size()) {
|
if (! other.intentions.empty()) {
|
||||||
for (intVecIterator j = other.intentions.begin();
|
for (intVecIterator j = other.intentions.begin();
|
||||||
j != other.intentions.end(); j++) {
|
j != other.intentions.end(); j++) {
|
||||||
// cerr << "Current segment 1 " << (*i) << endl;
|
// cerr << "Current segment 1 " << (*i) << endl;
|
||||||
|
@ -820,7 +820,7 @@ void FGTowerController::announcePosition(int id,
|
||||||
TrafficVectorIterator i = activeTraffic.begin();
|
TrafficVectorIterator i = activeTraffic.begin();
|
||||||
// Search whether the current id alread has an entry
|
// Search whether the current id alread has an entry
|
||||||
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
||||||
if (activeTraffic.size()) {
|
if (! activeTraffic.empty()) {
|
||||||
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
||||||
while (i != activeTraffic.end()) {
|
while (i != activeTraffic.end()) {
|
||||||
if (i->getId() == id) {
|
if (i->getId() == id) {
|
||||||
|
@ -830,7 +830,7 @@ void FGTowerController::announcePosition(int id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add a new TrafficRecord if no one exsists for this aircraft.
|
// Add a new TrafficRecord if no one exsists for this aircraft.
|
||||||
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
|
if (i == activeTraffic.end() || (activeTraffic.empty())) {
|
||||||
FGTrafficRecord rec;
|
FGTrafficRecord rec;
|
||||||
rec.setId(id);
|
rec.setId(id);
|
||||||
|
|
||||||
|
@ -843,7 +843,7 @@ void FGTowerController::announcePosition(int id,
|
||||||
activeTraffic.push_back(rec);
|
activeTraffic.push_back(rec);
|
||||||
// Don't just schedule the aircraft for the tower controller, also assign if to the correct active runway.
|
// Don't just schedule the aircraft for the tower controller, also assign if to the correct active runway.
|
||||||
ActiveRunwayVecIterator rwy = activeRunways.begin();
|
ActiveRunwayVecIterator rwy = activeRunways.begin();
|
||||||
if (activeRunways.size()) {
|
if (! activeRunways.empty()) {
|
||||||
while (rwy != activeRunways.end()) {
|
while (rwy != activeRunways.end()) {
|
||||||
if (rwy->getRunwayName() == intendedRoute->getRunway()) {
|
if (rwy->getRunwayName() == intendedRoute->getRunway()) {
|
||||||
break;
|
break;
|
||||||
|
@ -874,7 +874,7 @@ void FGTowerController::updateAircraftInformation(int id, double lat, double lon
|
||||||
// Search whether the current id has an entry
|
// Search whether the current id has an entry
|
||||||
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
||||||
TrafficVectorIterator current, closest;
|
TrafficVectorIterator current, closest;
|
||||||
if (activeTraffic.size()) {
|
if (! activeTraffic.empty()) {
|
||||||
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
||||||
while (i != activeTraffic.end()) {
|
while (i != activeTraffic.end()) {
|
||||||
if (i->getId() == id) {
|
if (i->getId() == id) {
|
||||||
|
@ -884,7 +884,7 @@ void FGTowerController::updateAircraftInformation(int id, double lat, double lon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// // update position of the current aircraft
|
// // update position of the current aircraft
|
||||||
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
|
if (i == activeTraffic.end() || (activeTraffic.empty())) {
|
||||||
SG_LOG(SG_ATC, SG_ALERT,
|
SG_LOG(SG_ATC, SG_ALERT,
|
||||||
"AI error: updating aircraft without traffic record at " << SG_ORIGIN);
|
"AI error: updating aircraft without traffic record at " << SG_ORIGIN);
|
||||||
} else {
|
} else {
|
||||||
|
@ -957,7 +957,7 @@ void FGTowerController::signOff(int id)
|
||||||
TrafficVectorIterator i = activeTraffic.begin();
|
TrafficVectorIterator i = activeTraffic.begin();
|
||||||
// Search search if the current id alread has an entry
|
// Search search if the current id alread has an entry
|
||||||
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
||||||
if (activeTraffic.size()) {
|
if (! activeTraffic.empty()) {
|
||||||
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
||||||
while (i != activeTraffic.end()) {
|
while (i != activeTraffic.end()) {
|
||||||
if (i->getId() == id) {
|
if (i->getId() == id) {
|
||||||
|
@ -968,7 +968,7 @@ void FGTowerController::signOff(int id)
|
||||||
}
|
}
|
||||||
// If this aircraft has left the runway, we can clear the departure record for this runway
|
// If this aircraft has left the runway, we can clear the departure record for this runway
|
||||||
ActiveRunwayVecIterator rwy = activeRunways.begin();
|
ActiveRunwayVecIterator rwy = activeRunways.begin();
|
||||||
if (activeRunways.size()) {
|
if (! activeRunways.empty()) {
|
||||||
//while ((rwy->getRunwayName() != i->getRunway()) && (rwy != activeRunways.end())) {
|
//while ((rwy->getRunwayName() != i->getRunway()) && (rwy != activeRunways.end())) {
|
||||||
while (rwy != activeRunways.end()) {
|
while (rwy != activeRunways.end()) {
|
||||||
if (rwy->getRunwayName() == i->getRunway()) {
|
if (rwy->getRunwayName() == i->getRunway()) {
|
||||||
|
@ -984,7 +984,7 @@ void FGTowerController::signOff(int id)
|
||||||
"AI error: Attempting to erase non-existing runway clearance record in FGTowerController::signoff at " << SG_ORIGIN);
|
"AI error: Attempting to erase non-existing runway clearance record in FGTowerController::signoff at " << SG_ORIGIN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
|
if (i == activeTraffic.end() || (activeTraffic.empty())) {
|
||||||
SG_LOG(SG_ATC, SG_ALERT,
|
SG_LOG(SG_ATC, SG_ALERT,
|
||||||
"AI error: Aircraft without traffic record is signing off from tower at " << SG_ORIGIN);
|
"AI error: Aircraft without traffic record is signing off from tower at " << SG_ORIGIN);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1005,7 +1005,7 @@ bool FGTowerController::hasInstruction(int id)
|
||||||
TrafficVectorIterator i = activeTraffic.begin();
|
TrafficVectorIterator i = activeTraffic.begin();
|
||||||
// Search search if the current id has an entry
|
// Search search if the current id has an entry
|
||||||
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
||||||
if (activeTraffic.size()) {
|
if (! activeTraffic.empty()) {
|
||||||
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
||||||
while (i != activeTraffic.end()) {
|
while (i != activeTraffic.end()) {
|
||||||
if (i->getId() == id) {
|
if (i->getId() == id) {
|
||||||
|
@ -1014,7 +1014,7 @@ bool FGTowerController::hasInstruction(int id)
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
|
if (i == activeTraffic.end() || activeTraffic.empty()) {
|
||||||
SG_LOG(SG_ATC, SG_ALERT,
|
SG_LOG(SG_ATC, SG_ALERT,
|
||||||
"AI error: checking ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
|
"AI error: checking ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1029,7 +1029,7 @@ FGATCInstruction FGTowerController::getInstruction(int id)
|
||||||
TrafficVectorIterator i = activeTraffic.begin();
|
TrafficVectorIterator i = activeTraffic.begin();
|
||||||
// Search search if the current id has an entry
|
// Search search if the current id has an entry
|
||||||
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
||||||
if (activeTraffic.size()) {
|
if (! activeTraffic.empty()) {
|
||||||
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
||||||
while (i != activeTraffic.end()) {
|
while (i != activeTraffic.end()) {
|
||||||
if (i->getId() == id) {
|
if (i->getId() == id) {
|
||||||
|
@ -1038,7 +1038,7 @@ FGATCInstruction FGTowerController::getInstruction(int id)
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
|
if (i == activeTraffic.end() || activeTraffic.empty()) {
|
||||||
SG_LOG(SG_ATC, SG_ALERT,
|
SG_LOG(SG_ATC, SG_ALERT,
|
||||||
"AI error: requesting ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
|
"AI error: requesting ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1084,7 +1084,7 @@ void FGStartupController::announcePosition(int id,
|
||||||
TrafficVectorIterator i = activeTraffic.begin();
|
TrafficVectorIterator i = activeTraffic.begin();
|
||||||
// Search whether the current id alread has an entry
|
// Search whether the current id alread has an entry
|
||||||
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
||||||
if (activeTraffic.size()) {
|
if (! activeTraffic.empty()) {
|
||||||
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
||||||
while (i != activeTraffic.end()) {
|
while (i != activeTraffic.end()) {
|
||||||
if (i->getId() == id) {
|
if (i->getId() == id) {
|
||||||
|
@ -1094,7 +1094,7 @@ void FGStartupController::announcePosition(int id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add a new TrafficRecord if no one exsists for this aircraft.
|
// Add a new TrafficRecord if no one exsists for this aircraft.
|
||||||
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
|
if (i == activeTraffic.end() || activeTraffic.empty()) {
|
||||||
FGTrafficRecord rec;
|
FGTrafficRecord rec;
|
||||||
rec.setId(id);
|
rec.setId(id);
|
||||||
|
|
||||||
|
@ -1124,7 +1124,7 @@ bool FGStartupController::hasInstruction(int id)
|
||||||
TrafficVectorIterator i = activeTraffic.begin();
|
TrafficVectorIterator i = activeTraffic.begin();
|
||||||
// Search search if the current id has an entry
|
// Search search if the current id has an entry
|
||||||
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
||||||
if (activeTraffic.size()) {
|
if (! activeTraffic.empty()) {
|
||||||
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
||||||
while (i != activeTraffic.end()) {
|
while (i != activeTraffic.end()) {
|
||||||
if (i->getId() == id) {
|
if (i->getId() == id) {
|
||||||
|
@ -1133,7 +1133,7 @@ bool FGStartupController::hasInstruction(int id)
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
|
if (i == activeTraffic.end() || activeTraffic.empty()) {
|
||||||
SG_LOG(SG_ATC, SG_ALERT,
|
SG_LOG(SG_ATC, SG_ALERT,
|
||||||
"AI error: checking ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
|
"AI error: checking ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1148,7 +1148,7 @@ FGATCInstruction FGStartupController::getInstruction(int id)
|
||||||
TrafficVectorIterator i = activeTraffic.begin();
|
TrafficVectorIterator i = activeTraffic.begin();
|
||||||
// Search search if the current id has an entry
|
// Search search if the current id has an entry
|
||||||
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
||||||
if (activeTraffic.size()) {
|
if (! activeTraffic.empty()) {
|
||||||
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
||||||
while (i != activeTraffic.end()) {
|
while (i != activeTraffic.end()) {
|
||||||
if (i->getId() == id) {
|
if (i->getId() == id) {
|
||||||
|
@ -1157,7 +1157,7 @@ FGATCInstruction FGStartupController::getInstruction(int id)
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
|
if (i == activeTraffic.end() || activeTraffic.empty()) {
|
||||||
SG_LOG(SG_ATC, SG_ALERT,
|
SG_LOG(SG_ATC, SG_ALERT,
|
||||||
"AI error: requesting ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
|
"AI error: requesting ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1171,7 +1171,7 @@ void FGStartupController::signOff(int id)
|
||||||
TrafficVectorIterator i = activeTraffic.begin();
|
TrafficVectorIterator i = activeTraffic.begin();
|
||||||
// Search search if the current id alread has an entry
|
// Search search if the current id alread has an entry
|
||||||
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
||||||
if (activeTraffic.size()) {
|
if (! activeTraffic.empty()) {
|
||||||
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
||||||
while (i != activeTraffic.end()) {
|
while (i != activeTraffic.end()) {
|
||||||
if (i->getId() == id) {
|
if (i->getId() == id) {
|
||||||
|
@ -1180,7 +1180,7 @@ void FGStartupController::signOff(int id)
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
|
if (i == activeTraffic.end() || activeTraffic.empty()) {
|
||||||
SG_LOG(SG_ATC, SG_ALERT,
|
SG_LOG(SG_ATC, SG_ALERT,
|
||||||
"AI error: Aircraft without traffic record is signing off from tower at " << SG_ORIGIN);
|
"AI error: Aircraft without traffic record is signing off from tower at " << SG_ORIGIN);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1230,7 +1230,7 @@ void FGStartupController::updateAircraftInformation(int id, double lat, double l
|
||||||
// Search search if the current id has an entry
|
// Search search if the current id has an entry
|
||||||
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
||||||
TrafficVectorIterator current, closest;
|
TrafficVectorIterator current, closest;
|
||||||
if (activeTraffic.size()) {
|
if (! activeTraffic.empty()) {
|
||||||
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
||||||
while (i != activeTraffic.end()) {
|
while (i != activeTraffic.end()) {
|
||||||
if (i->getId() == id) {
|
if (i->getId() == id) {
|
||||||
|
@ -1542,7 +1542,7 @@ void FGApproachController::announcePosition(int id,
|
||||||
TrafficVectorIterator i = activeTraffic.begin();
|
TrafficVectorIterator i = activeTraffic.begin();
|
||||||
// Search whether the current id alread has an entry
|
// Search whether the current id alread has an entry
|
||||||
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
||||||
if (activeTraffic.size()) {
|
if (! activeTraffic.empty()) {
|
||||||
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
||||||
while (i != activeTraffic.end()) {
|
while (i != activeTraffic.end()) {
|
||||||
if (i->getId() == id) {
|
if (i->getId() == id) {
|
||||||
|
@ -1552,7 +1552,7 @@ void FGApproachController::announcePosition(int id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Add a new TrafficRecord if no one exsists for this aircraft.
|
// Add a new TrafficRecord if no one exsists for this aircraft.
|
||||||
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
|
if (i == activeTraffic.end() || activeTraffic.empty()) {
|
||||||
FGTrafficRecord rec;
|
FGTrafficRecord rec;
|
||||||
rec.setId(id);
|
rec.setId(id);
|
||||||
|
|
||||||
|
@ -1575,7 +1575,7 @@ void FGApproachController::updateAircraftInformation(int id, double lat, double
|
||||||
// Search search if the current id has an entry
|
// Search search if the current id has an entry
|
||||||
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
||||||
TrafficVectorIterator current, closest;
|
TrafficVectorIterator current, closest;
|
||||||
if (activeTraffic.size()) {
|
if (! activeTraffic.empty()) {
|
||||||
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
||||||
while (i != activeTraffic.end()) {
|
while (i != activeTraffic.end()) {
|
||||||
if (i->getId() == id) {
|
if (i->getId() == id) {
|
||||||
|
@ -1585,7 +1585,7 @@ void FGApproachController::updateAircraftInformation(int id, double lat, double
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// // update position of the current aircraft
|
// // update position of the current aircraft
|
||||||
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
|
if (i == activeTraffic.end() || activeTraffic.empty()) {
|
||||||
SG_LOG(SG_ATC, SG_ALERT,
|
SG_LOG(SG_ATC, SG_ALERT,
|
||||||
"AI error: updating aircraft without traffic record at " << SG_ORIGIN);
|
"AI error: updating aircraft without traffic record at " << SG_ORIGIN);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1624,7 +1624,7 @@ void FGApproachController::signOff(int id)
|
||||||
TrafficVectorIterator i = activeTraffic.begin();
|
TrafficVectorIterator i = activeTraffic.begin();
|
||||||
// Search search if the current id alread has an entry
|
// Search search if the current id alread has an entry
|
||||||
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
||||||
if (activeTraffic.size()) {
|
if (! activeTraffic.empty()) {
|
||||||
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
||||||
while (i != activeTraffic.end()) {
|
while (i != activeTraffic.end()) {
|
||||||
if (i->getId() == id) {
|
if (i->getId() == id) {
|
||||||
|
@ -1633,7 +1633,7 @@ void FGApproachController::signOff(int id)
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
|
if (i == activeTraffic.end() || activeTraffic.empty()) {
|
||||||
SG_LOG(SG_ATC, SG_ALERT,
|
SG_LOG(SG_ATC, SG_ALERT,
|
||||||
"AI error: Aircraft without traffic record is signing off from approach at " << SG_ORIGIN);
|
"AI error: Aircraft without traffic record is signing off from approach at " << SG_ORIGIN);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1653,7 +1653,7 @@ bool FGApproachController::hasInstruction(int id)
|
||||||
TrafficVectorIterator i = activeTraffic.begin();
|
TrafficVectorIterator i = activeTraffic.begin();
|
||||||
// Search search if the current id has an entry
|
// Search search if the current id has an entry
|
||||||
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
// This might be faster using a map instead of a vector, but let's start by taking a safe route
|
||||||
if (activeTraffic.size()) {
|
if (! activeTraffic.empty()) {
|
||||||
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
//while ((i->getId() != id) && i != activeTraffic.end()) {
|
||||||
while (i != activeTraffic.end()) {
|
while (i != activeTraffic.end()) {
|
||||||
if (i->getId() == id) {
|
if (i->getId() == id) {
|
||||||
|
@ -1662,7 +1662,7 @@ bool FGApproachController::hasInstruction(int id)
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
|
if (i == activeTraffic.end() || activeTraffic.empty()) {
|
||||||
SG_LOG(SG_ATC, SG_ALERT,
|
SG_LOG(SG_ATC, SG_ALERT,
|
||||||
"AI error: checking ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
|
"AI error: checking ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -479,7 +479,7 @@ public:
|
||||||
virtual std::string getName();
|
virtual std::string getName();
|
||||||
virtual void update(double dt);
|
virtual void update(double dt);
|
||||||
bool hasActiveTraffic() {
|
bool hasActiveTraffic() {
|
||||||
return activeTraffic.size() != 0;
|
return ! activeTraffic.empty();
|
||||||
};
|
};
|
||||||
TrafficVector &getActiveTraffic() {
|
TrafficVector &getActiveTraffic() {
|
||||||
return activeTraffic;
|
return activeTraffic;
|
||||||
|
@ -516,7 +516,7 @@ public:
|
||||||
virtual void update(double dt);
|
virtual void update(double dt);
|
||||||
|
|
||||||
bool hasActiveTraffic() {
|
bool hasActiveTraffic() {
|
||||||
return activeTraffic.size() != 0;
|
return ! activeTraffic.empty();
|
||||||
};
|
};
|
||||||
TrafficVector &getActiveTraffic() {
|
TrafficVector &getActiveTraffic() {
|
||||||
return activeTraffic;
|
return activeTraffic;
|
||||||
|
@ -558,7 +558,7 @@ public:
|
||||||
ActiveRunway* getRunway(const std::string& name);
|
ActiveRunway* getRunway(const std::string& name);
|
||||||
|
|
||||||
bool hasActiveTraffic() {
|
bool hasActiveTraffic() {
|
||||||
return activeTraffic.size() != 0;
|
return ! activeTraffic.empty();
|
||||||
};
|
};
|
||||||
TrafficVector &getActiveTraffic() {
|
TrafficVector &getActiveTraffic() {
|
||||||
return activeTraffic;
|
return activeTraffic;
|
||||||
|
|
|
@ -572,7 +572,7 @@ FGReplay::record(double time)
|
||||||
{
|
{
|
||||||
FGReplayData* r = NULL;
|
FGReplayData* r = NULL;
|
||||||
|
|
||||||
if (recycler.size())
|
if (! recycler.empty())
|
||||||
{
|
{
|
||||||
r = recycler.front();
|
r = recycler.front();
|
||||||
recycler.pop_front();
|
recycler.pop_front();
|
||||||
|
@ -588,7 +588,7 @@ void
|
||||||
FGReplay::interpolate( double time, const replay_list_type &list)
|
FGReplay::interpolate( double time, const replay_list_type &list)
|
||||||
{
|
{
|
||||||
// sanity checking
|
// sanity checking
|
||||||
if ( list.size() == 0 )
|
if ( list.empty() )
|
||||||
{
|
{
|
||||||
// handle empty list
|
// handle empty list
|
||||||
return;
|
return;
|
||||||
|
@ -639,7 +639,7 @@ FGReplay::replay( double time ) {
|
||||||
|
|
||||||
replayMessage(time);
|
replayMessage(time);
|
||||||
|
|
||||||
if ( short_term.size() > 0 ) {
|
if ( ! short_term.empty() ) {
|
||||||
t1 = short_term.back()->sim_time;
|
t1 = short_term.back()->sim_time;
|
||||||
t2 = short_term.front()->sim_time;
|
t2 = short_term.front()->sim_time;
|
||||||
if ( time > t1 ) {
|
if ( time > t1 ) {
|
||||||
|
@ -649,7 +649,7 @@ FGReplay::replay( double time ) {
|
||||||
return true;
|
return true;
|
||||||
} else if ( time <= t1 && time >= t2 ) {
|
} else if ( time <= t1 && time >= t2 ) {
|
||||||
interpolate( time, short_term );
|
interpolate( time, short_term );
|
||||||
} else if ( medium_term.size() > 0 ) {
|
} else if ( ! medium_term.empty() ) {
|
||||||
t1 = short_term.front()->sim_time;
|
t1 = short_term.front()->sim_time;
|
||||||
t2 = medium_term.back()->sim_time;
|
t2 = medium_term.back()->sim_time;
|
||||||
if ( time <= t1 && time >= t2 )
|
if ( time <= t1 && time >= t2 )
|
||||||
|
@ -660,7 +660,7 @@ FGReplay::replay( double time ) {
|
||||||
t2 = medium_term.front()->sim_time;
|
t2 = medium_term.front()->sim_time;
|
||||||
if ( time <= t1 && time >= t2 ) {
|
if ( time <= t1 && time >= t2 ) {
|
||||||
interpolate( time, medium_term );
|
interpolate( time, medium_term );
|
||||||
} else if ( long_term.size() > 0 ) {
|
} else if ( ! long_term.empty() ) {
|
||||||
t1 = medium_term.front()->sim_time;
|
t1 = medium_term.front()->sim_time;
|
||||||
t2 = long_term.back()->sim_time;
|
t2 = long_term.back()->sim_time;
|
||||||
if ( time <= t1 && time >= t2 )
|
if ( time <= t1 && time >= t2 )
|
||||||
|
@ -704,13 +704,13 @@ FGReplay::replay(double time, FGReplayData* pCurrentFrame, FGReplayData* pOldFra
|
||||||
double
|
double
|
||||||
FGReplay::get_start_time()
|
FGReplay::get_start_time()
|
||||||
{
|
{
|
||||||
if ( long_term.size() > 0 )
|
if ( ! long_term.empty() )
|
||||||
{
|
{
|
||||||
return long_term.front()->sim_time;
|
return long_term.front()->sim_time;
|
||||||
} else if ( medium_term.size() > 0 )
|
} else if ( ! medium_term.empty() )
|
||||||
{
|
{
|
||||||
return medium_term.front()->sim_time;
|
return medium_term.front()->sim_time;
|
||||||
} else if ( short_term.size() )
|
} else if ( ! short_term.empty() )
|
||||||
{
|
{
|
||||||
return short_term.front()->sim_time;
|
return short_term.front()->sim_time;
|
||||||
} else
|
} else
|
||||||
|
@ -722,7 +722,7 @@ FGReplay::get_start_time()
|
||||||
double
|
double
|
||||||
FGReplay::get_end_time()
|
FGReplay::get_end_time()
|
||||||
{
|
{
|
||||||
if ( short_term.size() )
|
if ( ! short_term.empty() )
|
||||||
{
|
{
|
||||||
return short_term.back()->sim_time;
|
return short_term.back()->sim_time;
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -366,7 +366,7 @@ private:
|
||||||
|
|
||||||
const string& rwy_no_1(token[8]);
|
const string& rwy_no_1(token[8]);
|
||||||
const string& rwy_no_2(token[17]);
|
const string& rwy_no_2(token[17]);
|
||||||
if ( rwy_no_1.size() == 0 || rwy_no_2.size() == 0 )
|
if ( rwy_no_1.empty() || rwy_no_2.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
double displ_thresh1 = atof( token[11].c_str() );
|
double displ_thresh1 = atof( token[11].c_str() );
|
||||||
|
|
|
@ -115,7 +115,7 @@ protected:
|
||||||
* values of <min> and/or <max>.
|
* values of <min> and/or <max>.
|
||||||
*/
|
*/
|
||||||
inline double get_output_value() const {
|
inline double get_output_value() const {
|
||||||
return _output_list.size() == 0 ? 0.0 : clamp(_output_list[0]->getDoubleValue());
|
return _output_list.empty() ? 0.0 : clamp(_output_list[0]->getDoubleValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
simgear::PropertyList _output_list;
|
simgear::PropertyList _output_list;
|
||||||
|
@ -140,7 +140,7 @@ public:
|
||||||
|
|
||||||
inline void AnalogComponent::disabled( double dt )
|
inline void AnalogComponent::disabled( double dt )
|
||||||
{
|
{
|
||||||
if( _feedback_if_disabled && _output_list.size() > 0 ) {
|
if( _feedback_if_disabled && ! _output_list.empty() ) {
|
||||||
InputValue * input;
|
InputValue * input;
|
||||||
if( (input = _valueInput.get_active() ) != NULL )
|
if( (input = _valueInput.get_active() ) != NULL )
|
||||||
input->set_value( _output_list[0]->getDoubleValue() );
|
input->set_value( _output_list[0]->getDoubleValue() );
|
||||||
|
|
|
@ -169,7 +169,7 @@ const FGCommonInput::binding_list_t & FGKeyboardInput::_find_key_bindings (unsig
|
||||||
FGButton &b = bindings[k];
|
FGButton &b = bindings[k];
|
||||||
|
|
||||||
// Try it straight, first.
|
// Try it straight, first.
|
||||||
if (b.bindings[modifiers].size() > 0)
|
if (! b.bindings[modifiers].empty())
|
||||||
return b.bindings[modifiers];
|
return b.bindings[modifiers];
|
||||||
|
|
||||||
// Alt-Gr is CTRL+ALT
|
// Alt-Gr is CTRL+ALT
|
||||||
|
|
|
@ -185,7 +185,7 @@ void HUD::draw(osg::State&)
|
||||||
if (!isVisible())
|
if (!isVisible())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!_items.size() && !_ladders.size())
|
if (_items.empty() && _ladders.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (is3D()) {
|
if (is3D()) {
|
||||||
|
@ -321,7 +321,7 @@ void HUD::common_draw()
|
||||||
_text_list.draw();
|
_text_list.draw();
|
||||||
_line_list.draw();
|
_line_list.draw();
|
||||||
|
|
||||||
if (_stipple_line_list.size()) {
|
if (! _stipple_line_list.empty()) {
|
||||||
glEnable(GL_LINE_STIPPLE);
|
glEnable(GL_LINE_STIPPLE);
|
||||||
glLineStipple(1, 0x00FF);
|
glLineStipple(1, 0x00FF);
|
||||||
_stipple_line_list.draw();
|
_stipple_line_list.draw();
|
||||||
|
|
|
@ -61,6 +61,7 @@ public:
|
||||||
void add(const LineSegment& seg) { _list.push_back(seg); }
|
void add(const LineSegment& seg) { _list.push_back(seg); }
|
||||||
void erase() { _list.erase(_list.begin(), _list.end()); }
|
void erase() { _list.erase(_list.begin(), _list.end()); }
|
||||||
inline unsigned int size() const { return _list.size(); }
|
inline unsigned int size() const { return _list.size(); }
|
||||||
|
inline bool empty() const { return _list.empty(); }
|
||||||
void draw() {
|
void draw() {
|
||||||
glBegin(GL_LINES);
|
glBegin(GL_LINES);
|
||||||
std::vector<LineSegment>::const_iterator it, end = _list.end();
|
std::vector<LineSegment>::const_iterator it, end = _list.end();
|
||||||
|
|
|
@ -587,7 +587,7 @@ void KLN89::DtoPressed() {
|
||||||
} else {
|
} else {
|
||||||
_dir_page->SetId(_activeWaypoint.id);
|
_dir_page->SetId(_activeWaypoint.id);
|
||||||
}
|
}
|
||||||
} else if(_curPage == 6 && _activePage->GetSubPage() == 3 && fgGetBool("/instrumentation/kln89/scan-pull") && _activeFP->waypoints.size()) {
|
} else if(_curPage == 6 && _activePage->GetSubPage() == 3 && fgGetBool("/instrumentation/kln89/scan-pull") && ! _activeFP->waypoints.empty()) {
|
||||||
// NAV 4
|
// NAV 4
|
||||||
_dir_page->SetId(((KLN89NavPage*)_activePage)->GetNav4WpId());
|
_dir_page->SetId(((KLN89NavPage*)_activePage)->GetNav4WpId());
|
||||||
} else if(_curPage == 7 && _activePage->GetSubPage() == 0 && _mode == KLN89_MODE_CRSR) {
|
} else if(_curPage == 7 && _activePage->GetSubPage() == 0 && _mode == KLN89_MODE_CRSR) {
|
||||||
|
@ -658,7 +658,7 @@ void KLN89::MsgPressed() {
|
||||||
// TODO - handle persistent messages such as SUA alerting.
|
// TODO - handle persistent messages such as SUA alerting.
|
||||||
// (The message annunciation flashes before first view, but afterwards remains continuously lit with the message available
|
// (The message annunciation flashes before first view, but afterwards remains continuously lit with the message available
|
||||||
// until the potential conflict no longer pertains).
|
// until the potential conflict no longer pertains).
|
||||||
if(_dispMsg && _messageStack.size()) {
|
if(_dispMsg && ! _messageStack.empty()) {
|
||||||
_messageStack.pop_front();
|
_messageStack.pop_front();
|
||||||
}
|
}
|
||||||
_dispMsg = !_dispMsg;
|
_dispMsg = !_dispMsg;
|
||||||
|
|
|
@ -97,7 +97,7 @@ typedef gps_waypoint_map::const_iterator gps_waypoint_map_const_iterator;
|
||||||
class GPSFlightPlan {
|
class GPSFlightPlan {
|
||||||
public:
|
public:
|
||||||
std::vector<GPSWaypoint*> waypoints;
|
std::vector<GPSWaypoint*> waypoints;
|
||||||
inline bool IsEmpty() { return(waypoints.size() == 0); }
|
inline bool IsEmpty() { return waypoints.empty(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO - probably de-public the internals of the next 2 classes and add some methods!
|
// TODO - probably de-public the internals of the next 2 classes and add some methods!
|
||||||
|
|
|
@ -977,7 +977,7 @@ MK_VIII::IOHandler::TerrainClearanceFilter::update (double agl)
|
||||||
|
|
||||||
// calculate average
|
// calculate average
|
||||||
double new_value = 0;
|
double new_value = 0;
|
||||||
if (samples.size() > 0)
|
if (! samples.empty())
|
||||||
{
|
{
|
||||||
// time consuming loop => queue limited to 75 samples
|
// time consuming loop => queue limited to 75 samples
|
||||||
// (= 15seconds * 5samples/second)
|
// (= 15seconds * 5samples/second)
|
||||||
|
|
|
@ -904,7 +904,7 @@ NavRadioImpl::~NavRadioImpl()
|
||||||
|
|
||||||
void NavRadioImpl::init()
|
void NavRadioImpl::init()
|
||||||
{
|
{
|
||||||
if( 0 < _components.size() )
|
if( ! _components.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_components.push_back( new VOR(_rootNode) );
|
_components.push_back( new VOR(_rootNode) );
|
||||||
|
|
|
@ -313,14 +313,14 @@ FGLocale::getLocalizedStrings(const char* id, const char* resource)
|
||||||
if (_currentLocale)
|
if (_currentLocale)
|
||||||
{
|
{
|
||||||
simgear::PropertyList s = getLocalizedStrings(_currentLocale, id, resource);
|
simgear::PropertyList s = getLocalizedStrings(_currentLocale, id, resource);
|
||||||
if (s.size())
|
if (! s.empty())
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_defaultLocale)
|
if (_defaultLocale)
|
||||||
{
|
{
|
||||||
simgear::PropertyList s = getLocalizedStrings(_defaultLocale, id, resource);
|
simgear::PropertyList s = getLocalizedStrings(_defaultLocale, id, resource);
|
||||||
if (s.size())
|
if (! s.empty())
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,13 +50,13 @@ FGLogger::init ()
|
||||||
Log &log = _logs[_logs.size()-1];
|
Log &log = _logs[_logs.size()-1];
|
||||||
|
|
||||||
string filename = child->getStringValue("filename");
|
string filename = child->getStringValue("filename");
|
||||||
if (filename.size() == 0) {
|
if (filename.empty()) {
|
||||||
filename = "fg_log.csv";
|
filename = "fg_log.csv";
|
||||||
child->setStringValue("filename", filename.c_str());
|
child->setStringValue("filename", filename.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
string delimiter = child->getStringValue("delimiter");
|
string delimiter = child->getStringValue("delimiter");
|
||||||
if (delimiter.size() == 0) {
|
if (delimiter.empty()) {
|
||||||
delimiter = ",";
|
delimiter = ",";
|
||||||
child->setStringValue("delimiter", delimiter.c_str());
|
child->setStringValue("delimiter", delimiter.c_str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -330,7 +330,7 @@ void printReport(SGMetar *m)
|
||||||
surface.push_back(buf);
|
surface.push_back(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surface.size()) {
|
if (! surface.empty()) {
|
||||||
vector<string>::iterator rwysurf = surface.begin();
|
vector<string>::iterator rwysurf = surface.begin();
|
||||||
for (i = 0; rwysurf != surface.end(); rwysurf++, i++) {
|
for (i = 0; rwysurf != surface.end(); rwysurf++, i++) {
|
||||||
if (i)
|
if (i)
|
||||||
|
|
|
@ -1775,7 +1775,7 @@ void Options::init(int argc, char **argv, const SGPath& appDataPath)
|
||||||
setupRoot();
|
setupRoot();
|
||||||
|
|
||||||
// system.fgfsrc handling
|
// system.fgfsrc handling
|
||||||
if( hostname.size() > 0 ) {
|
if( ! hostname.empty() ) {
|
||||||
config.set(globals->get_fg_root());
|
config.set(globals->get_fg_root());
|
||||||
config.append( "system.fgfsrc" );
|
config.append( "system.fgfsrc" );
|
||||||
config.concat( "." );
|
config.concat( "." );
|
||||||
|
@ -2160,7 +2160,7 @@ void Options::showUsage() const
|
||||||
|
|
||||||
vector<SGPropertyNode_ptr> desc;
|
vector<SGPropertyNode_ptr> desc;
|
||||||
desc = option[k]->getChildren("description");
|
desc = option[k]->getChildren("description");
|
||||||
if (desc.size() > 0) {
|
if (! desc.empty()) {
|
||||||
for ( unsigned int l = 0; l < desc.size(); l++) {
|
for ( unsigned int l = 0; l < desc.size(); l++) {
|
||||||
string t = desc[l]->getStringValue();
|
string t = desc[l]->getStringValue();
|
||||||
|
|
||||||
|
|
|
@ -329,7 +329,7 @@ static bool fgSetPosFromNAV( const string& id, const double& freq, FGPositioned:
|
||||||
FGNavList::TypeFilter filter(type);
|
FGNavList::TypeFilter filter(type);
|
||||||
const nav_list_type navlist = FGNavList::findByIdentAndFreq( id.c_str(), freq, &filter );
|
const nav_list_type navlist = FGNavList::findByIdentAndFreq( id.c_str(), freq, &filter );
|
||||||
|
|
||||||
if (navlist.size() == 0 ) {
|
if (navlist.empty()) {
|
||||||
SG_LOG( SG_GENERAL, SG_ALERT, "Failed to locate NAV = "
|
SG_LOG( SG_GENERAL, SG_ALERT, "Failed to locate NAV = "
|
||||||
<< id << ":" << freq );
|
<< id << ":" << freq );
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -209,7 +209,7 @@ do_reinit (const SGPropertyNode * arg)
|
||||||
bool result = true;
|
bool result = true;
|
||||||
|
|
||||||
vector<SGPropertyNode_ptr> subsystems = arg->getChildren("subsystem");
|
vector<SGPropertyNode_ptr> subsystems = arg->getChildren("subsystem");
|
||||||
if (subsystems.size() == 0) {
|
if (subsystems.empty()) {
|
||||||
globals->get_subsystem_mgr()->reinit();
|
globals->get_subsystem_mgr()->reinit();
|
||||||
} else {
|
} else {
|
||||||
for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
|
for ( unsigned int i = 0; i < subsystems.size(); i++ ) {
|
||||||
|
|
|
@ -567,7 +567,7 @@ FGGeneric::reinit()
|
||||||
// bad configuration
|
// bad configuration
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!binary_mode && (line_separator.size() == 0 ||
|
if (!binary_mode && (line_separator.empty() ||
|
||||||
*line_separator.rbegin() != '\n')) {
|
*line_separator.rbegin() != '\n')) {
|
||||||
|
|
||||||
SG_LOG(SG_IO, SG_WARN,
|
SG_LOG(SG_IO, SG_WARN,
|
||||||
|
|
|
@ -50,7 +50,7 @@ FGSampleQueue::FGSampleQueue ( SGSoundMgr *smgr, const std::string &refname ) :
|
||||||
|
|
||||||
FGSampleQueue::~FGSampleQueue ()
|
FGSampleQueue::~FGSampleQueue ()
|
||||||
{
|
{
|
||||||
while ( _messages.size() > 0 ) {
|
while ( ! _messages.empty() ) {
|
||||||
delete _messages.front();
|
delete _messages.front();
|
||||||
_messages.pop();
|
_messages.pop();
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ FGSampleQueue::update (double dt)
|
||||||
|
|
||||||
if ( !now_playing ) {
|
if ( !now_playing ) {
|
||||||
// message queue idle, add next sound if we have one
|
// message queue idle, add next sound if we have one
|
||||||
if ( _messages.size() > 0 ) {
|
if ( ! _messages.empty() ) {
|
||||||
SGSampleGroup::add( _messages.front(), msgid );
|
SGSampleGroup::add( _messages.front(), msgid );
|
||||||
_messages.pop();
|
_messages.pop();
|
||||||
play_once( msgid );
|
play_once( msgid );
|
||||||
|
|
|
@ -545,7 +545,7 @@ FGScheduledFlight* FGAISchedule::findAvailableFlight (const string ¤tDesti
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flights.size()) {
|
if (! flights.empty()) {
|
||||||
time_t arrival = flights.back()->getArrivalTime();
|
time_t arrival = flights.back()->getArrivalTime();
|
||||||
int groundTime = groundTimeFromRadius();
|
int groundTime = groundTimeFromRadius();
|
||||||
if ((*i)->getDepartureTime() < (arrival+(groundTime)))
|
if ((*i)->getDepartureTime() < (arrival+(groundTime)))
|
||||||
|
|
|
@ -350,7 +350,7 @@ void fgOSFullScreen()
|
||||||
std::vector<osgViewer::GraphicsWindow*> windows;
|
std::vector<osgViewer::GraphicsWindow*> windows;
|
||||||
viewer->getWindows(windows);
|
viewer->getWindows(windows);
|
||||||
|
|
||||||
if (windows.size() == 0)
|
if (windows.empty())
|
||||||
return; // Huh?!?
|
return; // Huh?!?
|
||||||
|
|
||||||
/* Toggling window fullscreen is only supported for the main GUI window.
|
/* Toggling window fullscreen is only supported for the main GUI window.
|
||||||
|
|
Loading…
Add table
Reference in a new issue