mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Extract entry list truncation.
This commit is contained in:
parent
9791d64b50
commit
8fce9378cc
@ -349,6 +349,12 @@ void AISView::on_hide() {
|
|||||||
View::on_hide();
|
View::on_hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AISView::truncate_entries() {
|
||||||
|
while(recent.size() > 64) {
|
||||||
|
recent.pop_back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void AISView::on_packet(const baseband::ais::Packet& packet) {
|
void AISView::on_packet(const baseband::ais::Packet& packet) {
|
||||||
const auto source_id = packet.source_id();
|
const auto source_id = packet.source_id();
|
||||||
auto matching_recent = std::find_if(recent.begin(), recent.end(),
|
auto matching_recent = std::find_if(recent.begin(), recent.end(),
|
||||||
@ -360,9 +366,7 @@ void AISView::on_packet(const baseband::ais::Packet& packet) {
|
|||||||
recent.erase(matching_recent);
|
recent.erase(matching_recent);
|
||||||
} else {
|
} else {
|
||||||
recent.emplace_front(source_id);
|
recent.emplace_front(source_id);
|
||||||
while(recent.size() > 64) {
|
truncate_entries();
|
||||||
recent.pop_back();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& entry = recent.front();
|
auto& entry = recent.front();
|
||||||
|
@ -173,6 +173,8 @@ private:
|
|||||||
|
|
||||||
void on_packet(const baseband::ais::Packet& packet);
|
void on_packet(const baseband::ais::Packet& packet);
|
||||||
|
|
||||||
|
void truncate_entries();
|
||||||
|
|
||||||
RecentEntries::iterator selected_entry();
|
RecentEntries::iterator selected_entry();
|
||||||
|
|
||||||
void advance(const int32_t amount);
|
void advance(const int32_t amount);
|
||||||
|
Loading…
Reference in New Issue
Block a user