Skip to content

Commit

Permalink
Merge pull request #512 from AndyTWF/fix-oceanic-crash
Browse files Browse the repository at this point in the history
fix: oceanic tag items crash
  • Loading branch information
AndyTWF authored Mar 31, 2023
2 parents cb24197 + 462744d commit eb9dfca
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
build:
name: Build
runs-on: windows-latest
runs-on: windows-2019
concurrency:
group: ukcp-build-${{ github.ref }}
cancel-in-progress: true
Expand Down Expand Up @@ -103,7 +103,7 @@ jobs:
CFLAGS: -m32
CXX: clang-cl
CXXFLAGS: -m32
run: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_DEPENDS_USE_COMPILER=FALSE -G Ninja -Bbuild
run: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G Ninja -Bbuild

# Run the build and tests
- name: Run Ninja Build
Expand All @@ -113,7 +113,6 @@ jobs:
- name: Run Tests
working-directory: build
run: |
.\\bin\\UKControllerPluginCoreTest.exe
ctest -C Release --output-on-failure --no-tests=error
# Do Srclinting
Expand Down
16 changes: 10 additions & 6 deletions src/plugin/oceanic/OceanicEventHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,7 @@ namespace UKControllerPlugin::Oceanic {
const std::string& context,
const POINT& mousePos)
{
auto lock = std::lock_guard(this->clearanceMapMutex);
auto storedClearance = this->clearances.find(flightplan.GetCallsign());
this->currentlySelectedClearance = storedClearance != this->clearances.cend()
? storedClearance->second
: GetDefaultClearanceForCallsign(flightplan);

SetCurrentlySelectedClearance(flightplan);
this->dialogManager.OpenDialog(
IDD_OCEANIC_CLEARANCE,
reinterpret_cast<LPARAM>(&this->currentlySelectedClearance) // NOLINT
Expand Down Expand Up @@ -245,4 +240,13 @@ namespace UKControllerPlugin::Oceanic {
{
return Clearance{flightplan.GetCallsign()};
}

void OceanicEventHandler::SetCurrentlySelectedClearance(Euroscope::EuroScopeCFlightPlanInterface& flightplan)
{
auto lock = std::lock_guard(this->clearanceMapMutex);
auto storedClearance = this->clearances.find(flightplan.GetCallsign());
this->currentlySelectedClearance = storedClearance != this->clearances.cend()
? storedClearance->second
: GetDefaultClearanceForCallsign(flightplan);
}
} // namespace UKControllerPlugin::Oceanic
1 change: 1 addition & 0 deletions src/plugin/oceanic/OceanicEventHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ namespace UKControllerPlugin::Oceanic {
static auto GetDefaultClearanceForCallsign(Euroscope::EuroScopeCFlightPlanInterface& flightplan) -> Clearance;
static auto ConvertNattrakLevelToEuroscope(const std::string& level) -> int;
static auto NattrakLevelValid(std::string level) -> bool;
void SetCurrentlySelectedClearance(Euroscope::EuroScopeCFlightPlanInterface& flightplan);
[[nodiscard]] static auto GetClearedTagItemColour(int clearedLevel, int currentLevel) -> COLORREF;
void SetClearanceIndicatorTagItem(Tag::TagData& tagData, const Clearance& clearance) const;
void SetClearedLevelTagItem(Tag::TagData& tagData, const Clearance& clearance) const;
Expand Down

0 comments on commit eb9dfca

Please sign in to comment.