Skip to content

Commit

Permalink
feat(srd): allow srd searches by flight level (#360)
Browse files Browse the repository at this point in the history
* feat(srd): allow srd searches by flight level

Previously, you had type in the full altitude. Now it assumes that any altitude <1000 is a flight
level, and thus performs the conversion.

fix #358

* Fix negation
  • Loading branch information
AndyTWF committed Nov 28, 2021
1 parent aecd271 commit e7b1899
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion resource/UKControllerPlugin.rc
Expand Up @@ -190,7 +190,7 @@ BEGIN
EDITTEXT IDC_SRD_DESTINATION,98,24,71,14,ES_UPPERCASE | ES_AUTOHSCROLL
LTEXT "Destination Fix or Airfield*",IDC_SRD_DESTINATION_STATIC,7,27,85,8
EDITTEXT IDC_SRD_CRUISE,98,43,72,14,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "Requested Cruise Altitude",IDC_SRD_CRUISE_STATIC,7,46,84,8
LTEXT "Cruising Altitude or Level",IDC_SRD_CRUISE_STATIC,7,46,80,8
LTEXT "* Required Field",IDC_STATIC_REQUIRED,213,27,52,8
CONTROL "",IDC_SRD_RESULTS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_EDITLABELS | LVS_ALIGNLEFT | WS_BORDER | WS_TABSTOP,7,85,295,90
DEFPUSHBUTTON "Search",IDC_SRD_SEARCH,59,61,50,14
Expand Down
6 changes: 5 additions & 1 deletion src/plugin/srd/SrdSearchDialog.cpp
Expand Up @@ -211,8 +211,12 @@ namespace UKControllerPlugin {
SendDlgItemMessage(hwnd, IDC_SRD_CRUISE, WM_GETTEXT, 255, reinterpret_cast<LPARAM>(&cruiseBuffer));
std::string requestedLevel = UKControllerPlugin::Hold::ConvertFromTchar(cruiseBuffer);

if (requestedLevel != "") {
// If the requested level is < 100, assume it's a flight-level
if (!requestedLevel.empty()) {
searchParams.requestedLevel = std::stoi(requestedLevel);
if (searchParams.requestedLevel < 1000) {
searchParams.requestedLevel *= 100;
}
}

// Clear the results list and notes box
Expand Down

0 comments on commit e7b1899

Please sign in to comment.