diff --git a/EDPlayerJournal/BGS/TransactionParser.cs b/EDPlayerJournal/BGS/TransactionParser.cs index 4ff0a6f..c9ad6f7 100644 --- a/EDPlayerJournal/BGS/TransactionParser.cs +++ b/EDPlayerJournal/BGS/TransactionParser.cs @@ -635,15 +635,22 @@ internal class SearchAndRescueParser : TransactionParserPart { internal class MarketBuyParser : TransactionParserPart { public void Parse(Entry e, TransactionParserContext context, TransactionParserOptions options, TransactionList transactions) { - if (options.IgnoreMarketBuy) { - return; - } - MarketBuyEntry? entry = e as MarketBuyEntry; if (entry == null) { throw new NotImplementedException(); } + context.BoughtCargo(entry.Type, entry.BuyPrice); + + // We still want the information on buy price for profit, + // but if the option is on, we don't care for parsing it + // further. + // TODO: might be wise to split this parser into two; one for + // determining profit, the other for the BGS information + if (options.IgnoreMarketBuy) { + return; + } + if (context.StationOwner == null) { transactions.AddIncomplete( new OrganicData(), @@ -652,8 +659,6 @@ internal class MarketBuyParser : TransactionParserPart { return; } - context.BoughtCargo(entry.Type, entry.BuyPrice); - transactions.Add(new BuyCargo(entry) { System = context.CurrentSystem, Station = context.CurrentStation,