forked from VATSIM-UK/uk-controller-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(handoff): departure frequencies not updating after runway dialog …
…change Runway dialog changes do trigger a SID change, but do not trigger a FP change event. This means the plugin does not update the departure frequencies of any FPs that had an airfield resolved handoff, even if the new SID (after the runway dialog change) would have had a different controller. This fixes that by clearing the handoff cache after a runway dialog change. fix VATSIM-UK#480
- Loading branch information
Showing
8 changed files
with
78 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include "ClearCacheOnRunwayDialogSave.h" | ||
#include "HandoffCache.h" | ||
|
||
namespace UKControllerPlugin::Handoff { | ||
|
||
ClearCacheOnRunwayDialogSave::ClearCacheOnRunwayDialogSave(std::shared_ptr<HandoffCache> cache) : cache(cache) | ||
{ | ||
assert(cache && "Handoff cache not set in ctor"); | ||
} | ||
|
||
void ClearCacheOnRunwayDialogSave::RunwayDialogSaved() | ||
{ | ||
cache->Clear(); | ||
} | ||
} // namespace UKControllerPlugin::Handoff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#pragma once | ||
#include "euroscope/RunwayDialogAwareInterface.h" | ||
|
||
namespace UKControllerPlugin::Handoff { | ||
|
||
class HandoffCache; | ||
|
||
class ClearCacheOnRunwayDialogSave : public Euroscope::RunwayDialogAwareInterface | ||
{ | ||
public: | ||
ClearCacheOnRunwayDialogSave(std::shared_ptr<HandoffCache> cache); | ||
void RunwayDialogSaved() override; | ||
|
||
private: | ||
// The cache | ||
const std::shared_ptr<HandoffCache> cache; | ||
}; | ||
} // namespace UKControllerPlugin::Handoff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "handoff/ClearCacheOnRunwayDialogSave.h" | ||
#include "handoff/HandoffCache.h" | ||
#include "handoff/ResolvedHandoff.h" | ||
|
||
using UKControllerPlugin::Handoff::ClearCacheOnRunwayDialogSave; | ||
using UKControllerPlugin::Handoff::HandoffCache; | ||
using UKControllerPlugin::Handoff::ResolvedHandoff; | ||
|
||
namespace UKControllerPluginTest::Handoff { | ||
|
||
class ClearCacheOnRunwayDialogSaveTest : public testing::Test | ||
{ | ||
}; | ||
|
||
TEST_F(ClearCacheOnRunwayDialogSaveTest, FlushingCallsignsClearsCache) | ||
{ | ||
auto cache = std::make_shared<HandoffCache>(); | ||
ClearCacheOnRunwayDialogSave clear(cache); | ||
|
||
cache->Add(std::make_shared<ResolvedHandoff>("BAW123", nullptr, nullptr, nullptr)); | ||
cache->Add(std::make_shared<ResolvedHandoff>("BAW456", nullptr, nullptr, nullptr)); | ||
cache->Add(std::make_shared<ResolvedHandoff>("BAW789", nullptr, nullptr, nullptr)); | ||
|
||
EXPECT_EQ(3, cache->Count()); | ||
clear.RunwayDialogSaved(); | ||
EXPECT_EQ(0, cache->Count()); | ||
} | ||
} // namespace UKControllerPluginTest::Handoff |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters