//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
#endif
#include "kln89_page_fpl.hxx"
+
#include <algorithm>
+#include <iostream>
using namespace std;
_bEntWp = true;
_fp0SelWpId.clear(); // Waypoints don't become the DTO default whilst being entered.
- bool multi;
- const GPSWaypoint* wp = _kln89->FindFirstById(_entWpStr.substr(0, _wLinePos+1), multi, false);
+ GPSWaypoint* wp = _kln89->FindFirstById(_entWpStr.substr(0, _wLinePos+1));
if(NULL == wp) {
// no-op
} else {
- if(_entWp == NULL) {
- _entWp = new GPSWaypoint;
- if(_fplPos + (_uLinePos - 4) >= _kln89->_flightPlans[_subPage]->waypoints.size()) {
+ if(_entWp) {
+ *_entWp = *wp; // copy
+ delete wp;
+ } else {
+ _entWp = wp;
+ if(_fplPos + (_uLinePos - 4) >= _kln89->_flightPlans[_subPage]->waypoints.size()) {
_kln89->_flightPlans[_subPage]->waypoints.push_back(_entWp);
} else {
_kln89->_flightPlans[_subPage]->waypoints.insert(_kln89->_flightPlans[_subPage]->waypoints.begin()+(_fplPos + (_uLinePos - 4)), _entWp);
}
- }
- // copy
- *_entWp = *wp;
+ }
}
}
}
_bEntWp = true;
_fp0SelWpId.clear(); // Waypoints don't become the DTO default whilst being entered.
- bool multi;
- const GPSWaypoint* wp = _kln89->FindFirstById(_entWpStr.substr(0, _wLinePos+1), multi, false);
+ GPSWaypoint* wp = _kln89->FindFirstById(_entWpStr.substr(0, _wLinePos+1));
if(NULL == wp) {
// no-op
} else {
- if(_entWp == NULL) {
- _entWp = new GPSWaypoint;
- if(_fplPos + (_uLinePos - 4) >= _kln89->_flightPlans[_subPage]->waypoints.size()) {
+ if(_entWp) {
+ *_entWp = *wp; // copy
+ delete wp;
+ } else {
+ _entWp = wp;
+ if(_fplPos + (_uLinePos - 4) >= _kln89->_flightPlans[_subPage]->waypoints.size()) {
_kln89->_flightPlans[_subPage]->waypoints.push_back(_entWp);
} else {
_kln89->_flightPlans[_subPage]->waypoints.insert(_kln89->_flightPlans[_subPage]->waypoints.begin()+(_fplPos + (_uLinePos - 4)), _entWp);
}
- }
- // copy
- *_entWp = *wp;
+ }
}
}
}