we still want profit info, just not BGS info

This commit is contained in:
Florian Stinglmayr 2023-04-19 09:19:37 +02:00
parent f4bbd3df2b
commit 87314d0258

View File

@ -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,