introduce the concept of system contributions
This commit is contained in:
@@ -227,6 +227,10 @@ public class Objective : IComparable<Objective> {
|
||||
string.Compare(faction, Faction) == 0;
|
||||
}
|
||||
|
||||
public bool Matches(string system) {
|
||||
return string.Compare(system, System) == 0;
|
||||
}
|
||||
|
||||
public int CompareTo(Objective other) {
|
||||
return (other.System == System &&
|
||||
other.Faction == Faction) ? 0 : -1;
|
||||
|
||||
@@ -18,10 +18,19 @@ public class Report {
|
||||
}
|
||||
|
||||
foreach (Transaction t in transactions) {
|
||||
Objective o = Objectives.Find(x => x.Matches(t.System, t.Faction));
|
||||
Objective o;
|
||||
if (t.SystemContribution) {
|
||||
o = Objectives.Find(x => x.Matches(t.System));
|
||||
} else {
|
||||
o = Objectives.Find(x => x.Matches(t.System, t.Faction));
|
||||
}
|
||||
|
||||
if (o == null) {
|
||||
o = new Objective() { Faction = t.Faction, System = t.System };
|
||||
if (t.SystemContribution) {
|
||||
o = new Objective() { System = t.System };
|
||||
} else {
|
||||
o = new Objective() { Faction = t.Faction, System = t.System };
|
||||
}
|
||||
Objectives.Add(o);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user