From 6d404a99e275eb727a60a677d19a0ef4e9c1014e Mon Sep 17 00:00:00 2001 From: Florian Stinglmayr Date: Sat, 20 Nov 2021 11:27:56 +0100 Subject: [PATCH] improve matching of entries to objectives If the faction does not match, we don't care about the other match criteria. --- BGS/Objective.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/BGS/Objective.cs b/BGS/Objective.cs index 7ffe90f..4336102 100644 --- a/BGS/Objective.cs +++ b/BGS/Objective.cs @@ -32,6 +32,19 @@ namespace EliteBGS.BGS { } } + if (e.Faction != null && faction != null) { + if (string.Compare(e.Faction, faction, true) != 0) { + /* if we have a faction, and it doesn't match we don't care. + * faction is the most important comparision, so if it doesn't match + * it is not the right objective + */ + return 0; + } else { + ++match_count; + } + } + + /* system and station only add to the match strength though */ if (e.System != null && system != null) { if (string.Compare(e.System, system, true) == 0) { ++match_count; @@ -44,12 +57,6 @@ namespace EliteBGS.BGS { } } - if (e.Faction != null && faction != null) { - if (string.Compare(e.Faction, faction, true) == 0) { - ++match_count; - } - } - return match_count; }