mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-10-01 01:26:06 -04:00
Dedupe code, call AISRecentEntries::find_by_mmsi().
This commit is contained in:
parent
3df003a678
commit
af8630a6f3
@ -101,9 +101,7 @@ void AISLogger::on_packet(const ais::Packet& packet) {
|
|||||||
|
|
||||||
void AISRecentEntries::on_packet(const ais::Packet& packet) {
|
void AISRecentEntries::on_packet(const ais::Packet& packet) {
|
||||||
const auto source_id = packet.source_id();
|
const auto source_id = packet.source_id();
|
||||||
auto matching_recent = std::find_if(entries.begin(), entries.end(),
|
auto matching_recent = find_by_mmsi(source_id);
|
||||||
[source_id](const AISRecentEntry& entry) { return entry.mmsi == source_id; }
|
|
||||||
);
|
|
||||||
if( matching_recent != entries.end() ) {
|
if( matching_recent != entries.end() ) {
|
||||||
// Found within. Move to front of list, increment counter.
|
// Found within. Move to front of list, increment counter.
|
||||||
entries.push_front(*matching_recent);
|
entries.push_front(*matching_recent);
|
||||||
|
Loading…
Reference in New Issue
Block a user