]> git.mxchange.org Git - flightgear.git/blobdiff - src/Instrumentation/KLN89/kln89_page_fpl.cxx
Make hardcoded error values configurable.
[flightgear.git] / src / Instrumentation / KLN89 / kln89_page_fpl.cxx
index 99dfe982aaffcfe1fe22b9663ade6b7c0acfe6eb..b789343713650ad9666bbd70e37156ca0272fd41 100644 (file)
 //
 // 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$
 
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
 #include "kln89_page_fpl.hxx"
+
 #include <algorithm>
+#include <iostream>
 
 using namespace std;
 
@@ -934,21 +940,21 @@ void KLN89FplPage::Knob2Left1() {
                                _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;
+          }
                                }
                        }
                }
@@ -1007,21 +1013,21 @@ void KLN89FplPage::Knob2Right1() {
                                _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;
+          }
                                }
                        }
                }