From 0346b8e7e7690ccbb545f5cef31843f272fed8ad Mon Sep 17 00:00:00 2001 From: Florian Stinglmayr Date: Fri, 9 Jul 2021 11:30:11 +0200 Subject: [PATCH] fix objective comparison so same objectives are not added twice --- BGS/Objective.cs | 3 ++- BGS/Report.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/BGS/Objective.cs b/BGS/Objective.cs index aee1b17..9331a4d 100644 --- a/BGS/Objective.cs +++ b/BGS/Objective.cs @@ -1,9 +1,10 @@ using System.Collections.Generic; +using System; using System.Text; using Newtonsoft.Json; namespace NonaBGS.BGS { - public class Objective { + public class Objective : IComparable { private string system; private string station; private string faction; diff --git a/BGS/Report.cs b/BGS/Report.cs index f6c42fb..68888d6 100644 --- a/BGS/Report.cs +++ b/BGS/Report.cs @@ -21,7 +21,7 @@ namespace NonaBGS.BGS { } public bool AddObjective(Objective objective) { - var found = objectives.Find(x => x == objective); + var found = objectives.Find(x => x.CompareTo(objective) == 0); bool added = false; if (found == null) {