From fca1e607ec17434a583598e959b994e2c6d4eeeb Mon Sep 17 00:00:00 2001 From: Florian Stinglmayr Date: Fri, 9 Jul 2021 11:39:09 +0200 Subject: [PATCH] add a few comments to the code for explanation --- BGS/Report.cs | 14 ++++++++++++++ Journal/MissionCompletedEntry.cs | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/BGS/Report.cs b/BGS/Report.cs index 68888d6..2e8bd60 100644 --- a/BGS/Report.cs +++ b/BGS/Report.cs @@ -66,20 +66,30 @@ namespace NonaBGS.BGS { */ current_station = (e as DockedEntry).StationName; } else if (e.Is(Events.FSDJump)) { + /* Gleem current system and controlling faction from this message. + */ current_system = (e as FSDJumpEntry).StarSystem; controlling_faction = (e as FSDJumpEntry).SystemFaction; } else if (e.Is(Events.MissionCompleted)) { var completed = e as MissionCompletedEntry; entry = new MissionCompleted(completed, current_system, current_station); if (completed.HumanReadableNameWasGenerated) { + /* If the human readable name was generated, we send a log message. Because the + * generated names all sort of suck, we should have more human readable names in + * in the lookup dictionary. + */ OnLog?.Invoke("Human readable name for mission \"" + completed.Name + "\" was generated, please report this."); } } else if (e.Is(Events.MultiSellExplorationData)) { + /* For multi-sell-exploraton-data only the controlling faction of the station sold to matters. + */ entry = new Cartographics(e as MultiSellExplorationDataEntry, current_system, current_station); entry.Faction = controlling_faction; } else if (e.Is(Events.RedeemVoucher)) { + /* Same for selling combat vouchers. Only the current controlling faction matters here. + */ entry = new Vouchers(); entry.Entries.Add(e); entry.System = current_system; @@ -94,6 +104,8 @@ namespace NonaBGS.BGS { continue; } + /* Find all objectives that generally match. + */ var matches = objectives .Where(x => x.Matches(entry) > 0) .OrderBy(x => x.Matches(entry)) @@ -102,6 +114,8 @@ namespace NonaBGS.BGS { continue; } + /* Then select the one that matches the most. + */ var objective = matches .OrderBy(x => x.Matches(entry)) .Reverse() diff --git a/Journal/MissionCompletedEntry.cs b/Journal/MissionCompletedEntry.cs index 4ad147d..7f48752 100644 --- a/Journal/MissionCompletedEntry.cs +++ b/Journal/MissionCompletedEntry.cs @@ -16,7 +16,9 @@ namespace NonaBGS.Journal { private int count = 0; private int donated = 0; - private readonly Dictionary humanreadable = new Dictionary { + /* TODO: make this a file at some point for easier editing. + */ + private static readonly Dictionary humanreadable = new Dictionary { { "Mission_AltruismCredits_name", "Donate Credits" }, { "Mission_Collect_name", "Collect" }, { "Mission_Courier_Elections_name", "Courier (Elections)" },